Skip to content

Commit 0772d87

Browse files
committed
pbio/debug: Replace usage with common module.
No need to hook directly into the uart driver anymore.
1 parent fee7546 commit 0772d87

15 files changed

Lines changed: 44 additions & 49 deletions

lib/pbio/drv/bluetooth/bluetooth_btstack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#define DEBUG 0
4747

4848
#if DEBUG
49-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
50-
#define DEBUG_PRINT pbdrv_uart_debug_printf
49+
#include <pbio/debug.h>
50+
#define DEBUG_PRINT pbio_debug
5151
#else
5252
#define DEBUG_PRINT(...)
5353
#endif

lib/pbio/drv/bluetooth/bluetooth_btstack_ev3.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646
#define DEBUG 0
4747

4848
#if DEBUG
49-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
50-
#define DEBUG_PRINT pbdrv_uart_debug_printf
49+
#include <pbio/debug.h>
50+
#define DEBUG_PRINT pbio_debug
5151
static void pbdrv_hci_dump_reset(void) {
5252
}
5353
static void pbdrv_hci_dump_log_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len) {
54-
pbdrv_uart_debug_printf("HCI %s packet type: %02x, len: %u\n", in ? "in" : "out", packet_type, len);
54+
pbio_debug("HCI %s packet type: %02x, len: %u\n", in ? "in" : "out", packet_type, len);
5555
}
5656
static void pbdrv_hci_dump_log_message(int log_level, const char *format, va_list argptr) {
57-
pbdrv_uart_debug_vprintf(format, argptr);
58-
pbdrv_uart_debug_printf("\n");
57+
pbio_debug_va(format, argptr);
58+
pbio_debug("\n");
5959
}
6060
static const hci_dump_t bluetooth_btstack_classic_hci_dump = {
6161
.reset = pbdrv_hci_dump_reset,

lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
#define DEBUG 0
3939

4040
#if DEBUG
41-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
42-
#define DEBUG_PRINT pbdrv_uart_debug_printf
41+
#include <pbio/debug.h>
42+
#define DEBUG_PRINT pbio_debug
4343
#else
4444
#define DEBUG_PRINT(...)
4545
#endif

lib/pbio/drv/bluetooth/bluetooth_stm32_cc2640.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@
4646
#define DEBUG 0
4747

4848
#if DEBUG
49-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
50-
// You can selectively enable these as relevant for the debug session.
51-
// Remember to set PBDRV_CONFIG_UART_DEBUG_FIRST_PORT in pbdrvconfig.
49+
#include <pbio/debug.h>
5250
#define DBG(...)
53-
#define DEBUG_PRINT pbdrv_uart_debug_printf
51+
#define DEBUG_PRINT pbio_debug
5452
#else
5553
#define DBG(...)
5654
#define DEBUG_PRINT(...)

lib/pbio/drv/counter/counter_ev3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#if DEBUG
3434
#include <stdio.h>
3535
#include <inttypes.h>
36-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
37-
#define DEBUG_PRINT pbdrv_uart_debug_printf
36+
#include <pbio/debug.h>
37+
#define DEBUG_PRINT pbio_debug
3838
#else
3939
#define DEBUG_PRINT(...)
4040
#endif

lib/pbio/drv/i2c/i2c_ev3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#if DEBUG
3232
#include <stdio.h>
3333
#include <inttypes.h>
34-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
35-
#define debug_pr pbdrv_uart_debug_printf
34+
#include <pbio/debug.h>
35+
#define debug_pr pbio_debug
3636
#define DBG_ERR(expr) expr
3737
#else
3838
#define debug_pr(...)

lib/pbio/drv/motor_driver/motor_driver_ev3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#if DEBUG
3434
#include <stdio.h>
3535
#include <inttypes.h>
36-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
37-
#define debug_pr pbdrv_uart_debug_printf
36+
#include <pbio/debug.h>
37+
#define debug_pr pbio_debug
3838
#define DBG_ERR(expr) expr
3939
#else
4040
#define debug_pr(...)

lib/pbio/drv/uart/uart_debug_first_port.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,4 @@ static inline int pbdrv_uart_debug_next_char(void) {
3737

3838
#endif // PBDRV_CONFIG_UART_DEBUG_FIRST_PORT
3939

40-
// Convenient shorthand for pbdrv_uart_debug_printf.
41-
#define pbdrv_dbg(...) pbdrv_uart_debug_printf(__VA_ARGS__)
42-
4340
#endif // _INTERNAL_PBDRV_UART_DEBUG_FIRST_PORT_H_

lib/pbio/drv/usb/usb_stm32.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@
3131
#include "./usb.h"
3232
#include "./usb_stm32.h"
3333

34-
#define DEBUG 0
35-
36-
#if DEBUG
37-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
38-
// Remember to set PBDRV_CONFIG_UART_DEBUG_FIRST_PORT in pbdrvconfig.
39-
#define DEBUG_PRINT pbdrv_uart_debug_printf
40-
#else
41-
#define DEBUG_PRINT(...)
42-
#endif
4334

4435
#if USBD_PYBRICKS_MAX_PACKET_SIZE != PBDRV_CONFIG_USB_MAX_PACKET_SIZE
4536
#error Inconsistent USB packet size

lib/pbio/src/port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#if DEBUG
2626
#include <stdio.h>
2727
#include <inttypes.h>
28-
#include <pbdrv/../../drv/uart/uart_debug_first_port.h>
29-
#define debug_pr pbdrv_uart_debug_printf
28+
#include <pbio/debug.h>
29+
#define debug_pr pbio_debug
3030
#define DBG_ERR(expr) expr
3131
#else
3232
#define debug_pr(...)

0 commit comments

Comments
 (0)