disable em4100 16clk due to non working read

32 is working well
This commit is contained in:
MX 2024-01-31 18:32:48 +03:00
parent 90b49926ea
commit 398a468fd7
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
4 changed files with 42 additions and 75 deletions

View file

@ -20,8 +20,7 @@
const ProtocolBase* lfrfid_protocols[] = { const ProtocolBase* lfrfid_protocols[] = {
[LFRFIDProtocolEM4100] = &protocol_em4100, [LFRFIDProtocolEM4100] = &protocol_em4100,
[LFRFIDProtocolEM410032] = &protocol_em4100_32, [LFRFIDProtocolEM4100_32] = &protocol_em4100_32,
[LFRFIDProtocolEM410016] = &protocol_em4100_16,
[LFRFIDProtocolH10301] = &protocol_h10301, [LFRFIDProtocolH10301] = &protocol_h10301,
[LFRFIDProtocolIdteck] = &protocol_idteck, [LFRFIDProtocolIdteck] = &protocol_idteck,
[LFRFIDProtocolIndala26] = &protocol_indala26, [LFRFIDProtocolIndala26] = &protocol_indala26,

View file

@ -9,8 +9,7 @@ typedef enum {
typedef enum { typedef enum {
LFRFIDProtocolEM4100, LFRFIDProtocolEM4100,
LFRFIDProtocolEM410032, LFRFIDProtocolEM4100_32,
LFRFIDProtocolEM410016,
LFRFIDProtocolH10301, LFRFIDProtocolH10301,
LFRFIDProtocolIdteck, LFRFIDProtocolIdteck,
LFRFIDProtocolIndala26, LFRFIDProtocolIndala26,

View file

@ -39,71 +39,60 @@ typedef struct {
uint8_t clock_per_bit; uint8_t clock_per_bit;
} ProtocolEM4100; } ProtocolEM4100;
uint16_t protocol_em4100_get_time_divisor(ProtocolEM4100 *proto) { uint16_t protocol_em4100_get_time_divisor(ProtocolEM4100* proto) {
switch (proto->clock_per_bit) { switch(proto->clock_per_bit) {
case 64: case 64:
return 1; return 1;
case 32: case 32:
return 2; return 2;
case 16: default:
return 4; return 1;
default: }
return 1;
}
} }
uint32_t protocol_em4100_get_t5577_bitrate(ProtocolEM4100 *proto) { uint32_t protocol_em4100_get_t5577_bitrate(ProtocolEM4100* proto) {
switch (proto->clock_per_bit) { switch(proto->clock_per_bit) {
case 64: case 64:
return LFRFID_T5577_BITRATE_RF_64; return LFRFID_T5577_BITRATE_RF_64;
case 32: case 32:
return LFRFID_T5577_BITRATE_RF_32; return LFRFID_T5577_BITRATE_RF_32;
case 16: default:
return LFRFID_T5577_BITRATE_RF_16; return LFRFID_T5577_BITRATE_RF_64;
default: }
return LFRFID_T5577_BITRATE_RF_64;
}
} }
uint16_t protocol_em4100_get_short_time_low(ProtocolEM4100 *proto) { uint16_t protocol_em4100_get_short_time_low(ProtocolEM4100* proto) {
return EM_READ_SHORT_TIME_BASE / protocol_em4100_get_time_divisor(proto) - EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto); return EM_READ_SHORT_TIME_BASE / protocol_em4100_get_time_divisor(proto) -
EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto);
} }
uint16_t protocol_em4100_get_short_time_high(ProtocolEM4100 *proto) { uint16_t protocol_em4100_get_short_time_high(ProtocolEM4100* proto) {
return EM_READ_SHORT_TIME_BASE / protocol_em4100_get_time_divisor(proto) + EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto); return EM_READ_SHORT_TIME_BASE / protocol_em4100_get_time_divisor(proto) +
EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto);
} }
uint16_t protocol_em4100_get_long_time_low(ProtocolEM4100 *proto) { uint16_t protocol_em4100_get_long_time_low(ProtocolEM4100* proto) {
return EM_READ_LONG_TIME_BASE / protocol_em4100_get_time_divisor(proto) - EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto); return EM_READ_LONG_TIME_BASE / protocol_em4100_get_time_divisor(proto) -
EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto);
} }
uint16_t protocol_em4100_get_long_time_high(ProtocolEM4100 *proto) { uint16_t protocol_em4100_get_long_time_high(ProtocolEM4100* proto) {
return EM_READ_LONG_TIME_BASE / protocol_em4100_get_time_divisor(proto) + EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto); return EM_READ_LONG_TIME_BASE / protocol_em4100_get_time_divisor(proto) +
EM_READ_JITTER_TIME_BASE / protocol_em4100_get_time_divisor(proto);
} }
ProtocolEM4100* protocol_em4100_alloc(void) { ProtocolEM4100* protocol_em4100_alloc(void) {
ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100)); ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100));
proto->clock_per_bit = 64; proto->clock_per_bit = 64;
return (void*)proto; return (void*)proto;
}; };
ProtocolEM4100* protocol_em4100_16_alloc(void) {
ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100));
proto->clock_per_bit = 16;
return (void*)proto;
};
ProtocolEM4100* protocol_em4100_32_alloc(void) { ProtocolEM4100* protocol_em4100_32_alloc(void) {
ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100)); ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100));
proto->clock_per_bit = 32; proto->clock_per_bit = 32;
return (void*)proto; return (void*)proto;
}; };
void protocol_em4100_free(ProtocolEM4100* proto) { void protocol_em4100_free(ProtocolEM4100* proto) {
free(proto); free(proto);
}; };
@ -199,13 +188,16 @@ bool protocol_em4100_decoder_feed(ProtocolEM4100* proto, bool level, uint32_t du
ManchesterEvent event = ManchesterEventReset; ManchesterEvent event = ManchesterEventReset;
if(duration > protocol_em4100_get_short_time_low(proto) && duration < protocol_em4100_get_short_time_high(proto)) { if(duration > protocol_em4100_get_short_time_low(proto) &&
duration < protocol_em4100_get_short_time_high(proto)) {
if(!level) { if(!level) {
event = ManchesterEventShortHigh; event = ManchesterEventShortHigh;
} else { } else {
event = ManchesterEventShortLow; event = ManchesterEventShortLow;
} }
} else if(duration > protocol_em4100_get_long_time_low(proto) && duration < protocol_em4100_get_long_time_high(proto)) { } else if(
duration > protocol_em4100_get_long_time_low(proto) &&
duration < protocol_em4100_get_long_time_high(proto)) {
if(!level) { if(!level) {
event = ManchesterEventLongHigh; event = ManchesterEventLongHigh;
} else { } else {
@ -327,7 +319,11 @@ bool protocol_em4100_write_data(ProtocolEM4100* protocol, void* data) {
void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) { void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) {
uint8_t* data = protocol->data; uint8_t* data = protocol->data;
furi_string_printf( furi_string_printf(
result, "FC: %03u, Card: %05u (RF/%u)", data[2], (uint16_t)((data[3] << 8) | (data[4])), protocol->clock_per_bit); result,
"FC: %03u, Card: %05u (RF/%u)",
data[2],
(uint16_t)((data[3] << 8) | (data[4])),
protocol->clock_per_bit);
}; };
const ProtocolBase protocol_em4100 = { const ProtocolBase protocol_em4100 = {
@ -354,7 +350,6 @@ const ProtocolBase protocol_em4100 = {
.write_data = (ProtocolWriteData)protocol_em4100_write_data, .write_data = (ProtocolWriteData)protocol_em4100_write_data,
}; };
const ProtocolBase protocol_em4100_32 = { const ProtocolBase protocol_em4100_32 = {
.name = "EM4100/32", .name = "EM4100/32",
.manufacturer = "EM-Micro", .manufacturer = "EM-Micro",
@ -378,27 +373,3 @@ const ProtocolBase protocol_em4100_32 = {
.render_brief_data = (ProtocolRenderData)protocol_em4100_render_data, .render_brief_data = (ProtocolRenderData)protocol_em4100_render_data,
.write_data = (ProtocolWriteData)protocol_em4100_write_data, .write_data = (ProtocolWriteData)protocol_em4100_write_data,
}; };
const ProtocolBase protocol_em4100_16 = {
.name = "EM4100/16",
.manufacturer = "EM-Micro",
.data_size = EM4100_DECODED_DATA_SIZE,
.features = LFRFIDFeatureASK | LFRFIDFeaturePSK,
.validate_count = 3,
.alloc = (ProtocolAlloc)protocol_em4100_16_alloc,
.free = (ProtocolFree)protocol_em4100_free,
.get_data = (ProtocolGetData)protocol_em4100_get_data,
.decoder =
{
.start = (ProtocolDecoderStart)protocol_em4100_decoder_start,
.feed = (ProtocolDecoderFeed)protocol_em4100_decoder_feed,
},
.encoder =
{
.start = (ProtocolEncoderStart)protocol_em4100_encoder_start,
.yield = (ProtocolEncoderYield)protocol_em4100_encoder_yield,
},
.render_data = (ProtocolRenderData)protocol_em4100_render_data,
.render_brief_data = (ProtocolRenderData)protocol_em4100_render_data,
.write_data = (ProtocolWriteData)protocol_em4100_write_data,
};

View file

@ -4,5 +4,3 @@
extern const ProtocolBase protocol_em4100; extern const ProtocolBase protocol_em4100;
extern const ProtocolBase protocol_em4100_32; extern const ProtocolBase protocol_em4100_32;
extern const ProtocolBase protocol_em4100_16;