mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
[FL-3867] Code formatting update (#3765)
* clang-format: AllowShortEnumsOnASingleLine: false * clang-format: InsertNewlineAtEOF: true * clang-format: Standard: c++20 * clang-format: AlignConsecutiveBitFields * clang-format: AlignConsecutiveMacros * clang-format: RemoveParentheses: ReturnStatement * clang-format: RemoveSemicolon: true * Restored RemoveParentheses: Leave, retained general changes for it * formatting: fixed logging TAGs * Formatting update for dev Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -6,21 +6,21 @@
|
||||
|
||||
#define VIKING_CLOCK_PER_BIT (32)
|
||||
|
||||
#define VIKING_ENCODED_BIT_SIZE (64)
|
||||
#define VIKING_ENCODED_BYTE_SIZE (((VIKING_ENCODED_BIT_SIZE) / 8))
|
||||
#define VIKING_PREAMBLE_BIT_SIZE (24)
|
||||
#define VIKING_PREAMBLE_BYTE_SIZE (3)
|
||||
#define VIKING_ENCODED_BIT_SIZE (64)
|
||||
#define VIKING_ENCODED_BYTE_SIZE (((VIKING_ENCODED_BIT_SIZE) / 8))
|
||||
#define VIKING_PREAMBLE_BIT_SIZE (24)
|
||||
#define VIKING_PREAMBLE_BYTE_SIZE (3)
|
||||
#define VIKING_ENCODED_BYTE_FULL_SIZE (VIKING_ENCODED_BYTE_SIZE + VIKING_PREAMBLE_BYTE_SIZE)
|
||||
#define VIKING_DECODED_DATA_SIZE 4
|
||||
#define VIKING_DECODED_DATA_SIZE 4
|
||||
|
||||
#define VIKING_READ_SHORT_TIME (128)
|
||||
#define VIKING_READ_LONG_TIME (256)
|
||||
#define VIKING_READ_SHORT_TIME (128)
|
||||
#define VIKING_READ_LONG_TIME (256)
|
||||
#define VIKING_READ_JITTER_TIME (60)
|
||||
|
||||
#define VIKING_READ_SHORT_TIME_LOW (VIKING_READ_SHORT_TIME - VIKING_READ_JITTER_TIME)
|
||||
#define VIKING_READ_SHORT_TIME_LOW (VIKING_READ_SHORT_TIME - VIKING_READ_JITTER_TIME)
|
||||
#define VIKING_READ_SHORT_TIME_HIGH (VIKING_READ_SHORT_TIME + VIKING_READ_JITTER_TIME)
|
||||
#define VIKING_READ_LONG_TIME_LOW (VIKING_READ_LONG_TIME - VIKING_READ_JITTER_TIME)
|
||||
#define VIKING_READ_LONG_TIME_HIGH (VIKING_READ_LONG_TIME + VIKING_READ_JITTER_TIME)
|
||||
#define VIKING_READ_LONG_TIME_LOW (VIKING_READ_LONG_TIME - VIKING_READ_JITTER_TIME)
|
||||
#define VIKING_READ_LONG_TIME_HIGH (VIKING_READ_LONG_TIME + VIKING_READ_JITTER_TIME)
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[VIKING_DECODED_DATA_SIZE];
|
||||
@@ -35,15 +35,15 @@ typedef struct {
|
||||
ProtocolViking* protocol_viking_alloc(void) {
|
||||
ProtocolViking* proto = malloc(sizeof(ProtocolViking));
|
||||
return (void*)proto;
|
||||
};
|
||||
}
|
||||
|
||||
void protocol_viking_free(ProtocolViking* protocol) {
|
||||
free(protocol);
|
||||
};
|
||||
}
|
||||
|
||||
uint8_t* protocol_viking_get_data(ProtocolViking* protocol) {
|
||||
return protocol->data;
|
||||
};
|
||||
}
|
||||
|
||||
static void protocol_viking_decode(ProtocolViking* protocol) {
|
||||
// Copy Card ID
|
||||
@@ -80,7 +80,7 @@ void protocol_viking_decoder_start(ProtocolViking* protocol) {
|
||||
ManchesterEventReset,
|
||||
&protocol->decoder_manchester_state,
|
||||
NULL);
|
||||
};
|
||||
}
|
||||
|
||||
bool protocol_viking_decoder_feed(ProtocolViking* protocol, bool level, uint32_t duration) {
|
||||
bool result = false;
|
||||
@@ -117,7 +117,7 @@ bool protocol_viking_decoder_feed(ProtocolViking* protocol, bool level, uint32_t
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
bool protocol_viking_encoder_start(ProtocolViking* protocol) {
|
||||
// Preamble
|
||||
@@ -135,7 +135,7 @@ bool protocol_viking_encoder_start(ProtocolViking* protocol) {
|
||||
bit_lib_set_bits(protocol->encoded_data, 56, checksum, 8);
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
LevelDuration protocol_viking_encoder_yield(ProtocolViking* protocol) {
|
||||
bool level = bit_lib_get_bit(protocol->encoded_data, protocol->encoded_data_index);
|
||||
@@ -151,7 +151,7 @@ LevelDuration protocol_viking_encoder_yield(ProtocolViking* protocol) {
|
||||
}
|
||||
|
||||
return level_duration_make(level, duration);
|
||||
};
|
||||
}
|
||||
|
||||
bool protocol_viking_write_data(ProtocolViking* protocol, void* data) {
|
||||
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
|
||||
@@ -173,11 +173,11 @@ bool protocol_viking_write_data(ProtocolViking* protocol, void* data) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
void protocol_viking_render_data(ProtocolViking* protocol, FuriString* result) {
|
||||
furi_string_printf(result, "ID: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32));
|
||||
};
|
||||
}
|
||||
|
||||
const ProtocolBase protocol_viking = {
|
||||
.name = "Viking",
|
||||
|
||||
Reference in New Issue
Block a user