Naming and coding style convention, new linter tool. (#945)

* Makefile, Scripts: new linter
* About: remove ID from IC
* Firmware: remove double define for DIVC/DIVR
* Scripts: check folder names too. Docker: replace syntax check with make lint.
* Reformat Sources and Migrate to new file naming convention
* Docker: symlink clang-format-12 to clang-format
* Add coding style guide
This commit is contained in:
あく
2022-01-05 19:10:18 +03:00
committed by GitHub
parent c98e54da10
commit 389ff92cc1
899 changed files with 379245 additions and 373421 deletions

View File

@@ -12,23 +12,21 @@ 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];
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
uint8_t shift = decoder->databit_cnt % 8; // LSB first
if (!shift)
decoder->data[index] = 0;
if(!shift) decoder->data[index] = 0;
if (bit) {
decoder->data[index] |= (0x1 << shift); // add 1
if(bit) {
decoder->data[index] |= (0x1 << shift); // add 1
} else {
(void) decoder->data[index]; // add 0
(void)decoder->data[index]; // add 0
}
++decoder->databit_cnt;
@@ -40,25 +38,24 @@ static bool irda_check_preamble(IrdaCommonDecoder* decoder) {
bool result = false;
bool start_level = (decoder->level + decoder->timings_cnt + 1) % 2;
if (decoder->timings_cnt == 0)
return false;
if(decoder->timings_cnt == 0) return false;
// align to start at Mark timing
if (!start_level) {
if(!start_level) {
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
}
if (decoder->protocol->timings.preamble_mark == 0) {
if(decoder->protocol->timings.preamble_mark == 0) {
return true;
}
while ((!result) && (decoder->timings_cnt >= 2)) {
while((!result) && (decoder->timings_cnt >= 2)) {
float preamble_tolerance = decoder->protocol->timings.preamble_tolerance;
uint16_t preamble_mark = decoder->protocol->timings.preamble_mark;
uint16_t preamble_space = decoder->protocol->timings.preamble_space;
if ((MATCH_TIMING(decoder->timings[0], preamble_mark, preamble_tolerance))
&& (MATCH_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;
}
@@ -68,7 +65,6 @@ static bool irda_check_preamble(IrdaCommonDecoder* decoder) {
return result;
}
/**
* decoder->protocol->databit_len[0] contains biggest amount of bits, for this protocol.
* decoder->protocol->databit_len[1...] contains lesser values, but which can be decoded
@@ -80,19 +76,21 @@ static IrdaStatus irda_common_decode_bits(IrdaCommonDecoder* decoder) {
IrdaStatus status = IrdaStatusOk;
const IrdaTimings* timings = &decoder->protocol->timings;
while (decoder->timings_cnt && (status == IrdaStatusOk)) {
while(decoder->timings_cnt && (status == IrdaStatusOk)) {
bool level = (decoder->level + decoder->timings_cnt + 1) % 2;
uint32_t timing = decoder->timings[0];
if (timings->min_split_time && !level) {
if (timing > timings->min_split_time) {
if(timings->min_split_time && !level) {
if(timing > timings->min_split_time) {
/* long low timing - check if we're ready for any of protocol modification */
for (int i = 0; decoder->protocol->databit_len[i] && (i < COUNT_OF(decoder->protocol->databit_len)); ++i) {
if (decoder->protocol->databit_len[i] == decoder->databit_cnt) {
for(int i = 0; decoder->protocol->databit_len[i] &&
(i < COUNT_OF(decoder->protocol->databit_len));
++i) {
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
return IrdaStatusReady;
}
}
} else if (decoder->protocol->databit_len[0] == decoder->databit_cnt) {
} else if(decoder->protocol->databit_len[0] == decoder->databit_cnt) {
/* short low timing for longest protocol - this is signal is longer than we expected */
return IrdaStatusError;
}
@@ -101,13 +99,14 @@ static IrdaStatus irda_common_decode_bits(IrdaCommonDecoder* decoder) {
status = decoder->protocol->decode(decoder, level, timing);
furi_check(decoder->databit_cnt <= decoder->protocol->databit_len[0]);
furi_assert(status == IrdaStatusError || status == IrdaStatusOk);
if (status == IrdaStatusError) {
if(status == IrdaStatusError) {
break;
}
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
/* check if largest protocol version can be decoded */
if (level && (decoder->protocol->databit_len[0] == decoder->databit_cnt) && !timings->min_split_time) {
if(level && (decoder->protocol->databit_len[0] == decoder->databit_cnt) &&
!timings->min_split_time) {
status = IrdaStatusReady;
break;
}
@@ -132,16 +131,16 @@ IrdaStatus irda_common_decode_pdwm(IrdaCommonDecoder* decoder, bool level, uint3
uint16_t bit0 = level ? bit0_mark : bit0_space;
uint16_t no_info_timing = (bit1_mark == bit0_mark) ? bit1_mark : bit1_space;
if (analyze_timing) {
if (MATCH_TIMING(timing, bit1, bit_tolerance)) {
if(analyze_timing) {
if(MATCH_TIMING(timing, bit1, bit_tolerance)) {
accumulate_lsb(decoder, 1);
} else if (MATCH_TIMING(timing, bit0, bit_tolerance)) {
} else if(MATCH_TIMING(timing, bit0, bit_tolerance)) {
accumulate_lsb(decoder, 0);
} else {
status = IrdaStatusError;
}
} else {
if (!MATCH_TIMING(timing, no_info_timing, bit_tolerance)) {
if(!MATCH_TIMING(timing, no_info_timing, bit_tolerance)) {
status = IrdaStatusError;
}
}
@@ -159,31 +158,30 @@ IrdaStatus irda_common_decode_manchester(IrdaCommonDecoder* decoder, bool level,
furi_assert((*switch_detect == true) || (*switch_detect == false));
bool single_timing = MATCH_TIMING(timing, bit, tolerance);
bool double_timing = MATCH_TIMING(timing, 2*bit, tolerance);
bool double_timing = MATCH_TIMING(timing, 2 * bit, tolerance);
if(!single_timing && !double_timing) {
return IrdaStatusError;
}
if (decoder->protocol->manchester_start_from_space && (decoder->databit_cnt == 0)) {
if(decoder->protocol->manchester_start_from_space && (decoder->databit_cnt == 0)) {
*switch_detect = 1; /* fake as we were previously in the middle of time-quant */
accumulate_lsb(decoder, 0);
}
if (*switch_detect == 0) {
if (double_timing) {
if(*switch_detect == 0) {
if(double_timing) {
return IrdaStatusError;
}
/* only single timing - level switch required in the middle of time-quant */
*switch_detect = 1;
} else {
/* double timing means we're in the middle of time-quant again */
if (single_timing)
*switch_detect = 0;
if(single_timing) *switch_detect = 0;
}
if (*switch_detect) {
if (decoder->protocol->databit_len[0] == decoder->databit_cnt) {
if(*switch_detect) {
if(decoder->protocol->databit_len[0] == decoder->databit_cnt) {
return IrdaStatusError;
}
accumulate_lsb(decoder, level);
@@ -196,17 +194,19 @@ IrdaMessage* irda_common_decoder_check_ready(IrdaCommonDecoder* decoder) {
IrdaMessage* message = NULL;
bool found_length = false;
for (int i = 0; decoder->protocol->databit_len[i] && (i < COUNT_OF(decoder->protocol->databit_len)); ++i) {
if (decoder->protocol->databit_len[i] == decoder->databit_cnt) {
for(int i = 0;
decoder->protocol->databit_len[i] && (i < COUNT_OF(decoder->protocol->databit_len));
++i) {
if(decoder->protocol->databit_len[i] == decoder->databit_cnt) {
found_length = true;
break;
}
}
if (found_length && decoder->protocol->interpret(decoder)) {
if(found_length && decoder->protocol->interpret(decoder)) {
decoder->databit_cnt = 0;
message = &decoder->message;
if (decoder->protocol->decode_repeat) {
if(decoder->protocol->decode_repeat) {
decoder->state = IrdaCommonDecoderStateProcessRepeat;
} else {
decoder->state = IrdaCommonDecoderStateWaitPreamble;
@@ -222,19 +222,19 @@ IrdaMessage* irda_common_decode(IrdaCommonDecoder* decoder, bool level, uint32_t
IrdaMessage* message = 0;
IrdaStatus status = IrdaStatusError;
if (decoder->level == level) {
if(decoder->level == level) {
irda_common_decoder_reset(decoder);
}
decoder->level = level; // start with low level (Space timing)
decoder->level = level; // start with low level (Space timing)
decoder->timings[decoder->timings_cnt] = duration;
decoder->timings_cnt++;
furi_check(decoder->timings_cnt <= sizeof(decoder->timings));
while(1) {
switch (decoder->state) {
switch(decoder->state) {
case IrdaCommonDecoderStateWaitPreamble:
if (irda_check_preamble(decoder)) {
if(irda_check_preamble(decoder)) {
decoder->state = IrdaCommonDecoderStateDecode;
decoder->databit_cnt = 0;
decoder->switch_detect = false;
@@ -243,25 +243,25 @@ IrdaMessage* irda_common_decode(IrdaCommonDecoder* decoder, bool level, uint32_t
break;
case IrdaCommonDecoderStateDecode:
status = irda_common_decode_bits(decoder);
if (status == IrdaStatusReady) {
if(status == IrdaStatusReady) {
message = irda_common_decoder_check_ready(decoder);
if (message) {
if(message) {
continue;
} else if (decoder->protocol->databit_len[0] == decoder->databit_cnt) {
} else if(decoder->protocol->databit_len[0] == decoder->databit_cnt) {
/* error: can't decode largest protocol - begin decoding from start */
decoder->state = IrdaCommonDecoderStateWaitPreamble;
}
} else if (status == IrdaStatusError) {
} else if(status == IrdaStatusError) {
irda_common_decoder_reset_state(decoder);
continue;
}
break;
case IrdaCommonDecoderStateProcessRepeat:
status = decoder->protocol->decode_repeat(decoder);
if (status == IrdaStatusError) {
if(status == IrdaStatusError) {
irda_common_decoder_reset_state(decoder);
continue;
} else if (status == IrdaStatusReady) {
} else if(status == IrdaStatusReady) {
decoder->message.repeat = true;
message = &decoder->message;
}
@@ -277,13 +277,12 @@ void* irda_common_decoder_alloc(const IrdaCommonProtocolSpec* protocol) {
furi_assert(protocol);
/* protocol->databit_len[0] has to contain biggest value of bits that can be decoded */
for (int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
for(int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
furi_assert(protocol->databit_len[i] <= protocol->databit_len[0]);
}
uint32_t alloc_size = sizeof(IrdaCommonDecoder)
+ protocol->databit_len[0] / 8
+ !!(protocol->databit_len[0] % 8);
uint32_t alloc_size = sizeof(IrdaCommonDecoder) + protocol->databit_len[0] / 8 +
!!(protocol->databit_len[0] % 8);
IrdaCommonDecoder* decoder = furi_alloc(alloc_size);
decoder->protocol = protocol;
decoder->level = true;
@@ -300,8 +299,8 @@ void irda_common_decoder_reset_state(IrdaCommonDecoder* decoder) {
decoder->databit_cnt = 0;
decoder->switch_detect = false;
decoder->message.protocol = IrdaProtocolUnknown;
if (decoder->protocol->timings.preamble_mark == 0) {
if (decoder->timings_cnt > 0) {
if(decoder->protocol->timings.preamble_mark == 0) {
if(decoder->timings_cnt > 0) {
decoder->timings_cnt = consume_samples(decoder->timings, decoder->timings_cnt, 1);
}
}
@@ -313,4 +312,3 @@ void irda_common_decoder_reset(IrdaCommonDecoder* decoder) {
irda_common_decoder_reset_state(decoder);
decoder->timings_cnt = 0;
}

View File

@@ -6,12 +6,13 @@
#include "irda_i.h"
#include <stdint.h>
static IrdaStatus irda_common_encode_bits(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
static IrdaStatus
irda_common_encode_bits(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
IrdaStatus status = encoder->protocol->encode(encoder, duration, level);
furi_assert(status == IrdaStatusOk);
++encoder->timings_encoded;
encoder->timings_sum += *duration;
if ((encoder->bits_encoded == encoder->bits_to_encode) && *level) {
if((encoder->bits_encoded == encoder->bits_to_encode) && *level) {
status = IrdaStatusDone;
}
@@ -32,23 +33,24 @@ static IrdaStatus irda_common_encode_bits(IrdaCommonEncoder* encoder, uint32_t*
* 0 1 2 | 3 4 |
* _____-------_____---___
*/
IrdaStatus irda_common_encode_manchester(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
IrdaStatus
irda_common_encode_manchester(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
furi_assert(encoder);
furi_assert(duration);
furi_assert(level);
const IrdaTimings* timings = &encoder->protocol->timings;
uint8_t index = encoder->bits_encoded / 8;
uint8_t shift = encoder->bits_encoded % 8; // LSB first
uint8_t shift = encoder->bits_encoded % 8; // LSB first
bool logic_value = !!(encoder->data[index] & (0x01 << shift));
bool even_timing = !(encoder->timings_encoded % 2);
*level = even_timing ^ logic_value;
*duration = timings->bit1_mark;
if (even_timing)
if(even_timing)
++encoder->bits_encoded;
else if (*level && (encoder->bits_encoded + 1 == encoder->bits_to_encode))
++encoder->bits_encoded; /* don't encode last space */
else if(*level && (encoder->bits_encoded + 1 == encoder->bits_to_encode))
++encoder->bits_encoded; /* don't encode last space */
return IrdaStatusOk;
}
@@ -60,20 +62,18 @@ IrdaStatus irda_common_encode_pdwm(IrdaCommonEncoder* encoder, uint32_t* duratio
const IrdaTimings* timings = &encoder->protocol->timings;
uint8_t index = encoder->bits_encoded / 8;
uint8_t shift = encoder->bits_encoded % 8; // LSB first
uint8_t shift = encoder->bits_encoded % 8; // LSB first
bool logic_value = !!(encoder->data[index] & (0x01 << shift));
bool pwm = timings->bit1_space == timings->bit0_space;
if (encoder->timings_encoded % 2) { /* start encoding from space */
if(encoder->timings_encoded % 2) { /* start encoding from space */
*duration = logic_value ? timings->bit1_mark : timings->bit0_mark;
*level = true;
if (pwm)
++encoder->bits_encoded;
if(pwm) ++encoder->bits_encoded;
} else {
*duration = logic_value ? timings->bit1_space : timings->bit0_space;
*level = false;
if (!pwm)
++encoder->bits_encoded;
if(!pwm) ++encoder->bits_encoded;
}
return IrdaStatusOk;
@@ -86,7 +86,7 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
IrdaStatus status = IrdaStatusOk;
const IrdaTimings* timings = &encoder->protocol->timings;
switch (encoder->state) {
switch(encoder->state) {
case IrdaCommonEncoderStateSilence:
*duration = encoder->protocol->timings.silence_time;
*level = false;
@@ -96,8 +96,8 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
encoder->timings_sum = 0;
break;
case IrdaCommonEncoderStatePreamble:
if (timings->preamble_mark) {
if (encoder->timings_encoded == 1) {
if(timings->preamble_mark) {
if(encoder->timings_encoded == 1) {
*duration = timings->preamble_mark;
*level = true;
} else {
@@ -114,8 +114,8 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
/* FALLTHROUGH */
case IrdaCommonEncoderStateEncode:
status = irda_common_encode_bits(encoder, duration, level);
if (status == IrdaStatusDone) {
if (encoder->protocol->encode_repeat) {
if(status == IrdaStatusDone) {
if(encoder->protocol->encode_repeat) {
encoder->state = IrdaCommonEncoderStateEncodeRepeat;
} else {
encoder->timings_encoded = 0;
@@ -135,18 +135,19 @@ IrdaStatus irda_common_encode(IrdaCommonEncoder* encoder, uint32_t* duration, bo
void* irda_common_encoder_alloc(const IrdaCommonProtocolSpec* protocol) {
furi_assert(protocol);
if (protocol->decode == irda_common_decode_pdwm) {
furi_assert((protocol->timings.bit1_mark == protocol->timings.bit0_mark) ^ (protocol->timings.bit1_space == protocol->timings.bit0_space));
if(protocol->decode == irda_common_decode_pdwm) {
furi_assert(
(protocol->timings.bit1_mark == protocol->timings.bit0_mark) ^
(protocol->timings.bit1_space == protocol->timings.bit0_space));
}
/* protocol->databit_len[0] has to contain biggest value of bits that can be decoded */
for (int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
for(int i = 1; i < COUNT_OF(protocol->databit_len); ++i) {
furi_assert(protocol->databit_len[i] <= protocol->databit_len[0]);
}
uint32_t alloc_size = sizeof(IrdaCommonDecoder)
+ protocol->databit_len[0] / 8
+ !!(protocol->databit_len[0] % 8);
uint32_t alloc_size = sizeof(IrdaCommonDecoder) + protocol->databit_len[0] / 8 +
!!(protocol->databit_len[0] % 8);
IrdaCommonEncoder* encoder = furi_alloc(alloc_size);
memset(encoder, 0, alloc_size);
encoder->protocol = protocol;
@@ -169,12 +170,10 @@ void irda_common_encoder_reset(IrdaCommonEncoder* encoder) {
uint8_t max_databit_len = 0;
for (int i = 0; i < COUNT_OF(encoder->protocol->databit_len); ++i) {
for(int i = 0; i < COUNT_OF(encoder->protocol->databit_len); ++i) {
max_databit_len = MAX(max_databit_len, encoder->protocol->databit_len[i]);
}
uint8_t bytes_to_clear = max_databit_len / 8
+ !!(max_databit_len % 8);
uint8_t bytes_to_clear = max_databit_len / 8 + !!(max_databit_len % 8);
memset(encoder->data, 0, bytes_to_clear);
}

View File

@@ -4,9 +4,7 @@
#include "irda.h"
#include "irda_i.h"
#define MATCH_TIMING(x, v, delta) ( ((x) < (v + delta)) \
&& ((x) > (v - delta)))
#define MATCH_TIMING(x, v, delta) (((x) < (v + delta)) && ((x) > (v - delta)))
typedef struct IrdaCommonDecoder IrdaCommonDecoder;
typedef struct IrdaCommonEncoder IrdaCommonEncoder;
@@ -18,9 +16,9 @@ typedef IrdaStatus (*IrdaCommonEncode)(IrdaCommonEncoder* encoder, uint32_t* out
typedef struct {
IrdaTimings timings;
bool manchester_start_from_space;
bool no_stop_bit;
uint8_t databit_len[4];
bool manchester_start_from_space;
bool no_stop_bit;
uint8_t databit_len[4];
IrdaCommonDecode decode;
IrdaCommonDecodeRepeat decode_repeat;
IrdaCommonInterpret interpret;
@@ -66,18 +64,18 @@ struct IrdaCommonEncoder {
uint8_t data[];
};
IrdaMessage* irda_common_decode(IrdaCommonDecoder *decoder, bool level, uint32_t duration);
IrdaMessage* irda_common_decode(IrdaCommonDecoder* decoder, bool level, uint32_t duration);
IrdaStatus irda_common_decode_pdwm(IrdaCommonDecoder* decoder, bool level, uint32_t timing);
IrdaStatus irda_common_decode_manchester(IrdaCommonDecoder* decoder, bool level, uint32_t timing);
void* irda_common_decoder_alloc(const IrdaCommonProtocolSpec *protocol);
void* irda_common_decoder_alloc(const IrdaCommonProtocolSpec* protocol);
void irda_common_decoder_free(IrdaCommonDecoder* decoder);
void irda_common_decoder_reset(IrdaCommonDecoder* decoder);
IrdaMessage* irda_common_decoder_check_ready(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);
IrdaStatus
irda_common_encode_manchester(IrdaCommonEncoder* encoder, uint32_t* duration, bool* polarity);
void* irda_common_encoder_alloc(const IrdaCommonProtocolSpec* protocol);
void irda_common_encoder_free(IrdaCommonEncoder* encoder);
void irda_common_encoder_reset(IrdaCommonEncoder* encoder);

View File

@@ -2,18 +2,19 @@
#include "irda_protocol_defs_i.h"
const IrdaCommonProtocolSpec protocol_nec = {
.timings = {
.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,
.bit0_space = IRDA_NEC_BIT0_SPACE,
.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,
},
.timings =
{
.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,
.bit0_space = IRDA_NEC_BIT0_SPACE,
.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[0] = 42,
.databit_len[1] = 32,
.no_stop_bit = false,
@@ -25,18 +26,19 @@ const IrdaCommonProtocolSpec protocol_nec = {
};
const IrdaCommonProtocolSpec protocol_samsung32 = {
.timings = {
.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,
.bit0_space = IRDA_SAMSUNG_BIT0_SPACE,
.preamble_tolerance = IRDA_SAMSUNG_PREAMBLE_TOLERANCE,
.bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
.silence_time = IRDA_SAMSUNG_SILENCE,
.min_split_time = IRDA_SAMSUNG_MIN_SPLIT_TIME,
},
.timings =
{
.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,
.bit0_space = IRDA_SAMSUNG_BIT0_SPACE,
.preamble_tolerance = IRDA_SAMSUNG_PREAMBLE_TOLERANCE,
.bit_tolerance = IRDA_SAMSUNG_BIT_TOLERANCE,
.silence_time = IRDA_SAMSUNG_SILENCE,
.min_split_time = IRDA_SAMSUNG_MIN_SPLIT_TIME,
},
.databit_len[0] = 32,
.no_stop_bit = false,
.decode = irda_common_decode_pdwm,
@@ -47,16 +49,19 @@ const IrdaCommonProtocolSpec protocol_samsung32 = {
};
const IrdaCommonProtocolSpec protocol_rc6 = {
.timings = {
.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,
.silence_time = IRDA_RC6_SILENCE,
.min_split_time = IRDA_RC6_MIN_SPLIT_TIME,
},
.databit_len[0] = 1 + 3 + 1 + 8 + 8, // start_bit + 3 mode bits, + 1 toggle bit (x2 timing) + 8 address + 8 command
.timings =
{
.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,
.silence_time = IRDA_RC6_SILENCE,
.min_split_time = IRDA_RC6_MIN_SPLIT_TIME,
},
.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,
@@ -66,16 +71,18 @@ const IrdaCommonProtocolSpec protocol_rc6 = {
};
const IrdaCommonProtocolSpec protocol_rc5 = {
.timings = {
.preamble_mark = 0,
.preamble_space = 0,
.bit1_mark = IRDA_RC5_BIT,
.preamble_tolerance = 0,
.bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
.silence_time = IRDA_RC5_SILENCE,
.min_split_time = IRDA_RC5_MIN_SPLIT_TIME,
},
.databit_len[0] = 1 + 1 + 1 + 5 + 6, // start_bit + start_bit/command_bit + toggle_bit + 5 address + 6 command
.timings =
{
.preamble_mark = 0,
.preamble_space = 0,
.bit1_mark = IRDA_RC5_BIT,
.preamble_tolerance = 0,
.bit_tolerance = IRDA_RC5_BIT_TOLERANCE,
.silence_time = IRDA_RC5_SILENCE,
.min_split_time = IRDA_RC5_MIN_SPLIT_TIME,
},
.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,
@@ -85,18 +92,19 @@ const IrdaCommonProtocolSpec protocol_rc5 = {
};
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,
.min_split_time = IRDA_SIRC_MIN_SPLIT_TIME,
},
.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,
.min_split_time = IRDA_SIRC_MIN_SPLIT_TIME,
},
.databit_len[0] = 20,
.databit_len[1] = 15,
.databit_len[2] = 12,
@@ -107,4 +115,3 @@ const IrdaCommonProtocolSpec protocol_sirc = {
.decode_repeat = NULL,
.encode_repeat = irda_encoder_sirc_encode_repeat,
};