42 #ifndef _EXAMPLES_NFC_UTILS_H_
43 # define _EXAMPLES_NFC_UTILS_H_
54 # define DBG(...) do { \
55 warnx ("DBG %s:%d", __FILE__, __LINE__); \
56 warnx (" " __VA_ARGS__ ); \
67 # define WARN(...) do { \
68 warnx ("WARNING %s:%d", __FILE__, __LINE__); \
69 warnx (" " __VA_ARGS__ ); \
72 # define WARN(...) warnx ("WARNING: " __VA_ARGS__ )
80 # define ERR(...) do { \
81 warnx ("ERROR %s:%d", __FILE__, __LINE__); \
82 warnx (" " __VA_ARGS__ ); \
85 # define ERR(...) warnx ("ERROR: " __VA_ARGS__ )
89 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
92 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
95 uint8_t oddparity(
const uint8_t bt);
96 void oddparity_bytes_ts(
const uint8_t *pbtData,
const size_t szLen, uint8_t *pbtPar);
98 void print_hex(
const uint8_t *pbtData,
const size_t szLen);
99 void print_hex_bits(
const uint8_t *pbtData,
const size_t szBits);
100 void print_hex_par(
const uint8_t *pbtData,
const size_t szBits,
const uint8_t *pbtDataPar);
102 void print_nfc_target(
const nfc_target *pnt,
bool verbose);