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

@@ -5,7 +5,6 @@
#include <furi.h>
#include "../irda_i.h"
IrdaMessage* irda_decoder_samsung32_check_ready(void* ctx) {
return irda_common_decoder_check_ready(ctx);
}
@@ -19,7 +18,7 @@ bool irda_decoder_samsung32_interpret(IrdaCommonDecoder* decoder) {
uint8_t command = decoder->data[2];
uint8_t command_inverse = decoder->data[3];
if ((address1 == address2) && (command == (uint8_t) ~command_inverse)) {
if((address1 == address2) && (command == (uint8_t)~command_inverse)) {
decoder->message.command = command;
decoder->message.address = address1;
decoder->message.protocol = IrdaProtocolSamsung32;
@@ -38,17 +37,15 @@ IrdaStatus irda_decoder_samsung32_decode_repeat(IrdaCommonDecoder* decoder) {
uint32_t bit_tolerance = decoder->protocol->timings.bit_tolerance;
IrdaStatus status = IrdaStatusError;
if (decoder->timings_cnt < 6)
return IrdaStatusOk;
if(decoder->timings_cnt < 6) return IrdaStatusOk;
if ((decoder->timings[0] > IRDA_SAMSUNG_REPEAT_PAUSE_MIN)
&& (decoder->timings[0] < IRDA_SAMSUNG_REPEAT_PAUSE_MAX)
&& MATCH_TIMING(decoder->timings[1], IRDA_SAMSUNG_REPEAT_MARK, preamble_tolerance)
&& MATCH_TIMING(decoder->timings[2], IRDA_SAMSUNG_REPEAT_SPACE, preamble_tolerance)
&& MATCH_TIMING(decoder->timings[3], decoder->protocol->timings.bit1_mark, bit_tolerance)
&& MATCH_TIMING(decoder->timings[4], decoder->protocol->timings.bit1_space, bit_tolerance)
&& MATCH_TIMING(decoder->timings[5], decoder->protocol->timings.bit1_mark, bit_tolerance)
) {
if((decoder->timings[0] > IRDA_SAMSUNG_REPEAT_PAUSE_MIN) &&
(decoder->timings[0] < IRDA_SAMSUNG_REPEAT_PAUSE_MAX) &&
MATCH_TIMING(decoder->timings[1], IRDA_SAMSUNG_REPEAT_MARK, preamble_tolerance) &&
MATCH_TIMING(decoder->timings[2], IRDA_SAMSUNG_REPEAT_SPACE, preamble_tolerance) &&
MATCH_TIMING(decoder->timings[3], decoder->protocol->timings.bit1_mark, bit_tolerance) &&
MATCH_TIMING(decoder->timings[4], decoder->protocol->timings.bit1_space, bit_tolerance) &&
MATCH_TIMING(decoder->timings[5], decoder->protocol->timings.bit1_mark, bit_tolerance)) {
status = IrdaStatusReady;
decoder->timings_cnt = 0;
} else {
@@ -73,4 +70,3 @@ void irda_decoder_samsung32_free(void* decoder) {
void irda_decoder_samsung32_reset(void* decoder) {
irda_common_decoder_reset(decoder);
}

View File

@@ -24,7 +24,7 @@ void irda_encoder_samsung32_reset(void* encoder_ptr, const IrdaMessage* message)
uint8_t command = message->command;
uint8_t command_inverse = ~command;
uint32_t* data = (void*) encoder->data;
uint32_t* data = (void*)encoder->data;
*data |= address;
*data |= address << 8;
*data |= command << 16;
@@ -33,7 +33,10 @@ void irda_encoder_samsung32_reset(void* encoder_ptr, const IrdaMessage* message)
encoder->bits_to_encode = encoder->protocol->databit_len[0];
}
IrdaStatus irda_encoder_samsung32_encode_repeat(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
IrdaStatus irda_encoder_samsung32_encode_repeat(
IrdaCommonEncoder* encoder,
uint32_t* duration,
bool* level) {
furi_assert(encoder);
/* space + 2 timings preambule + payload + stop bit */
@@ -42,7 +45,7 @@ IrdaStatus irda_encoder_samsung32_encode_repeat(IrdaCommonEncoder* encoder, uint
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_SAMSUNG_REPEAT_PAUSE1;
@@ -65,5 +68,3 @@ void irda_encoder_samsung32_free(void* encoder_ptr) {
IrdaStatus irda_encoder_samsung32_encode(void* encoder_ptr, uint32_t* duration, bool* level) {
return irda_common_encode(encoder_ptr, duration, level);
}

View File

@@ -2,17 +2,16 @@
#include "irda_protocol_defs_i.h"
static const IrdaProtocolSpecification irda_samsung32_protocol_specification = {
.name = "Samsung32",
.address_length = 8,
.command_length = 8,
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
.name = "Samsung32",
.address_length = 8,
.command_length = 8,
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
};
const IrdaProtocolSpecification* irda_samsung32_get_spec(IrdaProtocol protocol) {
if (protocol == IrdaProtocolSamsung32)
if(protocol == IrdaProtocolSamsung32)
return &irda_samsung32_protocol_specification;
else
return NULL;
}