From 24aebac344e8fc672a93d921d492d61482e8c3ca Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sat, 27 Feb 2021 22:48:17 +1300 Subject: Move debug macros to dedicated header Also removes use of debug macros from altimeter.c --- altimeter.c | 16 ---------------- debug.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 debug.h diff --git a/altimeter.c b/altimeter.c index db18659..76dabd9 100644 --- a/altimeter.c +++ b/altimeter.c @@ -22,20 +22,6 @@ # define WDT_PAT_MAYBE() do{wdt_reset();}while(0) #endif -#define DEBUG_ALL_VAL ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)) -#define DEBUG_INIT do{DDRB |= DEBUG_ALL_VAL;}while(0) -#define DEBUG_MARK_SET_ALL do{PORTB |= DEBUG_ALL_VAL;}while(0) -#define DEBUG_MARK_1_SET do{PORTB |= 1 << 1;}while(0) -#define DEBUG_MARK_1_CLEAR do{PORTB &= ~(1 << 1);}while(0) -#define DEBUG_MARK_2_SET do{PORTB |= 1 << 3;}while(0) -#define DEBUG_MARK_2_CLEAR do{PORTB &= ~(1 << 3);}while(0) -#define DEBUG_MARK_3_SET do{PORTB |= 1 << 2;}while(0) -#define DEBUG_MARK_3_CLEAR do{PORTB &= ~(1 << 2);}while(0) -#define DEBUG_MARK_4_SET do{PORTB |= 1 << 6;}while(0) -#define DEBUG_MARK_4_CLEAR do{PORTB &= ~(1 << 6);}while(0) -#define DEBUG_MARK_5_SET do{PORTB |= 1 << 5;}while(0) -#define DEBUG_MARK_5_CLEAR do{PORTB &= ~(1 << 5);}while(0) - static struct data_ctx dctx = {}; /* ISR for collecting and displaying pressure, altitude data etc */ @@ -67,8 +53,6 @@ int main(void) data_manager_init(&dctx, &timer, &barometer); - DEBUG_INIT; - #ifdef USBCON /* Disable USB controller if one is present - this spams (latches?) USB_GEN * interrupt which we're not handling for now */ diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..503922a --- /dev/null +++ b/debug.h @@ -0,0 +1,13 @@ +#define DEBUG_ALL_VAL ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)) +#define DEBUG_INIT do{DDRB |= DEBUG_ALL_VAL;}while(0) +#define DEBUG_MARK_SET_ALL do{PORTB |= DEBUG_ALL_VAL;}while(0) +#define DEBUG_MARK_1_SET do{PORTB |= 1 << 1;}while(0) +#define DEBUG_MARK_1_CLEAR do{PORTB &= ~(1 << 1);}while(0) +#define DEBUG_MARK_2_SET do{PORTB |= 1 << 3;}while(0) +#define DEBUG_MARK_2_CLEAR do{PORTB &= ~(1 << 3);}while(0) +#define DEBUG_MARK_3_SET do{PORTB |= 1 << 2;}while(0) +#define DEBUG_MARK_3_CLEAR do{PORTB &= ~(1 << 2);}while(0) +#define DEBUG_MARK_4_SET do{PORTB |= 1 << 6;}while(0) +#define DEBUG_MARK_4_CLEAR do{PORTB &= ~(1 << 6);}while(0) +#define DEBUG_MARK_5_SET do{PORTB |= 1 << 5;}while(0) +#define DEBUG_MARK_5_CLEAR do{PORTB &= ~(1 << 5);}while(0) -- cgit v1.1