Skip to content

Commit

Permalink
add bit_buffer logger
Browse files Browse the repository at this point in the history
  • Loading branch information
merlokk committed Jul 24, 2024
1 parent 1c3181e commit a2c9077
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions firmware/application/src/rfid/reader/lf/utils/bit_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
}
2 changes: 2 additions & 0 deletions firmware/application/src/rfid/reader/lf/utils/bit_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a2c9077

Please sign in to comment.