mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
formatting
This commit is contained in:
@@ -8,17 +8,17 @@
|
||||
// 4 9 4 4 5 4 4 B 3 5 1 F B E 4 B
|
||||
// 0100 1001 0100 0100 0101 0100 0100 1011 0011 0101 0001 1111 1011 1110 0100 1011
|
||||
|
||||
#define IDTECK_PREAMBLE_BIT_SIZE (32)
|
||||
#define IDTECK_PREAMBLE_BIT_SIZE (32)
|
||||
#define IDTECK_PREAMBLE_DATA_SIZE (8)
|
||||
|
||||
#define IDTECK_ENCODED_BIT_SIZE (64)
|
||||
#define IDTECK_ENCODED_BIT_SIZE (64)
|
||||
#define IDTECK_ENCODED_DATA_SIZE (((IDTECK_ENCODED_BIT_SIZE) / 8) + IDTECK_PREAMBLE_DATA_SIZE)
|
||||
#define IDTECK_ENCODED_DATA_LAST ((IDTECK_ENCODED_BIT_SIZE) / 8)
|
||||
|
||||
#define IDTECK_DECODED_BIT_SIZE (64)
|
||||
#define IDTECK_DECODED_BIT_SIZE (64)
|
||||
#define IDTECK_DECODED_DATA_SIZE (8)
|
||||
|
||||
#define IDTECK_US_PER_BIT (255)
|
||||
#define IDTECK_US_PER_BIT (255)
|
||||
#define IDTECK_ENCODER_PULSES_PER_BIT (16)
|
||||
|
||||
typedef struct {
|
||||
@@ -42,22 +42,22 @@ typedef struct {
|
||||
ProtocolIdteck* protocol_idteck_alloc(void) {
|
||||
ProtocolIdteck* protocol = malloc(sizeof(ProtocolIdteck));
|
||||
return protocol;
|
||||
};
|
||||
}
|
||||
|
||||
void protocol_idteck_free(ProtocolIdteck* protocol) {
|
||||
free(protocol);
|
||||
};
|
||||
}
|
||||
|
||||
uint8_t* protocol_idteck_get_data(ProtocolIdteck* protocol) {
|
||||
return protocol->data;
|
||||
};
|
||||
}
|
||||
|
||||
void protocol_idteck_decoder_start(ProtocolIdteck* protocol) {
|
||||
memset(protocol->encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
|
||||
memset(protocol->negative_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
|
||||
memset(protocol->corrupted_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
|
||||
memset(protocol->corrupted_negative_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
|
||||
};
|
||||
}
|
||||
|
||||
static bool protocol_idteck_check_preamble(uint8_t* data, size_t bit_index) {
|
||||
// Preamble 01001001 01000100 01010100 01001011
|
||||
@@ -144,7 +144,7 @@ bool protocol_idteck_decoder_feed(ProtocolIdteck* protocol, bool level, uint32_t
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
bool protocol_idteck_encoder_start(ProtocolIdteck* protocol) {
|
||||
memset(protocol->encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
|
||||
@@ -159,7 +159,7 @@ bool protocol_idteck_encoder_start(ProtocolIdteck* protocol) {
|
||||
protocol->encoder.bit_clock_index = 0;
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
LevelDuration protocol_idteck_encoder_yield(ProtocolIdteck* protocol) {
|
||||
LevelDuration level_duration;
|
||||
@@ -189,7 +189,7 @@ LevelDuration protocol_idteck_encoder_yield(ProtocolIdteck* protocol) {
|
||||
}
|
||||
|
||||
return level_duration;
|
||||
};
|
||||
}
|
||||
|
||||
// factory code
|
||||
static uint32_t get_fc(const uint8_t* data) {
|
||||
@@ -232,7 +232,7 @@ bool protocol_idteck_write_data(ProtocolIdteck* protocol, void* data) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
const ProtocolBase protocol_idteck = {
|
||||
.name = "Idteck",
|
||||
|
||||
Reference in New Issue
Block a user