Migrate and remove deprecated debug utils (#22961)

This commit is contained in:
Joel Challis 2024-01-26 16:32:06 +00:00 committed by GitHub
parent 728aa576b0
commit a632593769
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 26 additions and 127 deletions

View File

@ -76,7 +76,7 @@ uint8_t matrix_scan(void)
if (matrix_debouncing[i] != cols) { if (matrix_debouncing[i] != cols) {
matrix_debouncing[i] = cols; matrix_debouncing[i] = cols;
if (debouncing) { if (debouncing) {
debug("bounce!: "); debug_hex(debouncing); debug("\n"); dprintf("bounce!: %02X\n", debouncing);
} }
debouncing = DEBOUNCE; debouncing = DEBOUNCE;
} }

View File

@ -88,7 +88,7 @@ uint8_t matrix_scan(void)
if (matrix_debouncing[i] != cols) { if (matrix_debouncing[i] != cols) {
matrix_debouncing[i] = cols; matrix_debouncing[i] = cols;
if (debouncing) { if (debouncing) {
debug("bounce!: "); debug_hex(debouncing); debug("\n"); dprintf("bounce!: %02X\n", debouncing);
} }
debouncing = DEBOUNCE; debouncing = DEBOUNCE;
} }

View File

@ -59,9 +59,7 @@ static void bluefruit_trace_footer(void)
static void bluefruit_serial_send(uint8_t data) static void bluefruit_serial_send(uint8_t data)
{ {
#ifdef BLUEFRUIT_TRACE_SERIAL #ifdef BLUEFRUIT_TRACE_SERIAL
dprintf(" "); dprintf(" %02X ", data);
debug_hex8(data);
dprintf(" ");
#endif #endif
serial_send(data); serial_send(data);
} }
@ -146,11 +144,7 @@ void bluetooth_send_consumer(uint16_t usage)
uint16_t bitmap = CONSUMER2BLUEFRUIT(usage); uint16_t bitmap = CONSUMER2BLUEFRUIT(usage);
#ifdef BLUEFRUIT_TRACE_SERIAL #ifdef BLUEFRUIT_TRACE_SERIAL
dprintf("\nData: "); dprintf("\nData: %04X; bitmap: %04X\n", data, bitmap);
debug_hex16(data);
dprintf("; bitmap: ");
debug_hex16(bitmap);
dprintf("\n");
bluefruit_trace_header(); bluefruit_trace_header();
#endif #endif
send_str(PSTR("AT+BLEHIDCONTROLKEY=0x")); send_str(PSTR("AT+BLEHIDCONTROLKEY=0x"));

View File

@ -87,23 +87,23 @@ uint8_t matrix_scan(void)
uint8_t code; uint8_t code;
if ((code = ps2_host_recv())) { if ((code = ps2_host_recv())) {
debug("r"); debug_hex(code); debug(" "); dprintf("r%02X ", code);
} }
switch (state) { switch (state) {
case RESET: case RESET:
debug("wFF "); dprint("wFF ");
if (ps2_host_send(0xFF) == 0xFA) { if (ps2_host_send(0xFF) == 0xFA) {
debug("[ack]\nRESET_RESPONSE: "); dprint("[ack]\nRESET_RESPONSE: ");
state = RESET_RESPONSE; state = RESET_RESPONSE;
} }
break; break;
case RESET_RESPONSE: case RESET_RESPONSE:
if (code == 0xAA) { if (code == 0xAA) {
debug("[ok]\nKBD_ID: "); dprint("[ok]\nKBD_ID: ");
state = KBD_ID0; state = KBD_ID0;
} else if (code) { } else if (code) {
debug("err\nRESET: "); dprint("err\nRESET: ");
state = RESET; state = RESET;
} }
break; break;
@ -115,14 +115,14 @@ uint8_t matrix_scan(void)
break; break;
case KBD_ID1: case KBD_ID1:
if (code) { if (code) {
debug("\nCONFIG: "); dprint("\nCONFIG: ");
state = CONFIG; state = CONFIG;
} }
break; break;
case CONFIG: case CONFIG:
debug("wF8 "); dprint("wF8 ");
if (ps2_host_send(0xF8) == 0xFA) { if (ps2_host_send(0xF8) == 0xFA) {
debug("[ack]\nREADY\n"); dprint("[ack]\nREADY\n");
state = READY; state = READY;
} }
break; break;
@ -132,16 +132,16 @@ uint8_t matrix_scan(void)
break; break;
case 0xF0: case 0xF0:
state = F0_BREAK; state = F0_BREAK;
debug(" "); dprint(" ");
break; break;
default: // normal key make default: // normal key make
if (code < 0x88) { if (code < 0x88) {
matrix_make(code); matrix_make(code);
} else { } else {
debug("unexpected scan code at READY: "); debug_hex(code); debug("\n"); dprintf("unexpected scan code at READY: %02X\n", code);
} }
state = READY; state = READY;
debug("\n"); dprint("\n");
} }
break; break;
case F0_BREAK: // Break code case F0_BREAK: // Break code
@ -152,10 +152,10 @@ uint8_t matrix_scan(void)
if (code < 0x88) { if (code < 0x88) {
matrix_break(code); matrix_break(code);
} else { } else {
debug("unexpected scan code at F0: "); debug_hex(code); debug("\n"); dprintf("unexpected scan code at F0: %02X\n", code);
} }
state = READY; state = READY;
debug("\n"); dprint("\n");
} }
break; break;
} }

