disable debug output

This commit is contained in:
King Kévin 2022-08-06 10:26:55 +02:00
parent ed8a561430
commit 7a28b2abb5
1 changed files with 11 additions and 8 deletions

19
main.c
View File

@ -11,6 +11,9 @@
#include "main.h"
#include "softi2c_master.h"
// enable UART debug
#define DEBUG 0
#define EEPROM_ADDR 0x4000 // EEPROM start address
static bool eeprom_valid = true; // if the EDID can be read from EEPROM
// LED pin (sink for on)
@ -57,23 +60,22 @@ static void wait_10us(uint32_t us10)
void putc(char c)
{
(void)c;
IWDG_KR = IWDG_KR_KEY_REFRESH; // reset watchdog
#if DEBUG
while (!UART1->SR.fields.TXE); // wait until TX buffer is empty
UART1->DR.reg = c; // put character in buffer to be transmitted
// don't wait until the transmission is complete
#endif
}
// enable/disable UART debug
//#define puts(X) {}
#define puts(X) puts_uart(X)
void puts_uart(const char* s)
void puts(const char* s)
{
if (NULL == s) {
return;
}
while (*s) {
putc(*s++);
IWDG_KR = IWDG_KR_KEY_REFRESH; // reset watchdog
}
}
@ -81,10 +83,11 @@ void putn(uint8_t n)
{
n &= 0x0f; // ensure it's a nibble
if (n < 0xa) {
putc('0' + n);
n += '0';
} else {
putc('a' + (n - 0x0a));
n = 'a' + (n - 0x0a);
}
putc(n);
}
void puth(uint8_t h)