aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/print.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/print.h')
-rw-r--r--tmk_core/common/print.h42
1 files changed, 36 insertions, 6 deletions
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h
index 8836c0fc7..2d7184bd0 100644
--- a/tmk_core/common/print.h
+++ b/tmk_core/common/print.h
@@ -29,7 +29,7 @@
29#include <stdbool.h> 29#include <stdbool.h>
30#include "util.h" 30#include "util.h"
31 31
32#if defined(PROTOCOL_CHIBIOS) 32#if defined(PROTOCOL_CHIBIOS) || defined(PROTOCOL_ARM_ATSAM)
33#define PSTR(x) x 33#define PSTR(x) x
34#endif 34#endif
35 35
@@ -60,7 +60,7 @@
60# define println(s) xputs(PSTR(s "\r\n")) 60# define println(s) xputs(PSTR(s "\r\n"))
61# define uprint(s) print(s) 61# define uprint(s) print(s)
62# define uprintln(s) println(s) 62# define uprintln(s) println(s)
63# define uprintf(fmt, ...) xprintf(fmt, ...) 63# define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)
64 64
65# endif /* USER_PRINT / NORMAL PRINT */ 65# endif /* USER_PRINT / NORMAL PRINT */
66 66
@@ -73,7 +73,9 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t));
73 73
74#elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */ 74#elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */
75 75
76#ifndef TERMINAL_ENABLE
76# include "chibios/printf.h" 77# include "chibios/printf.h"
78#endif
77 79
78# ifdef USER_PRINT /* USER_PRINT */ 80# ifdef USER_PRINT /* USER_PRINT */
79 81
@@ -99,6 +101,34 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t));
99 101
100# endif /* USER_PRINT / NORMAL PRINT */ 102# endif /* USER_PRINT / NORMAL PRINT */
101 103
104#elif defined(PROTOCOL_ARM_ATSAM) /* PROTOCOL_ARM_ATSAM */
105
106# include "arm_atsam/printf.h"
107
108# ifdef USER_PRINT /* USER_PRINT */
109
110// Remove normal print defines
111# define print(s)
112# define println(s)
113# define xprintf(fmt, ...)
114
115// Create user print defines
116# define uprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
117# define uprint(s) xprintf(s)
118# define uprintln(s) xprintf(s "\r\n")
119
120# else /* NORMAL PRINT */
121
122// Create user & normal print defines
123# define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
124# define print(s) xprintf(s)
125# define println(s) xprintf(s "\r\n")
126# define uprint(s) print(s)
127# define uprintln(s) println(s)
128# define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)
129
130# endif /* USER_PRINT / NORMAL PRINT */
131
102#elif defined(__arm__) /* __arm__ */ 132#elif defined(__arm__) /* __arm__ */
103 133
104# include "mbed/xprintf.h" 134# include "mbed/xprintf.h"
@@ -111,26 +141,26 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t));
111# define xprintf(fmt, ...) 141# define xprintf(fmt, ...)
112 142
113// Create user print defines 143// Create user print defines
114# define uprintf(fmt, ...) __xprintf(fmt, ...) 144# define uprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
115# define uprint(s) xprintf(s) 145# define uprint(s) xprintf(s)
116# define uprintln(s) xprintf(s "\r\n") 146# define uprintln(s) xprintf(s "\r\n")
117 147
118# else /* NORMAL PRINT */ 148# else /* NORMAL PRINT */
119 149
120// Create user & normal print defines 150// Create user & normal print defines
121# define xprintf(fmt, ...) __xprintf(fmt, ...) 151# define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
122# define print(s) xprintf(s) 152# define print(s) xprintf(s)
123# define println(s) xprintf(s "\r\n") 153# define println(s) xprintf(s "\r\n")
124# define uprint(s) print(s) 154# define uprint(s) print(s)
125# define uprintln(s) println(s) 155# define uprintln(s) println(s)
126# define uprintf(fmt, ...) xprintf(fmt, ...) 156# define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)
127 157
128# endif /* USER_PRINT / NORMAL PRINT */ 158# endif /* USER_PRINT / NORMAL PRINT */
129 159
130/* TODO: to select output destinations: UART/USBSerial */ 160/* TODO: to select output destinations: UART/USBSerial */
131# define print_set_sendchar(func) 161# define print_set_sendchar(func)
132 162
133#endif /* __AVR__ / PROTOCOL_CHIBIOS / __arm__ */ 163#endif /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM / __arm__ */
134 164
135// User print disables the normal print messages in the body of QMK/TMK code and 165// User print disables the normal print messages in the body of QMK/TMK code and
136// is meant as a lightweight alternative to NOPRINT. Use it when you only want to do 166// is meant as a lightweight alternative to NOPRINT. Use it when you only want to do