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:
@@ -6,7 +6,6 @@
|
||||
#include <furi.h>
|
||||
#include "../irda_i.h"
|
||||
|
||||
|
||||
IrdaMessage* irda_decoder_sirc_check_ready(void* ctx) {
|
||||
return irda_common_decoder_check_ready(ctx);
|
||||
}
|
||||
@@ -14,21 +13,21 @@ IrdaMessage* irda_decoder_sirc_check_ready(void* ctx) {
|
||||
bool irda_decoder_sirc_interpret(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
|
||||
uint32_t* data = (void*) &decoder->data[0];
|
||||
uint32_t* data = (void*)&decoder->data[0];
|
||||
uint16_t address = 0;
|
||||
uint8_t command = 0;
|
||||
IrdaProtocol protocol = IrdaProtocolUnknown;
|
||||
|
||||
if (decoder->databit_cnt == 12) {
|
||||
address = (*data >> 7) & 0x1F;
|
||||
if(decoder->databit_cnt == 12) {
|
||||
address = (*data >> 7) & 0x1F;
|
||||
command = *data & 0x7F;
|
||||
protocol = IrdaProtocolSIRC;
|
||||
} else if (decoder->databit_cnt == 15) {
|
||||
address = (*data >> 7) & 0xFF;
|
||||
} else if(decoder->databit_cnt == 15) {
|
||||
address = (*data >> 7) & 0xFF;
|
||||
command = *data & 0x7F;
|
||||
protocol = IrdaProtocolSIRC15;
|
||||
} else if (decoder->databit_cnt == 20) {
|
||||
address = (*data >> 7) & 0x1FFF;
|
||||
} else if(decoder->databit_cnt == 20) {
|
||||
address = (*data >> 7) & 0x1FFF;
|
||||
command = *data & 0x7F;
|
||||
protocol = IrdaProtocolSIRC20;
|
||||
} else {
|
||||
@@ -59,4 +58,3 @@ void irda_decoder_sirc_free(void* decoder) {
|
||||
void irda_decoder_sirc_reset(void* decoder) {
|
||||
irda_common_decoder_reset(decoder);
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "irda_protocol_defs_i.h"
|
||||
#include <furi.h>
|
||||
|
||||
|
||||
void irda_encoder_sirc_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
furi_assert(encoder_ptr);
|
||||
furi_assert(message);
|
||||
@@ -14,17 +13,17 @@ void irda_encoder_sirc_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
IrdaCommonEncoder* encoder = encoder_ptr;
|
||||
irda_common_encoder_reset(encoder);
|
||||
|
||||
uint32_t* data = (void*) encoder->data;
|
||||
uint32_t* data = (void*)encoder->data;
|
||||
|
||||
if (message->protocol == IrdaProtocolSIRC) {
|
||||
if(message->protocol == IrdaProtocolSIRC) {
|
||||
*data = (message->command & 0x7F);
|
||||
*data |= (message->address & 0x1F) << 7;
|
||||
encoder->bits_to_encode = 12;
|
||||
} else if (message->protocol == IrdaProtocolSIRC15) {
|
||||
} else if(message->protocol == IrdaProtocolSIRC15) {
|
||||
*data = (message->command & 0x7F);
|
||||
*data |= (message->address & 0xFF) << 7;
|
||||
encoder->bits_to_encode = 15;
|
||||
} else if (message->protocol == IrdaProtocolSIRC20) {
|
||||
} else if(message->protocol == IrdaProtocolSIRC20) {
|
||||
*data = (message->command & 0x7F);
|
||||
*data |= (message->address & 0x1FFF) << 7;
|
||||
encoder->bits_to_encode = 20;
|
||||
@@ -33,7 +32,8 @@ void irda_encoder_sirc_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
}
|
||||
}
|
||||
|
||||
IrdaStatus irda_encoder_sirc_encode_repeat(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
|
||||
IrdaStatus
|
||||
irda_encoder_sirc_encode_repeat(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
|
||||
furi_assert(encoder);
|
||||
|
||||
furi_assert(encoder->timings_encoded == (1 + 2 + encoder->bits_to_encode * 2 - 1));
|
||||
@@ -62,11 +62,10 @@ IrdaStatus irda_encoder_sirc_encode(void* encoder_ptr, uint32_t* duration, bool*
|
||||
IrdaCommonEncoder* encoder = encoder_ptr;
|
||||
|
||||
IrdaStatus status = irda_common_encode(encoder, duration, level);
|
||||
if ((status == IrdaStatusOk) && (encoder->bits_encoded == encoder->bits_to_encode)) {
|
||||
if((status == IrdaStatusOk) && (encoder->bits_encoded == encoder->bits_to_encode)) {
|
||||
furi_assert(!*level);
|
||||
status = IrdaStatusDone;
|
||||
encoder->state = IrdaCommonEncoderStateEncodeRepeat;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@@ -2,37 +2,36 @@
|
||||
#include "irda_protocol_defs_i.h"
|
||||
|
||||
static const IrdaProtocolSpecification irda_sirc_protocol_specification = {
|
||||
.name = "SIRC",
|
||||
.address_length = 5,
|
||||
.command_length = 7,
|
||||
.frequency = IRDA_SIRC_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_SIRC_DUTY_CYCLE,
|
||||
.name = "SIRC",
|
||||
.address_length = 5,
|
||||
.command_length = 7,
|
||||
.frequency = IRDA_SIRC_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_SIRC_DUTY_CYCLE,
|
||||
};
|
||||
|
||||
static const IrdaProtocolSpecification irda_sirc15_protocol_specification = {
|
||||
.name = "SIRC15",
|
||||
.address_length = 8,
|
||||
.command_length = 7,
|
||||
.frequency = IRDA_SIRC_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_SIRC_DUTY_CYCLE,
|
||||
.name = "SIRC15",
|
||||
.address_length = 8,
|
||||
.command_length = 7,
|
||||
.frequency = IRDA_SIRC_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_SIRC_DUTY_CYCLE,
|
||||
};
|
||||
|
||||
static const IrdaProtocolSpecification irda_sirc20_protocol_specification = {
|
||||
.name = "SIRC20",
|
||||
.address_length = 13,
|
||||
.command_length = 7,
|
||||
.frequency = IRDA_SIRC_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_SIRC_DUTY_CYCLE,
|
||||
.name = "SIRC20",
|
||||
.address_length = 13,
|
||||
.command_length = 7,
|
||||
.frequency = IRDA_SIRC_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_SIRC_DUTY_CYCLE,
|
||||
};
|
||||
|
||||
const IrdaProtocolSpecification* irda_sirc_get_spec(IrdaProtocol protocol) {
|
||||
if (protocol == IrdaProtocolSIRC)
|
||||
if(protocol == IrdaProtocolSIRC)
|
||||
return &irda_sirc_protocol_specification;
|
||||
else if (protocol == IrdaProtocolSIRC15)
|
||||
else if(protocol == IrdaProtocolSIRC15)
|
||||
return &irda_sirc15_protocol_specification;
|
||||
else if (protocol == IrdaProtocolSIRC20)
|
||||
else if(protocol == IrdaProtocolSIRC20)
|
||||
return &irda_sirc20_protocol_specification;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user