summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/vusb/usbdrv/oddebug.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/vusb/usbdrv/oddebug.h')
-rw-r--r--tmk_core/protocol/vusb/usbdrv/oddebug.h114
1 files changed, 56 insertions, 58 deletions
diff --git a/tmk_core/protocol/vusb/usbdrv/oddebug.h b/tmk_core/protocol/vusb/usbdrv/oddebug.h
index d61309daac..f93f338794 100644
--- a/tmk_core/protocol/vusb/usbdrv/oddebug.h
+++ b/tmk_core/protocol/vusb/usbdrv/oddebug.h
@@ -23,39 +23,38 @@ A debug log consists of a label ('prefix') to indicate which debug log created
the output and a memory block to dump in hex ('data' and 'len').
*/
-
#ifndef F_CPU
-# define F_CPU 12000000 /* 12 MHz */
+# define F_CPU 12000000 /* 12 MHz */
#endif
/* make sure we have the UART defines: */
#include "usbportability.h"
#ifndef uchar
-# define uchar unsigned char
+# define uchar unsigned char
#endif
#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */
-# warning "Debugging disabled because device has no UART"
-# undef DEBUG_LEVEL
+# warning "Debugging disabled because device has no UART"
+# undef DEBUG_LEVEL
#endif
#ifndef DEBUG_LEVEL
-# define DEBUG_LEVEL 0
+# define DEBUG_LEVEL 0
#endif
/* ------------------------------------------------------------------------- */
#if DEBUG_LEVEL > 0
-# define DBG1(prefix, data, len) odDebug(prefix, data, len)
+# define DBG1(prefix, data, len) odDebug(prefix, data, len)
#else
-# define DBG1(prefix, data, len)
+# define DBG1(prefix, data, len)
#endif
#if DEBUG_LEVEL > 1
-# define DBG2(prefix, data, len) odDebug(prefix, data, len)
+# define DBG2(prefix, data, len) odDebug(prefix, data, len)
#else
-# define DBG2(prefix, data, len)
+# define DBG2(prefix, data, len)
#endif
/* ------------------------------------------------------------------------- */
@@ -65,57 +64,56 @@ extern void odDebug(uchar prefix, uchar *data, uchar len);
/* Try to find our control registers; ATMEL likes to rename these */
-#if defined UBRR
-# define ODDBG_UBRR UBRR
-#elif defined UBRRL
-# define ODDBG_UBRR UBRRL
-#elif defined UBRR0
-# define ODDBG_UBRR UBRR0
-#elif defined UBRR0L
-# define ODDBG_UBRR UBRR0L
-#endif
-
-#if defined UCR
-# define ODDBG_UCR UCR
-#elif defined UCSRB
-# define ODDBG_UCR UCSRB
-#elif defined UCSR0B
-# define ODDBG_UCR UCSR0B
-#endif
-
-#if defined TXEN
-# define ODDBG_TXEN TXEN
-#else
-# define ODDBG_TXEN TXEN0
-#endif
-
-#if defined USR
-# define ODDBG_USR USR
-#elif defined UCSRA
-# define ODDBG_USR UCSRA
-#elif defined UCSR0A
-# define ODDBG_USR UCSR0A
-#endif
-
-#if defined UDRE
-# define ODDBG_UDRE UDRE
-#else
-# define ODDBG_UDRE UDRE0
-#endif
-
-#if defined UDR
-# define ODDBG_UDR UDR
-#elif defined UDR0
-# define ODDBG_UDR UDR0
-#endif
-
-static inline void odDebugInit(void)
-{
- ODDBG_UCR |= (1<<ODDBG_TXEN);
+# if defined UBRR
+# define ODDBG_UBRR UBRR
+# elif defined UBRRL
+# define ODDBG_UBRR UBRRL
+# elif defined UBRR0
+# define ODDBG_UBRR UBRR0
+# elif defined UBRR0L
+# define ODDBG_UBRR UBRR0L
+# endif
+
+# if defined UCR
+# define ODDBG_UCR UCR
+# elif defined UCSRB
+# define ODDBG_UCR UCSRB
+# elif defined UCSR0B
+# define ODDBG_UCR UCSR0B
+# endif
+
+# if defined TXEN
+# define ODDBG_TXEN TXEN
+# else
+# define ODDBG_TXEN TXEN0
+# endif
+
+# if defined USR
+# define ODDBG_USR USR
+# elif defined UCSRA
+# define ODDBG_USR UCSRA
+# elif defined UCSR0A
+# define ODDBG_USR UCSR0A
+# endif
+
+# if defined UDRE
+# define ODDBG_UDRE UDRE
+# else
+# define ODDBG_UDRE UDRE0
+# endif
+
+# if defined UDR
+# define ODDBG_UDR UDR
+# elif defined UDR0
+# define ODDBG_UDR UDR0
+# endif
+
+static inline void odDebugInit(void) {
+ ODDBG_UCR |= (1 << ODDBG_TXEN);
ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
}
#else
-# define odDebugInit()
+# define odDebugInit()
#endif
/* ------------------------------------------------------------------------- */