]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - ps2_usb/sendchar_usart.c
fe18177a3c17b0edc8713e3c3bfdede7c0a6305d
[max/tmk_keyboard.git] / ps2_usb / sendchar_usart.c
1 #include <stdint.h>
2 #include "oddebug.h"
3 #include "sendchar.h"
4
5
6 /* from oddebug.h */
7 #if defined UBRR
8 #   define  ODDBG_UBRR  UBRR
9 #elif defined UBRRL
10 #   define  ODDBG_UBRR  UBRRL
11 #elif defined UBRR0
12 #   define  ODDBG_UBRR  UBRR0
13 #elif defined UBRR0L
14 #   define  ODDBG_UBRR  UBRR0L
15 #endif
16
17 #if defined UCR
18 #   define  ODDBG_UCR   UCR
19 #elif defined UCSRB
20 #   define  ODDBG_UCR   UCSRB
21 #elif defined UCSR0B
22 #   define  ODDBG_UCR   UCSR0B
23 #endif
24
25 #if defined TXEN
26 #   define  ODDBG_TXEN  TXEN
27 #else
28 #   define  ODDBG_TXEN  TXEN0
29 #endif
30
31 #if defined USR
32 #   define  ODDBG_USR   USR
33 #elif defined UCSRA
34 #   define  ODDBG_USR   UCSRA
35 #elif defined UCSR0A
36 #   define  ODDBG_USR   UCSR0A
37 #endif
38
39 #if defined UDRE
40 #   define  ODDBG_UDRE  UDRE
41 #else
42 #   define  ODDBG_UDRE  UDRE0
43 #endif
44
45 #if defined UDR
46 #   define  ODDBG_UDR   UDR
47 #elif defined UDR0
48 #   define  ODDBG_UDR   UDR0
49 #endif
50
51
52 /* from oddebug.c */
53 int8_t sendchar(uint8_t c)
54 {
55     while(!(ODDBG_USR & (1 << ODDBG_UDRE)));    /* wait for data register empty */
56     ODDBG_UDR = c;
57     return 1;
58 }