Add support for PAC/Stanley tags (#1648)

* Add support for PAC/Stanley tags
* Address review comments
This commit is contained in:
Sebastian Mauer
2022-08-29 16:04:17 +01:00
committed by GitHub
parent ffa3ff5e7c
commit 1350dcaf63
10 changed files with 287 additions and 6 deletions

View File

@@ -262,6 +262,13 @@ uint16_t bit_lib_reverse_16_fast(uint16_t data) {
return result;
}
uint8_t bit_lib_reverse_8_fast(uint8_t byte) {
byte = (byte & 0xF0) >> 4 | (byte & 0x0F) << 4;
byte = (byte & 0xCC) >> 2 | (byte & 0x33) << 2;
byte = (byte & 0xAA) >> 1 | (byte & 0x55) << 1;
return byte;
}
uint16_t bit_lib_crc16(
uint8_t const* data,
size_t data_size,

View File

@@ -194,6 +194,14 @@ void bit_lib_print_regions(
*/
uint16_t bit_lib_reverse_16_fast(uint16_t data);
/**
* @brief Reverse bits in uint8_t, faster than generic bit_lib_reverse_bits.
*
* @param byte Byte
* @return uint8_t the reversed byte
*/
uint8_t bit_lib_reverse_8_fast(uint8_t byte);
/**
* @brief Slow, but generic CRC16 implementation
*