[FL-1800] IRDA: enc/decoder refactoring, Add NEC42 (#705)

* WIP: IRDA: multilen protocol refactoring, NEC42
* IRDA: Refactoring encoder/decoder

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov
2021-09-15 20:22:58 +03:00
committed by GitHub
parent 4768177cf5
commit 4f233ff0a3
21 changed files with 551 additions and 437 deletions

View File

@@ -12,10 +12,12 @@ const IrdaCommonProtocolSpec protocol_nec = {
.preamble_tolerance = IRDA_NEC_PREAMBLE_TOLERANCE,
.bit_tolerance = IRDA_NEC_BIT_TOLERANCE,
.silence_time = IRDA_NEC_SILENCE,
.min_split_time = IRDA_NEC_MIN_SPLIT_TIME,
},
.databit_len = 32,
.databit_len[0] = 42,
.databit_len[1] = 32,
.no_stop_bit = false,
.decode = irda_common_decode_pdm,
.decode = irda_common_decode_pdwm,
.encode = irda_common_encode_pdwm,
.interpret = irda_decoder_nec_interpret,
.decode_repeat = irda_decoder_nec_decode_repeat,
@@ -34,9 +36,9 @@ const IrdaCommonProtocolSpec protocol_samsung32 = {
.bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
.silence_time = IRDA_SAMSUNG_SILENCE,
},
.databit_len = 32,
.databit_len[0] = 32,
.no_stop_bit = false,
.decode = irda_common_decode_pdm,
.decode = irda_common_decode_pdwm,
.encode = irda_common_encode_pdwm,
.interpret = irda_decoder_samsung32_interpret,
.decode_repeat = irda_decoder_samsung32_decode_repeat,
@@ -52,7 +54,7 @@ const IrdaCommonProtocolSpec protocol_rc6 = {
.bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
.silence_time = IRDA_RC6_SILENCE,
},
.databit_len = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
.databit_len[0] = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
.manchester_start_from_space = false,
.decode = irda_decoder_rc6_decode_manchester,
.encode = irda_encoder_rc6_encode_manchester,
@@ -70,7 +72,7 @@ const IrdaCommonProtocolSpec protocol_rc5 = {
.bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
.silence_time = IRDA_RC5_SILENCE,
},
.databit_len = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
.databit_len[0] = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
.manchester_start_from_space = true,
.decode = irda_common_decode_manchester,
.encode = irda_common_encode_manchester,
@@ -90,10 +92,13 @@ const IrdaCommonProtocolSpec protocol_sirc = {
.preamble_tolerance = IRDA_SIRC_PREAMBLE_TOLERANCE,
.bit_tolerance = IRDA_SIRC_BIT_TOLERANCE,
.silence_time = IRDA_SIRC_SILENCE,
.min_split_time = IRDA_SIRC_MIN_SPLIT_TIME,
},
.databit_len = 20, /* 12/15/20 */
.databit_len[0] = 20,
.databit_len[1] = 15,
.databit_len[2] = 12,
.no_stop_bit = true,
.decode = irda_common_decode_pwm,
.decode = irda_common_decode_pdwm,
.encode = irda_common_encode_pdwm,
.interpret = irda_decoder_sirc_interpret,
.decode_repeat = NULL,