[FL-1684] IRDA Add SIRC protocol (#693)

* IRDA HAL: Fill buffer refactoring
* IRDA: Add SIRC protocol
* IRDA: correct adr/cmd bit length
* Disable Unit tests

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov
2021-09-10 00:37:32 +03:00
committed by GitHub
parent 9bce160ca6
commit fbccb9fbaf
36 changed files with 1216 additions and 223 deletions

View File

@@ -43,9 +43,9 @@ IrdaStatus irda_decoder_nec_decode_repeat(IrdaCommonDecoder* decoder) {
if((decoder->timings[0] > IRDA_NEC_REPEAT_PAUSE_MIN) &&
(decoder->timings[0] < IRDA_NEC_REPEAT_PAUSE_MAX) &&
MATCH_PREAMBLE_TIMING(decoder->timings[1], IRDA_NEC_REPEAT_MARK, preamble_tolerance) &&
MATCH_PREAMBLE_TIMING(decoder->timings[2], IRDA_NEC_REPEAT_SPACE, preamble_tolerance) &&
MATCH_BIT_TIMING(decoder->timings[3], decoder->protocol->timings.bit1_mark, bit_tolerance)) {
MATCH_TIMING(decoder->timings[1], IRDA_NEC_REPEAT_MARK, preamble_tolerance) &&
MATCH_TIMING(decoder->timings[2], IRDA_NEC_REPEAT_SPACE, preamble_tolerance) &&
MATCH_TIMING(decoder->timings[3], decoder->protocol->timings.bit1_mark, bit_tolerance)) {
status = IrdaStatusReady;
decoder->timings_cnt = 0;
} else {

View File

@@ -7,7 +7,7 @@
#include <furi.h>
static const uint32_t repeat_timings[] = {
IRDA_NEC_REPEAT_PAUSE2,
IRDA_NEC_REPEAT_PERIOD - IRDA_NEC_REPEAT_MARK - IRDA_NEC_REPEAT_SPACE - IRDA_NEC_BIT1_MARK,
IRDA_NEC_REPEAT_MARK,
IRDA_NEC_REPEAT_SPACE,
IRDA_NEC_BIT1_MARK,
@@ -44,10 +44,11 @@ IrdaStatus irda_encoder_nec_encode_repeat(IrdaCommonEncoder* encoder, uint32_t*
furi_assert(encoder->timings_encoded >= timings_encoded_up_to_repeat);
if (repeat_cnt > 0)
if (repeat_cnt > 0) {
*duration = repeat_timings[repeat_cnt % COUNT_OF(repeat_timings)];
else
*duration = IRDA_NEC_REPEAT_PAUSE1;
} else {
*duration = IRDA_NEC_REPEAT_PERIOD - encoder->timings_sum;
}
*level = repeat_cnt % 2;
++encoder->timings_encoded;

View File

@@ -3,16 +3,16 @@
static const IrdaProtocolSpecification irda_nec_protocol_specification = {
.name = "NEC",
.address_length = 2,
.command_length = 2,
.address_length = 8,
.command_length = 8,
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
};
static const IrdaProtocolSpecification irda_necext_protocol_specification = {
.name = "NECext",
.address_length = 4,
.command_length = 2,
.address_length = 16,
.command_length = 8,
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
};