mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2025-10-05 03:26:35 +02:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#define SWAPENDIAN(x) \
|
||||
((x) = ((x) >> 8 & 0xff00ff) | ((x) & 0xff00ff) << 8, (x) = (x) >> 16 | (x) << 16)
|
||||
#define LF_POLY_ODD (0x29CE5C)
|
||||
#define LF_POLY_ODD (0x29CE5C)
|
||||
#define LF_POLY_EVEN (0x870804)
|
||||
|
||||
#define BEBIT(x, n) FURI_BIT(x, (n) ^ 24)
|
||||
|
@@ -45,7 +45,7 @@ bool felica_crc_check(const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = felica_crc_calculate(data, data_size - FELICA_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void felica_crc_trim(BitBuffer* buf) {
|
||||
|
@@ -2,9 +2,9 @@
|
||||
|
||||
#include <core/check.h>
|
||||
|
||||
#define ISO13239_CRC_INIT_DEFAULT (0xFFFFU)
|
||||
#define ISO13239_CRC_INIT_DEFAULT (0xFFFFU)
|
||||
#define ISO13239_CRC_INIT_PICOPASS (0xE012U)
|
||||
#define ISO13239_CRC_POLY (0x8408U)
|
||||
#define ISO13239_CRC_POLY (0x8408U)
|
||||
|
||||
static uint16_t
|
||||
iso13239_crc_calculate(Iso13239CrcType type, const uint8_t* data, size_t data_size) {
|
||||
@@ -55,7 +55,7 @@ bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = iso13239_crc_calculate(type, data, data_size - ISO13239_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void iso13239_crc_trim(BitBuffer* buf) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#define ISO14443_4_BLOCK_PCB (1U << 1)
|
||||
#define ISO14443_4_BLOCK_PCB (1U << 1)
|
||||
#define ISO14443_4_BLOCK_PCB_I (0U)
|
||||
#define ISO14443_4_BLOCK_PCB_R (5U << 5)
|
||||
#define ISO14443_4_BLOCK_PCB_S (3U << 6)
|
||||
|
@@ -50,7 +50,7 @@ bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = iso14443_crc_calculate(type, data, data_size - ISO14443_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void iso14443_crc_trim(BitBuffer* buf) {
|
||||
|
@@ -17,7 +17,7 @@ uint8_t nfc_util_even_parity32(uint32_t data) {
|
||||
// data ^= data >> 16;
|
||||
// data ^= data >> 8;
|
||||
// return !nfc_util_odd_byte_parity[data];
|
||||
return (__builtin_parity(data) & 0xFF);
|
||||
return __builtin_parity(data) & 0xFF;
|
||||
}
|
||||
|
||||
uint8_t nfc_util_odd_parity8(uint8_t data) {
|
||||
@@ -45,4 +45,4 @@ void nfc_util_odd_parity(const uint8_t* src, uint8_t* dst, uint8_t len) {
|
||||
if(bit) {
|
||||
*dst = parity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user