makes GPIO_PIN_RST optional for the sx1276
[ExpressLRS.git] / src / lib / logging / logging.cpp
blobe06b096efbf6f09e424790bc4f23399a8d74bbcb
1 #include "targets.h"
2 #include <cstdarg>
3 #include "logging.h"
5 #ifdef LOG_USE_PROGMEM
6 #define GETCHAR pgm_read_byte(fmt)
7 #else
8 #define GETCHAR *fmt
9 #endif
11 void debugPrintf(const char* fmt, ...)
13 char c;
14 va_list vlist;
15 va_start(vlist,fmt);
17 c = GETCHAR;
18 while(c) {
19 if (c == '%') {
20 fmt++;
21 c = GETCHAR;
22 switch (c) {
23 case 's':
24 LOGGING_UART.print(va_arg(vlist,const char *));
25 break;
26 case 'd':
27 LOGGING_UART.print(va_arg(vlist,int32_t), DEC);
28 break;
29 case 'u':
30 LOGGING_UART.print(va_arg(vlist,uint32_t), DEC);
31 break;
32 case 'x':
33 LOGGING_UART.print(va_arg(vlist,uint32_t), HEX);
34 break;
35 default:
36 break;
38 } else {
39 LOGGING_UART.write(c);
41 fmt++;
42 c = GETCHAR;
44 va_end(vlist);