[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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user