application: make some text only output when DEBUG is set
This commit is contained in:
parent
35a614750d
commit
d85d345ec4
@ -67,7 +67,12 @@ size_t putc(char c)
|
||||
return length; // return number of characters printed
|
||||
}
|
||||
|
||||
// menu commands
|
||||
// only print when debug is enabled
|
||||
#if DEBUG
|
||||
#define puts_debug(x) puts(x)
|
||||
#else
|
||||
#define puts_debug(x) {}
|
||||
#endif
|
||||
|
||||
/** display available commands
|
||||
* @param[in] argument no argument required
|
||||
@ -404,7 +409,7 @@ void main(void)
|
||||
#endif
|
||||
|
||||
// setup RTC
|
||||
puts("setup RTC: ");
|
||||
puts_debug("setup RTC: ");
|
||||
rcc_periph_clock_enable(RCC_RTC); // enable clock for RTC peripheral
|
||||
if (!(RCC_BDCR && RCC_BDCR_RTCEN)) { // the RTC has not been configured yet
|
||||
pwr_disable_backup_domain_write_protect(); // disable backup protection so we can set the RTC clock source
|
||||
@ -425,10 +430,10 @@ void main(void)
|
||||
pwr_enable_backup_domain_write_protect(); // re-enable protection now that we configured the RTC clock
|
||||
}
|
||||
boot_time = rtc_to_seconds(); // remember the start time
|
||||
puts("OK\n");
|
||||
puts_debug("OK\n");
|
||||
|
||||
// setup wakeup timer for periodic checks
|
||||
puts("setup wakeup: ");
|
||||
puts_debug("setup wakeup: ");
|
||||
// RTC needs to be configured beforehand
|
||||
pwr_disable_backup_domain_write_protect(); // disable backup protection so we can write to the RTC registers
|
||||
rtc_unlock(); // enable writing RTC registers
|
||||
@ -441,7 +446,7 @@ void main(void)
|
||||
rtc_enable_wakeup_timer_interrupt(); // enable interrupt
|
||||
rtc_lock(); // disable writing RTC registers
|
||||
// important: do not re-enable backup_domain_write_protect, since this will prevent clearing flags (but RTC registers do not need to be unlocked)
|
||||
puts("OK\n");
|
||||
puts_debug("OK\n");
|
||||
|
||||
// setup terminal
|
||||
terminal_prefix = ""; // set default prefix
|
||||
|
Loading…
Reference in New Issue
Block a user