diff --git a/firmware/application/src/rfid/reader/lf/utils/bit_buffer.c b/firmware/application/src/rfid/reader/lf/utils/bit_buffer.c index d7086aca..2f318499 100644 --- a/firmware/application/src/rfid/reader/lf/utils/bit_buffer.c +++ b/firmware/application/src/rfid/reader/lf/utils/bit_buffer.c @@ -4,6 +4,12 @@ #define BITS_IN_BYTE (8) +#define NRF_LOG_MODULE_NAME bit_buffer +#include "nrf_log.h" +#include "nrf_log_ctrl.h" +#include "nrf_log_default_backends.h" +NRF_LOG_MODULE_REGISTER(); + struct BitBuffer { uint8_t* data; uint8_t* parity; @@ -42,6 +48,8 @@ BitBuffer* bit_buffer_alloc(size_t capacity_bytes) { buf->capacity_bytes = capacity_bytes; buf->size_bits = 0; + bit_buffer_reset(buf); + return buf; } @@ -361,3 +369,8 @@ void bit_buffer_append_bit(BitBuffer* buf, bool bit) { buf->size_bits++; } + +void bit_buffer_dump(BitBuffer* buf) { + NRF_LOG_INFO("--> bit buffer len: %d bits", buf->size_bits); + NRF_LOG_HEXDUMP_INFO(buf->data, bit_buffer_get_size_bytes(buf)); +} diff --git a/firmware/application/src/rfid/reader/lf/utils/bit_buffer.h b/firmware/application/src/rfid/reader/lf/utils/bit_buffer.h index 98712924..67fff22f 100644 --- a/firmware/application/src/rfid/reader/lf/utils/bit_buffer.h +++ b/firmware/application/src/rfid/reader/lf/utils/bit_buffer.h @@ -321,6 +321,8 @@ void bit_buffer_append_bytes(BitBuffer* buf, const uint8_t* data, size_t size_by */ void bit_buffer_append_bit(BitBuffer* buf, bool bit); +void bit_buffer_dump(BitBuffer* buf); + #ifdef __cplusplus } #endif