[FL-1250, FL-1252, FL-1323, FL-1324] New IRDA Application (part 1) (#497)

* Add new IrdaApp (half ready), add ButtonMenu

* Fix NEC's extension

* clang-format

* Fix leak

* Add submenu optional header

* IRDA: add Edit button

* clang-format

* IrdaApp: Fix scene flow

* Add IRDA NEC extended protocol

* IRDA: Add address/command length

Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
Albert Kharisov
2021-06-02 18:16:05 +03:00
committed by GitHub
parent d040515f84
commit 31c31db479
62 changed files with 2568 additions and 375 deletions

View File

@@ -42,3 +42,21 @@ void irda_encoder_nec_encode(uint32_t addr, uint32_t cmd, bool repeat) {
}
}
// Some NEC's extensions allow 16 bit address
void irda_encoder_necext_encode(uint32_t addr, uint32_t cmd, bool repeat) {
uint16_t address = addr & 0xFFFF;
uint8_t command = cmd & 0xFF;
uint8_t command_inverse = (uint8_t) ~command;
if (!repeat) {
irda_encode_nec_preamble();
irda_encode_byte(&encoder_timings, (uint8_t) address);
irda_encode_byte(&encoder_timings, (uint8_t) (address >> 8));
irda_encode_byte(&encoder_timings, command);
irda_encode_byte(&encoder_timings, command_inverse);
irda_encode_bit(&encoder_timings, 1);
} else {
irda_encode_nec_repeat();
}
}