#ifndef DEBUG_H_ #define DEBUG_H_ #include "util.h" #include void usart_tx(uint8_t data); void usart_tx_hex8(uint8_t number); void usart_tx_hex16(uint16_t number); void usart_tx_1num_8bit(const char PROGPTR *d, uint8_t n); void usart_tx_2num_8bit(const char PROGPTR *d1, uint8_t n1, const char PROGPTR *d2, uint8_t n2); void usart_tx_1num_16bit(const char PROGPTR *d, uint16_t n); void usart_tx_2num_16bit(const char PROGPTR *d1, uint16_t n1, const char PROGPTR *d2, uint16_t n2); void usart_tx_string(const char PROGPTR *flash_string); void usart_dump_mem(const void *_mem, uint8_t size); void usart_init(void); #define printstr(string_literal) usart_tx_string(PSTR(string_literal)) #define printhex16(num) usart_tx_hex16(num) #define printhex8(num) usart_tx_hex8(num) #define print1num(description, num) do { if (sizeof(num) == 1) \ usart_tx_1num_8bit(PSTR(description), num); \ else \ usart_tx_1num_16bit(PSTR(description), num); \ } while (0) #define print2num(d1, n1, d2, n2) do { if (sizeof(n1) == 1 && sizeof(n2) == 1) \ usart_tx_2num_8bit(PSTR(d1), n1, PSTR(d2), n2); \ else \ usart_tx_2num_16bit(PSTR(d1), n1, PSTR(d2), n2); \ } while (0) #define dumpmem(mem_addr, size) usart_dump_mem(mem_addr, size) #endif /* DEBUG_H_ */