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:
@@ -20,9 +20,9 @@ void irda_encoder_nec_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
IrdaCommonEncoder* encoder = encoder_ptr;
|
||||
irda_common_encoder_reset(encoder);
|
||||
|
||||
uint32_t* data1 = (void*) encoder->data;
|
||||
uint32_t* data1 = (void*)encoder->data;
|
||||
uint32_t* data2 = data1 + 1;
|
||||
if (message->protocol == IrdaProtocolNEC) {
|
||||
if(message->protocol == IrdaProtocolNEC) {
|
||||
uint8_t address = message->address;
|
||||
uint8_t address_inverse = ~address;
|
||||
uint8_t command = message->command;
|
||||
@@ -32,11 +32,11 @@ void irda_encoder_nec_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
*data1 |= command << 16;
|
||||
*data1 |= command_inverse << 24;
|
||||
encoder->bits_to_encode = 32;
|
||||
} else if (message->protocol == IrdaProtocolNECext) {
|
||||
*data1 = (uint16_t) message->address;
|
||||
} else if(message->protocol == IrdaProtocolNECext) {
|
||||
*data1 = (uint16_t)message->address;
|
||||
*data1 |= (message->command & 0xFFFF) << 16;
|
||||
encoder->bits_to_encode = 32;
|
||||
} else if (message->protocol == IrdaProtocolNEC42) {
|
||||
} else if(message->protocol == IrdaProtocolNEC42) {
|
||||
/* 13 address + 13 inverse address + 8 command + 8 inv command */
|
||||
*data1 = message->address & 0x1FFFUL;
|
||||
*data1 |= (~message->address & 0x1FFFUL) << 13;
|
||||
@@ -44,7 +44,7 @@ void irda_encoder_nec_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
*data2 = (message->command & 0xC0UL) >> 6;
|
||||
*data2 |= (~message->command & 0xFFUL) << 2;
|
||||
encoder->bits_to_encode = 42;
|
||||
} else if (message->protocol == IrdaProtocolNEC42ext) {
|
||||
} else if(message->protocol == IrdaProtocolNEC42ext) {
|
||||
*data1 = message->address & 0x3FFFFFF;
|
||||
*data1 |= ((message->command & 0x3F) << 26);
|
||||
*data2 = (message->command & 0xFFC0) >> 6;
|
||||
@@ -54,7 +54,8 @@ void irda_encoder_nec_reset(void* encoder_ptr, const IrdaMessage* message) {
|
||||
}
|
||||
}
|
||||
|
||||
IrdaStatus irda_encoder_nec_encode_repeat(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
|
||||
IrdaStatus
|
||||
irda_encoder_nec_encode_repeat(IrdaCommonEncoder* encoder, uint32_t* duration, bool* level) {
|
||||
furi_assert(encoder);
|
||||
|
||||
/* space + 2 timings preambule + payload + stop bit */
|
||||
@@ -63,7 +64,7 @@ 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_PERIOD - encoder->timings_sum;
|
||||
@@ -87,4 +88,3 @@ void irda_encoder_nec_free(void* encoder_ptr) {
|
||||
IrdaStatus irda_encoder_nec_encode(void* encoder_ptr, uint32_t* duration, bool* level) {
|
||||
return irda_common_encode(encoder_ptr, duration, level);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user