[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:
@@ -4,8 +4,34 @@
|
||||
#include <stdbool.h>
|
||||
#include <furi.h>
|
||||
#include "irda_i.h"
|
||||
#include <stdint.h>
|
||||
|
||||
static void irda_common_decoder_reset_state(IrdaCommonDecoder* common_decoder);
|
||||
static void irda_common_decoder_reset_state(IrdaCommonDecoder* decoder);
|
||||
|
||||
static inline size_t consume_samples(uint32_t* array, size_t len, size_t shift) {
|
||||
furi_assert(len >= shift);
|
||||
len -= shift;
|
||||
for (int i = 0; i < len; ++i)
|
||||
array[i] = array[i + shift];
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static inline void accumulate_lsb(IrdaCommonDecoder* decoder, bool bit) {
|
||||
uint16_t index = decoder->databit_cnt / 8;
|
||||
uint8_t shift = decoder->databit_cnt % 8; // LSB first
|
||||
|
||||
if (!shift)
|
||||
decoder->data[index] = 0;
|
||||
|
||||
if (bit) {
|
||||
decoder->data[index] |= (0x1 << shift); // add 1
|
||||
} else {
|
||||
(void) decoder->data[index]; // add 0
|
||||
}
|
||||
|
||||
++decoder->databit_cnt;
|
||||
}
|
||||
|
||||
static bool irda_check_preamble(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
@@ -16,8 +42,7 @@ static bool irda_check_preamble(IrdaCommonDecoder* decoder) {
|
||||
// align to start at Mark timing
|
||||
if (!start_level) {
|
||||
if (decoder->timings_cnt > 0) {
|
||||
--decoder->timings_cnt;
|
||||
shift_left_array(decoder->timings, decoder->timings_cnt, 1);
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,25 +55,22 @@ static bool irda_check_preamble(IrdaCommonDecoder* decoder) {
|
||||
uint16_t preamble_mark = decoder->protocol->timings.preamble_mark;
|
||||
uint16_t preamble_space = decoder->protocol->timings.preamble_space;
|
||||
|
||||
if ((MATCH_PREAMBLE_TIMING(decoder->timings[0], preamble_mark, preamble_tolerance))
|
||||
&& (MATCH_PREAMBLE_TIMING(decoder->timings[1], preamble_space, preamble_tolerance))) {
|
||||
if ((MATCH_TIMING(decoder->timings[0], preamble_mark, preamble_tolerance))
|
||||
&& (MATCH_TIMING(decoder->timings[1], preamble_space, preamble_tolerance))) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
decoder->timings_cnt -= 2;
|
||||
shift_left_array(decoder->timings, decoder->timings_cnt, 2);
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 2);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Pulse Distance-Width Modulation */
|
||||
IrdaStatus irda_common_decode_pdwm(IrdaCommonDecoder* decoder) {
|
||||
/* Pulse Distance Modulation */
|
||||
IrdaStatus irda_common_decode_pdm(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
|
||||
uint32_t* timings = decoder->timings;
|
||||
uint16_t index = 0;
|
||||
uint8_t shift = 0;
|
||||
IrdaStatus status = IrdaStatusError;
|
||||
uint32_t bit_tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
uint16_t bit1_mark = decoder->protocol->timings.bit1_mark;
|
||||
@@ -59,7 +81,7 @@ IrdaStatus irda_common_decode_pdwm(IrdaCommonDecoder* decoder) {
|
||||
while (1) {
|
||||
// Stop bit
|
||||
if ((decoder->databit_cnt == decoder->protocol->databit_len) && (decoder->timings_cnt == 1)) {
|
||||
if (MATCH_BIT_TIMING(timings[0], bit1_mark, bit_tolerance)) {
|
||||
if (MATCH_TIMING(timings[0], bit1_mark, bit_tolerance)) {
|
||||
decoder->timings_cnt = 0;
|
||||
status = IrdaStatusReady;
|
||||
} else {
|
||||
@@ -69,23 +91,17 @@ IrdaStatus irda_common_decode_pdwm(IrdaCommonDecoder* decoder) {
|
||||
}
|
||||
|
||||
if (decoder->timings_cnt >= 2) {
|
||||
index = decoder->databit_cnt / 8;
|
||||
shift = decoder->databit_cnt % 8; // LSB first
|
||||
if (!shift)
|
||||
decoder->data[index] = 0;
|
||||
if (MATCH_BIT_TIMING(timings[0], bit1_mark, bit_tolerance)
|
||||
&& MATCH_BIT_TIMING(timings[1], bit1_space, bit_tolerance)) {
|
||||
decoder->data[index] |= (0x1 << shift); // add 1
|
||||
} else if (MATCH_BIT_TIMING(timings[0], bit0_mark, bit_tolerance)
|
||||
&& MATCH_BIT_TIMING(timings[1], bit0_space, bit_tolerance)) {
|
||||
(void) decoder->data[index]; // add 0
|
||||
if (MATCH_TIMING(timings[0], bit1_mark, bit_tolerance)
|
||||
&& MATCH_TIMING(timings[1], bit1_space, bit_tolerance)) {
|
||||
accumulate_lsb(decoder, 1);
|
||||
} else if (MATCH_TIMING(timings[0], bit0_mark, bit_tolerance)
|
||||
&& MATCH_TIMING(timings[1], bit0_space, bit_tolerance)) {
|
||||
accumulate_lsb(decoder, 0);
|
||||
} else {
|
||||
status = IrdaStatusError;
|
||||
break;
|
||||
}
|
||||
++decoder->databit_cnt;
|
||||
decoder->timings_cnt -= 2;
|
||||
shift_left_array(decoder->timings, decoder->timings_cnt, 2);
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 2);
|
||||
} else {
|
||||
status = IrdaStatusOk;
|
||||
break;
|
||||
@@ -107,8 +123,8 @@ IrdaStatus irda_common_decode_manchester(IrdaCommonDecoder* decoder) {
|
||||
bool* switch_detect = &decoder->switch_detect;
|
||||
furi_assert((*switch_detect == true) || (*switch_detect == false));
|
||||
|
||||
bool single_timing = MATCH_BIT_TIMING(timing, bit, tolerance);
|
||||
bool double_timing = MATCH_BIT_TIMING(timing, 2*bit, tolerance);
|
||||
bool single_timing = MATCH_TIMING(timing, bit, tolerance);
|
||||
bool double_timing = MATCH_TIMING(timing, 2*bit, tolerance);
|
||||
|
||||
if(!single_timing && !double_timing) {
|
||||
status = IrdaStatusError;
|
||||
@@ -134,19 +150,13 @@ IrdaStatus irda_common_decode_manchester(IrdaCommonDecoder* decoder) {
|
||||
*switch_detect = 0;
|
||||
}
|
||||
|
||||
--decoder->timings_cnt;
|
||||
shift_left_array(decoder->timings, decoder->timings_cnt, 1);
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
|
||||
status = IrdaStatusOk;
|
||||
bool level = (decoder->level + decoder->timings_cnt) % 2;
|
||||
|
||||
if (decoder->databit_cnt < decoder->protocol->databit_len) {
|
||||
if (*switch_detect) {
|
||||
uint8_t index = decoder->databit_cnt / 8;
|
||||
uint8_t shift = decoder->databit_cnt % 8; // LSB first
|
||||
if (!shift)
|
||||
decoder->data[index] = 0;
|
||||
decoder->data[index] |= (level << shift);
|
||||
++decoder->databit_cnt;
|
||||
accumulate_lsb(decoder, level);
|
||||
}
|
||||
if (decoder->databit_cnt == decoder->protocol->databit_len) {
|
||||
if (level) {
|
||||
@@ -169,6 +179,46 @@ IrdaStatus irda_common_decode_manchester(IrdaCommonDecoder* decoder) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Pulse Width Modulation */
|
||||
IrdaStatus irda_common_decode_pwm(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
|
||||
uint32_t* timings = decoder->timings;
|
||||
IrdaStatus status = IrdaStatusOk;
|
||||
uint32_t bit_tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
uint16_t bit1_mark = decoder->protocol->timings.bit1_mark;
|
||||
uint16_t bit1_space = decoder->protocol->timings.bit1_space;
|
||||
uint16_t bit0_mark = decoder->protocol->timings.bit0_mark;
|
||||
|
||||
while (decoder->timings_cnt) {
|
||||
bool level = (decoder->level + decoder->timings_cnt + 1) % 2;
|
||||
|
||||
if (level) {
|
||||
if (MATCH_TIMING(timings[0], bit1_mark, bit_tolerance)) {
|
||||
accumulate_lsb(decoder, 1);
|
||||
} else if (MATCH_TIMING(timings[0], bit0_mark, bit_tolerance)) {
|
||||
accumulate_lsb(decoder, 0);
|
||||
} else {
|
||||
status = IrdaStatusError;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!MATCH_TIMING(timings[0], bit1_space, bit_tolerance)) {
|
||||
status = IrdaStatusError;
|
||||
break;
|
||||
}
|
||||
}
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
|
||||
|
||||
if (decoder->databit_cnt == decoder->protocol->databit_len) {
|
||||
status = IrdaStatusReady;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
IrdaMessage* irda_common_decode(IrdaCommonDecoder* decoder, bool level, uint32_t duration) {
|
||||
furi_assert(decoder);
|
||||
|
||||
@@ -176,7 +226,7 @@ IrdaMessage* irda_common_decode(IrdaCommonDecoder* decoder, bool level, uint32_t
|
||||
IrdaStatus status = IrdaStatusError;
|
||||
|
||||
if (decoder->level == level) {
|
||||
decoder->timings_cnt = 0;
|
||||
irda_common_decoder_reset(decoder);
|
||||
}
|
||||
decoder->level = level; // start with low level (Space timing)
|
||||
|
||||
@@ -242,32 +292,27 @@ void* irda_common_decoder_alloc(const IrdaCommonProtocolSpec* protocol) {
|
||||
return decoder;
|
||||
}
|
||||
|
||||
void irda_common_decoder_set_context(void* decoder, void* context) {
|
||||
IrdaCommonDecoder* common_decoder = decoder;
|
||||
common_decoder->context = context;
|
||||
}
|
||||
|
||||
void irda_common_decoder_free(void* decoder) {
|
||||
void irda_common_decoder_free(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
free(decoder);
|
||||
}
|
||||
|
||||
void irda_common_decoder_reset_state(IrdaCommonDecoder* common_decoder) {
|
||||
common_decoder->state = IrdaCommonDecoderStateWaitPreamble;
|
||||
common_decoder->databit_cnt = 0;
|
||||
common_decoder->switch_detect = false;
|
||||
common_decoder->message.protocol = IrdaProtocolUnknown;
|
||||
if ((common_decoder->protocol->timings.preamble_mark == 0) && (common_decoder->timings_cnt > 0)) {
|
||||
--common_decoder->timings_cnt;
|
||||
shift_left_array(common_decoder->timings, common_decoder->timings_cnt, 1);
|
||||
void irda_common_decoder_reset_state(IrdaCommonDecoder* decoder) {
|
||||
decoder->state = IrdaCommonDecoderStateWaitPreamble;
|
||||
decoder->databit_cnt = 0;
|
||||
decoder->switch_detect = false;
|
||||
decoder->message.protocol = IrdaProtocolUnknown;
|
||||
if (decoder->protocol->timings.preamble_mark == 0) {
|
||||
if (decoder->timings_cnt > 0) {
|
||||
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void irda_common_decoder_reset(void* decoder) {
|
||||
void irda_common_decoder_reset(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
IrdaCommonDecoder* common_decoder = decoder;
|
||||
|
||||
irda_common_decoder_reset_state(common_decoder);
|
||||
common_decoder->timings_cnt = 0;
|
||||
irda_common_decoder_reset_state(decoder);
|
||||
decoder->timings_cnt = 0;
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ IrdaStatus irda_common_encode_manchester(IrdaCommonEncoder* encoder, uint32_t* d
|
||||
if (even_timing) /* start encoding from space */
|
||||
++encoder->bits_encoded;
|
||||
++encoder->timings_encoded;
|
||||
encoder->timings_sum += *duration;
|
||||
|
||||
bool finish = (encoder->bits_encoded == encoder->protocol->databit_len);
|
||||
finish |= (encoder->bits_encoded == (encoder->protocol->databit_len-1)) && *level && !even_timing;
|
||||
@@ -46,6 +47,7 @@ IrdaStatus irda_common_encode_pdwm(IrdaCommonEncoder* encoder, uint32_t* duratio
|
||||
furi_assert(duration);
|
||||
furi_assert(level);
|
||||
|
||||
bool done = false;
|
||||
const IrdaTimings* timings = &encoder->protocol->timings;
|
||||
uint8_t index = encoder->bits_encoded / 8;
|
||||
uint8_t shift = encoder->bits_encoded % 8; // LSB first
|
||||
@@ -53,9 +55,11 @@ IrdaStatus irda_common_encode_pdwm(IrdaCommonEncoder* encoder, uint32_t* duratio
|
||||
|
||||
// stop bit
|
||||
if (encoder->bits_encoded == encoder->protocol->databit_len) {
|
||||
furi_assert(!encoder->protocol->no_stop_bit);
|
||||
*duration = timings->bit1_mark;
|
||||
*level = true;
|
||||
++encoder->timings_encoded;
|
||||
encoder->timings_sum += *duration;
|
||||
return IrdaStatusDone;
|
||||
}
|
||||
|
||||
@@ -68,8 +72,14 @@ IrdaStatus irda_common_encode_pdwm(IrdaCommonEncoder* encoder, uint32_t* duratio
|
||||
++encoder->bits_encoded;
|
||||
}
|
||||
|
||||
if ((encoder->bits_encoded == encoder->protocol->databit_len)
|
||||
&& encoder->protocol->no_stop_bit) {
|
||||
done = true;
|
||||
}
|
||||
|
||||
++encoder->timings_encoded;
|
||||
return IrdaStatusOk;
|
||||
encoder->timings_sum += *duration;
|
||||
return done ? IrdaStatusDone : IrdaStatusOk;
|
||||
}
|
||||
|
||||
IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
|
||||
@@ -80,12 +90,13 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
|
||||
const IrdaTimings* timings = &encoder->protocol->timings;
|
||||
|
||||
switch (encoder->state) {
|
||||
case IrdaCommonEncoderStateSpace:
|
||||
case IrdaCommonEncoderStateSilence:
|
||||
*duration = encoder->protocol->timings.silence_time;
|
||||
*level = false;
|
||||
status = IrdaStatusOk;
|
||||
encoder->state = IrdaCommonEncoderStatePreamble;
|
||||
++encoder->timings_encoded;
|
||||
encoder->timings_sum = 0;
|
||||
break;
|
||||
case IrdaCommonEncoderStatePreamble:
|
||||
if (timings->preamble_mark) {
|
||||
@@ -98,6 +109,7 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
|
||||
encoder->state = IrdaCommonEncoderStateEncode;
|
||||
}
|
||||
++encoder->timings_encoded;
|
||||
encoder->timings_sum += *duration;
|
||||
break;
|
||||
} else {
|
||||
encoder->state = IrdaCommonEncoderStateEncode;
|
||||
@@ -110,9 +122,10 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
|
||||
encoder->state = IrdaCommonEncoderStateEncodeRepeat;
|
||||
} else {
|
||||
encoder->timings_encoded = 0;
|
||||
encoder->timings_sum = 0;
|
||||
encoder->bits_encoded = 0;
|
||||
encoder->switch_detect = 0;
|
||||
encoder->state = IrdaCommonEncoderStateSpace;
|
||||
encoder->state = IrdaCommonEncoderStateSilence;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -144,8 +157,9 @@ void irda_common_encoder_free(IrdaCommonEncoder* encoder) {
|
||||
void irda_common_encoder_reset(IrdaCommonEncoder* encoder) {
|
||||
furi_assert(encoder);
|
||||
encoder->timings_encoded = 0;
|
||||
encoder->timings_sum = 0;
|
||||
encoder->bits_encoded = 0;
|
||||
encoder->state = IrdaCommonEncoderStateSpace;
|
||||
encoder->state = IrdaCommonEncoderStateSilence;
|
||||
encoder->switch_detect = 0;
|
||||
|
||||
uint8_t bytes_to_clear = encoder->protocol->databit_len / 8
|
||||
@@ -153,8 +167,3 @@ void irda_common_encoder_reset(IrdaCommonEncoder* encoder) {
|
||||
memset(encoder->data, 0, bytes_to_clear);
|
||||
}
|
||||
|
||||
void irda_common_encoder_set_context(void* decoder, void* context) {
|
||||
IrdaCommonEncoder* common_encoder = decoder;
|
||||
common_encoder->context = context;
|
||||
}
|
||||
|
||||
|
@@ -5,11 +5,8 @@
|
||||
#include "irda_i.h"
|
||||
|
||||
|
||||
#define MATCH_BIT_TIMING(x, v, delta) ( ((x) < (v + delta)) \
|
||||
&& ((x) > (v - delta)))
|
||||
|
||||
#define MATCH_PREAMBLE_TIMING(x, v, delta) ( ((x) < ((v) * (1 + (delta)))) \
|
||||
&& ((x) > ((v) * (1 - (delta)))))
|
||||
#define MATCH_TIMING(x, v, delta) ( ((x) < (v + delta)) \
|
||||
&& ((x) > (v - delta)))
|
||||
|
||||
typedef struct IrdaCommonDecoder IrdaCommonDecoder;
|
||||
typedef struct IrdaCommonEncoder IrdaCommonEncoder;
|
||||
@@ -21,6 +18,7 @@ typedef IrdaStatus (*IrdaCommonEncode)(IrdaCommonEncoder* encoder, uint32_t* out
|
||||
typedef struct {
|
||||
IrdaTimings timings;
|
||||
bool manchester_start_from_space;
|
||||
bool no_stop_bit;
|
||||
uint32_t databit_len;
|
||||
IrdaCommonDecode decode;
|
||||
IrdaCommonDecode decode_repeat;
|
||||
@@ -36,7 +34,7 @@ typedef enum {
|
||||
} IrdaCommonStateDecoder;
|
||||
|
||||
typedef enum {
|
||||
IrdaCommonEncoderStateSpace,
|
||||
IrdaCommonEncoderStateSilence,
|
||||
IrdaCommonEncoderStatePreamble,
|
||||
IrdaCommonEncoderStateEncode,
|
||||
IrdaCommonEncoderStateEncodeRepeat,
|
||||
@@ -44,13 +42,13 @@ typedef enum {
|
||||
|
||||
struct IrdaCommonDecoder {
|
||||
const IrdaCommonProtocolSpec* protocol;
|
||||
IrdaCommonStateDecoder state;
|
||||
IrdaMessage message;
|
||||
uint32_t timings[6];
|
||||
uint8_t timings_cnt;
|
||||
void* context;
|
||||
uint32_t timings[6];
|
||||
IrdaMessage message;
|
||||
IrdaCommonStateDecoder state;
|
||||
uint8_t timings_cnt;
|
||||
bool switch_detect;
|
||||
uint32_t level;
|
||||
bool level;
|
||||
uint16_t databit_cnt;
|
||||
uint8_t data[];
|
||||
};
|
||||
@@ -60,30 +58,23 @@ struct IrdaCommonEncoder {
|
||||
IrdaCommonStateEncoder state;
|
||||
bool switch_detect;
|
||||
uint32_t bits_encoded;
|
||||
uint32_t timings_sum;
|
||||
uint32_t timings_encoded;
|
||||
void* context;
|
||||
uint8_t data[];
|
||||
};
|
||||
|
||||
|
||||
static inline void shift_left_array(uint32_t *array, uint32_t len, uint32_t shift) {
|
||||
for (int i = 0; i < len; ++i)
|
||||
array[i] = array[i + shift];
|
||||
}
|
||||
|
||||
|
||||
IrdaMessage* irda_common_decode(IrdaCommonDecoder *decoder, bool level, uint32_t duration);
|
||||
IrdaStatus irda_common_decode_pdwm(IrdaCommonDecoder* decoder);
|
||||
IrdaStatus irda_common_decode_pdm(IrdaCommonDecoder* decoder);
|
||||
IrdaStatus irda_common_decode_pwm(IrdaCommonDecoder* decoder);
|
||||
IrdaStatus irda_common_decode_manchester(IrdaCommonDecoder* decoder);
|
||||
void irda_common_decoder_set_context(void* decoder, void* context);
|
||||
void* irda_common_decoder_alloc(const IrdaCommonProtocolSpec *protocol);
|
||||
void irda_common_decoder_free(void* decoder);
|
||||
void irda_common_decoder_reset(void* decoder);
|
||||
void irda_common_decoder_free(IrdaCommonDecoder* decoder);
|
||||
void irda_common_decoder_reset(IrdaCommonDecoder* decoder);
|
||||
|
||||
IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bool* polarity);
|
||||
IrdaStatus irda_common_encode_pdwm(IrdaCommonEncoder* encoder, uint32_t* duration, bool* polarity);
|
||||
IrdaStatus irda_common_encode_manchester(IrdaCommonEncoder* encoder, uint32_t* duration, bool* polarity);
|
||||
void irda_common_encoder_set_context(void* decoder, void* context);
|
||||
void* irda_common_encoder_alloc(const IrdaCommonProtocolSpec* protocol);
|
||||
void irda_common_encoder_free(IrdaCommonEncoder* encoder);
|
||||
void irda_common_encoder_reset(IrdaCommonEncoder* encoder);
|
||||
|
@@ -3,8 +3,8 @@
|
||||
|
||||
const IrdaCommonProtocolSpec protocol_nec = {
|
||||
.timings = {
|
||||
.preamble_mark = IRDA_NEC_PREAMBULE_MARK,
|
||||
.preamble_space = IRDA_NEC_PREAMBULE_SPACE,
|
||||
.preamble_mark = IRDA_NEC_PREAMBLE_MARK,
|
||||
.preamble_space = IRDA_NEC_PREAMBLE_SPACE,
|
||||
.bit1_mark = IRDA_NEC_BIT1_MARK,
|
||||
.bit1_space = IRDA_NEC_BIT1_SPACE,
|
||||
.bit0_mark = IRDA_NEC_BIT0_MARK,
|
||||
@@ -14,7 +14,8 @@ const IrdaCommonProtocolSpec protocol_nec = {
|
||||
.silence_time = IRDA_NEC_SILENCE,
|
||||
},
|
||||
.databit_len = 32,
|
||||
.decode = irda_common_decode_pdwm,
|
||||
.no_stop_bit = false,
|
||||
.decode = irda_common_decode_pdm,
|
||||
.encode = irda_common_encode_pdwm,
|
||||
.interpret = irda_decoder_nec_interpret,
|
||||
.decode_repeat = irda_decoder_nec_decode_repeat,
|
||||
@@ -23,8 +24,8 @@ const IrdaCommonProtocolSpec protocol_nec = {
|
||||
|
||||
const IrdaCommonProtocolSpec protocol_samsung32 = {
|
||||
.timings = {
|
||||
.preamble_mark = IRDA_SAMSUNG_PREAMBULE_MARK,
|
||||
.preamble_space = IRDA_SAMSUNG_PREAMBULE_SPACE,
|
||||
.preamble_mark = IRDA_SAMSUNG_PREAMBLE_MARK,
|
||||
.preamble_space = IRDA_SAMSUNG_PREAMBLE_SPACE,
|
||||
.bit1_mark = IRDA_SAMSUNG_BIT1_MARK,
|
||||
.bit1_space = IRDA_SAMSUNG_BIT1_SPACE,
|
||||
.bit0_mark = IRDA_SAMSUNG_BIT0_MARK,
|
||||
@@ -34,7 +35,8 @@ const IrdaCommonProtocolSpec protocol_samsung32 = {
|
||||
.silence_time = IRDA_SAMSUNG_SILENCE,
|
||||
},
|
||||
.databit_len = 32,
|
||||
.decode = irda_common_decode_pdwm,
|
||||
.no_stop_bit = false,
|
||||
.decode = irda_common_decode_pdm,
|
||||
.encode = irda_common_encode_pdwm,
|
||||
.interpret = irda_decoder_samsung32_interpret,
|
||||
.decode_repeat = irda_decoder_samsung32_decode_repeat,
|
||||
@@ -43,8 +45,8 @@ const IrdaCommonProtocolSpec protocol_samsung32 = {
|
||||
|
||||
const IrdaCommonProtocolSpec protocol_rc6 = {
|
||||
.timings = {
|
||||
.preamble_mark = IRDA_RC6_PREAMBULE_MARK,
|
||||
.preamble_space = IRDA_RC6_PREAMBULE_SPACE,
|
||||
.preamble_mark = IRDA_RC6_PREAMBLE_MARK,
|
||||
.preamble_space = IRDA_RC6_PREAMBLE_SPACE,
|
||||
.bit1_mark = IRDA_RC6_BIT,
|
||||
.preamble_tolerance = IRDA_RC6_PREAMBLE_TOLERANCE,
|
||||
.bit_tolerance = IRDA_RC6_BIT_TOLERANCE,
|
||||
@@ -77,3 +79,24 @@ const IrdaCommonProtocolSpec protocol_rc5 = {
|
||||
.encode_repeat = NULL,
|
||||
};
|
||||
|
||||
const IrdaCommonProtocolSpec protocol_sirc = {
|
||||
.timings = {
|
||||
.preamble_mark = IRDA_SIRC_PREAMBLE_MARK,
|
||||
.preamble_space = IRDA_SIRC_PREAMBLE_SPACE,
|
||||
.bit1_mark = IRDA_SIRC_BIT1_MARK,
|
||||
.bit1_space = IRDA_SIRC_BIT1_SPACE,
|
||||
.bit0_mark = IRDA_SIRC_BIT0_MARK,
|
||||
.bit0_space = IRDA_SIRC_BIT0_SPACE,
|
||||
.preamble_tolerance = IRDA_SIRC_PREAMBLE_TOLERANCE,
|
||||
.bit_tolerance = IRDA_SIRC_BIT_TOLERANCE,
|
||||
.silence_time = IRDA_SIRC_SILENCE,
|
||||
},
|
||||
.databit_len = 20, /* 12/15/20 */
|
||||
.no_stop_bit = true,
|
||||
.decode = irda_common_decode_pwm,
|
||||
.encode = irda_common_encode_pdwm,
|
||||
.interpret = irda_decoder_sirc_interpret,
|
||||
.decode_repeat = NULL,
|
||||
.encode_repeat = irda_encoder_sirc_encode_repeat,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user