View File

@ -312,8 +312,7 @@ static inline uint8_t instant(void) {
m0110_send(M0110_INSTANT); m0110_send(M0110_INSTANT);
uint8_t data = m0110_recv(); uint8_t data = m0110_recv();
if (data != M0110_NULL) { if (data != M0110_NULL) {
debug_hex(data); dprintf("%02X ", data);
debug(" ");
} }
return data; return data;
} }

View File

@ -168,7 +168,7 @@ uint8_t get_serial_byte(void) {
while(1) { while(1) {
code = uart_read(); code = uart_read();
if (code) { if (code) {
debug_hex(code); debug(" "); dprintf("%02X ", code);
return code; return code;
} }
} }
@ -316,8 +316,7 @@ uint8_t matrix_scan(void)
last_activity = timer_read(); last_activity = timer_read();
disconnect_counter=0; // if we are getting serial data, we're connected. disconnect_counter=0; // if we are getting serial data, we're connected.
debug_hex(code); debug(" "); dprintf("%02X ", code);
switch (code) { switch (code) {
case 0xFD: // unexpected reset byte 2 case 0xFD: // unexpected reset byte 2

View File

@ -111,7 +111,7 @@ uint8_t matrix_scan(void)
code = uart_read(); code = uart_read();
if (!code) return 0; if (!code) return 0;
debug_hex(code); debug(" "); dprintf("%02X ", code);
switch (code) { switch (code) {
case 0xFF: // reset success: FF 04 case 0xFF: // reset success: FF 04

View File

@ -151,7 +151,7 @@ uint8_t matrix_scan(void)
if (matrix_debouncing[i] != cols) { if (matrix_debouncing[i] != cols) {
matrix_debouncing[i] = cols; matrix_debouncing[i] = cols;
if (debouncing) { if (debouncing) {
debug("bounce!: "); debug_hex(debouncing); debug("\n"); dprintf("bounce!: %02X\n", debouncing);
} }
debouncing = DEBOUNCE; debouncing = DEBOUNCE;
} }

View File

@ -60,8 +60,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
row_data = spi_read() << 8; row_data = spi_read() << 8;
row_data |= spi_read(); row_data |= spi_read();
debug_hex8(~row_data); dprintf("%02X ", ~row_data);
dprint(" ");
// For each row... // For each row...
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {

View File

@ -116,7 +116,7 @@ uint8_t matrix_scan(void)
if (matrix_debouncing[i] != row) { if (matrix_debouncing[i] != row) {
matrix_debouncing[i] = row; matrix_debouncing[i] = row;
if (debouncing) { if (debouncing) {
debug("bounce!: "); debug_hex(debouncing); debug("\n"); dprintf("bounce!: %02X\n", debouncing);
} }
debouncing = DEBOUNCE; debouncing = DEBOUNCE;
} }

View File

@ -85,7 +85,7 @@ int main(void)
_delay_ms(1000); _delay_ms(1000);
} }
debug("init: done\n"); dprintln("init: done");
for (;;) { for (;;) {
keyboard_task(); keyboard_task();

View File

@ -183,9 +183,7 @@ void led_task(void) {
last_led_modification_time = timer_read32(); last_led_modification_time = timer_read32();
if (debug_keyboard) { if (debug_keyboard) {
debug("led_task: "); dprintf("led_task: %02X\n", led_status);
debug_hex8(led_status);
debug("\n");
} }
led_set(led_status); led_set(led_status);
} }

View File

@ -69,101 +69,11 @@ extern debug_config_t debug_config;
} while (0) } while (0)
# define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s) # define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s)
/* Deprecated. DO NOT USE these anymore, use dprintf instead. */
# define debug(s) \
do { \
if (debug_enable) print(s); \
} while (0)
# define debugln(s) \
do { \
if (debug_enable) println(s); \
} while (0)
# define debug_msg(s) \
do { \
if (debug_enable) { \
print(__FILE__); \
print(" at "); \
print_dec(__LINE__); \
print(" in "); \
print(": "); \
print(s); \
} \
} while (0)
# define debug_dec(data) \
do { \
if (debug_enable) print_dec(data); \
} while (0)
# define debug_decs(data) \
do { \
if (debug_enable) print_decs(data); \
} while (0)
# define debug_hex4(data) \
do { \
if (debug_enable) print_hex4(data); \
} while (0)
# define debug_hex8(data) \
do { \
if (debug_enable) print_hex8(data); \
} while (0)
# define debug_hex16(data) \
do { \
if (debug_enable) print_hex16(data); \
} while (0)
# define debug_hex32(data) \
do { \
if (debug_enable) print_hex32(data); \
} while (0)
# define debug_bin8(data) \
do { \
if (debug_enable) print_bin8(data); \
} while (0)
# define debug_bin16(data) \
do { \
if (debug_enable) print_bin16(data); \
} while (0)
# define debug_bin32(data) \
do { \
if (debug_enable) print_bin32(data); \
} while (0)
# define debug_bin_reverse8(data) \
do { \
if (debug_enable) print_bin_reverse8(data); \
} while (0)
# define debug_bin_reverse16(data) \
do { \
if (debug_enable) print_bin_reverse16(data); \
} while (0)
# define debug_bin_reverse32(data) \
do { \
if (debug_enable) print_bin_reverse32(data); \
} while (0)
# define debug_hex(data) debug_hex8(data)
# define debug_bin(data) debug_bin8(data)
# define debug_bin_reverse(data) debug_bin8(data)
#else /* NO_DEBUG */ #else /* NO_DEBUG */
# define dprint(s) # define dprint(s)
# define dprintln(s) # define dprintln(s)
# define dprintf(fmt, ...) # define dprintf(fmt, ...)
# define dmsg(s) # define dmsg(s)
# define debug(s)
# define debugln(s)
# define debug_msg(s)
# define debug_dec(data)
# define debug_decs(data)
# define debug_hex4(data)
# define debug_hex8(data)
# define debug_hex16(data)
# define debug_hex32(data)
# define debug_bin8(data)
# define debug_bin16(data)
# define debug_bin32(data)
# define debug_bin_reverse8(data)
# define debug_bin_reverse16(data)
# define debug_bin_reverse32(data)
# define debug_hex(data)
# define debug_bin(data)
# define debug_bin_reverse(data)
#endif /* NO_DEBUG */ #endif /* NO_DEBUG */