mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2025-10-01 15:06:55 +02:00
RFID: Add additional procotols supported by EM4305 chipset (#434)
* Add additional procotols supported by EM4305 chipset * Add support for GProxII (inverted EM4305 BIPHASE) * Update changelog --------- Co-authored-by: WillyJL <me@willyjl.dev>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- UL: Nero Radio static parse and display more data (by @xMasterX)
|
||||
- UL: Marantec protocol implement CRC verification display and add manually support (by @xMasterX & @li0ard, original code by @Skorpionm)
|
||||
- UL: Keeloq Comunello add manually support (by @xMasterX)
|
||||
- RFID: Support writing Securakey, Jablotron and FDX-B to EM4305 cards (#434 by @jamisonderek)
|
||||
- BT Remote: Add Rename Option, simplify Bad KB BLE profile (by @aaronjamt & @WillyJL)
|
||||
- MNTM Settings: Add Skip Sliding Animations option for Lockscreen (by @aaronjamt)
|
||||
|
||||
|
@@ -406,8 +406,7 @@ bool protocol_electra_write_data(ProtocolElectra* protocol, void* data) {
|
||||
request->t5577.block[4] = protocol->encoded_epilogue & 0xFFFFFFFF;
|
||||
request->t5577.blocks_to_write = 5;
|
||||
result = true;
|
||||
}
|
||||
if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
} else if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
request->em4305.word[4] =
|
||||
(EM4x05_MODULATION_MANCHESTER | EM4x05_SET_BITRATE(64) | (8 << EM4x05_MAXBLOCK_SHIFT));
|
||||
uint64_t encoded_data_reversed = 0;
|
||||
|
@@ -369,6 +369,21 @@ bool protocol_fdx_b_write_data(ProtocolFDXB* protocol, void* data) {
|
||||
request->t5577.block[4] = bit_lib_get_bits_32(protocol->encoded_data, 96, 32);
|
||||
request->t5577.blocks_to_write = 5;
|
||||
result = true;
|
||||
} else if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
request->em4305.word[4] =
|
||||
(EM4x05_MODULATION_BIPHASE | EM4x05_SET_BITRATE(32) | (8 << EM4x05_MAXBLOCK_SHIFT));
|
||||
uint32_t encoded_data_reversed[4] = {0};
|
||||
for(uint8_t i = 0; i < 128; i++) {
|
||||
encoded_data_reversed[i / 32] =
|
||||
(encoded_data_reversed[i / 32] << 1) |
|
||||
(bit_lib_get_bit(protocol->encoded_data, (127 - i)) & 1);
|
||||
}
|
||||
request->em4305.word[5] = encoded_data_reversed[3];
|
||||
request->em4305.word[6] = encoded_data_reversed[2];
|
||||
request->em4305.word[7] = encoded_data_reversed[1];
|
||||
request->em4305.word[8] = encoded_data_reversed[0];
|
||||
request->em4305.mask = 0x1F0;
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -287,6 +287,20 @@ bool protocol_gproxii_write_data(ProtocolGProxII* protocol, void* data) {
|
||||
request->t5577.block[3] = bit_lib_get_bits_32(protocol->data, 64, 32);
|
||||
request->t5577.blocks_to_write = 4;
|
||||
result = true;
|
||||
} else if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
request->em4305.word[4] =
|
||||
(EM4x05_MODULATION_BIPHASE | EM4x05_SET_BITRATE(64) | (7 << EM4x05_MAXBLOCK_SHIFT));
|
||||
uint32_t encoded_data_reversed[3] = {0};
|
||||
for(uint8_t i = 0; i < 96; i++) {
|
||||
encoded_data_reversed[i / 32] = (encoded_data_reversed[i / 32] << 1) |
|
||||
(bit_lib_get_bit(protocol->data, (95 - i)) & 1);
|
||||
encoded_data_reversed[i / 32] ^= 1; // Invert to make DIPHASE/BIPHASE.
|
||||
}
|
||||
request->em4305.word[5] = encoded_data_reversed[2];
|
||||
request->em4305.word[6] = encoded_data_reversed[1];
|
||||
request->em4305.word[7] = encoded_data_reversed[0];
|
||||
request->em4305.mask = 0xF0;
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -182,6 +182,19 @@ bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) {
|
||||
request->t5577.block[2] = bit_lib_get_bits_32(protocol->encoded_data, 32, 32);
|
||||
request->t5577.blocks_to_write = 3;
|
||||
result = true;
|
||||
} else if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
request->em4305.word[4] =
|
||||
(EM4x05_MODULATION_BIPHASE | EM4x05_SET_BITRATE(64) | (6 << EM4x05_MAXBLOCK_SHIFT));
|
||||
uint32_t encoded_data_reversed[2] = {0};
|
||||
for(uint8_t i = 0; i < 64; i++) {
|
||||
encoded_data_reversed[i / 32] =
|
||||
(encoded_data_reversed[i / 32] << 1) |
|
||||
(bit_lib_get_bit(protocol->encoded_data, (63 - i)) & 1);
|
||||
}
|
||||
request->em4305.word[5] = encoded_data_reversed[1];
|
||||
request->em4305.word[6] = encoded_data_reversed[0];
|
||||
request->em4305.mask = 0x70;
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -328,6 +328,20 @@ bool protocol_securakey_write_data(ProtocolSecurakey* protocol, void* data) {
|
||||
request->t5577.block[2] = bit_lib_get_bits_32(protocol->RKKTH_encoded_data, 32, 32);
|
||||
request->t5577.blocks_to_write = 3;
|
||||
result = true;
|
||||
} else if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
request->em4305.word[4] =
|
||||
(EM4x05_MODULATION_MANCHESTER | EM4x05_SET_BITRATE(40) | // requires 330pF card
|
||||
(6 << EM4x05_MAXBLOCK_SHIFT));
|
||||
uint32_t encoded_data_reversed[2] = {0};
|
||||
for(uint8_t i = 0; i < 64; i++) {
|
||||
encoded_data_reversed[i / 32] =
|
||||
(encoded_data_reversed[i / 32] << 1) |
|
||||
(bit_lib_get_bit(protocol->RKKTH_encoded_data, (63 - i)) & 1);
|
||||
}
|
||||
request->em4305.word[5] = encoded_data_reversed[1];
|
||||
request->em4305.word[6] = encoded_data_reversed[0];
|
||||
request->em4305.mask = 0x70;
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
if(request->write_type == LFRFIDWriteTypeT5577) {
|
||||
@@ -340,6 +354,21 @@ bool protocol_securakey_write_data(ProtocolSecurakey* protocol, void* data) {
|
||||
request->t5577.block[3] = bit_lib_get_bits_32(protocol->RKKT_encoded_data, 64, 32);
|
||||
request->t5577.blocks_to_write = 4;
|
||||
result = true;
|
||||
} else if(request->write_type == LFRFIDWriteTypeEM4305) {
|
||||
request->em4305.word[4] =
|
||||
(EM4x05_MODULATION_MANCHESTER | EM4x05_SET_BITRATE(40) | // requires 330pF card
|
||||
(7 << EM4x05_MAXBLOCK_SHIFT));
|
||||
uint32_t encoded_data_reversed[3] = {0};
|
||||
for(uint8_t i = 0; i < 96; i++) {
|
||||
encoded_data_reversed[i / 32] =
|
||||
(encoded_data_reversed[i / 32] << 1) |
|
||||
(bit_lib_get_bit(protocol->RKKT_encoded_data, (95 - i)) & 1);
|
||||
}
|
||||
request->em4305.word[5] = encoded_data_reversed[2];
|
||||
request->em4305.word[6] = encoded_data_reversed[1];
|
||||
request->em4305.word[7] = encoded_data_reversed[0];
|
||||
request->em4305.mask = 0xF0;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user