1 #ifndef CONFIG_DEFINITIONS_H
2 #define CONFIG_DEFINITIONS_H
59 /* USART configuration */
60 #ifdef BLUETOOTH_ENABLE
61 # ifdef __AVR_ATmega32U4__
62 # define SERIAL_UART_BAUD 9600
63 # define SERIAL_UART_DATA UDR1
64 # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
65 # define SERIAL_UART_RXD_VECT USART1_RX_vect
66 # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
67 # define SERIAL_UART_INIT() do { \
69 UBRR1L = SERIAL_UART_UBRR; \
71 UBRR1H = SERIAL_UART_UBRR >> 8; \
73 UCSR1B = _BV(TXEN1); \
75 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
79 # error "USART configuration is needed."
82 // I'm fairly sure these aren't needed, but oh well - Jack
85 * PS/2 Interrupt configuration
88 /* uses INT1 for clock line(ATMega32U4) */
89 #define PS2_CLOCK_PORT PORTD
90 #define PS2_CLOCK_PIN PIND
91 #define PS2_CLOCK_DDR DDRD
92 #define PS2_CLOCK_BIT 1
94 #define PS2_DATA_PORT PORTD
95 #define PS2_DATA_PIN PIND
96 #define PS2_DATA_DDR DDRD
97 #define PS2_DATA_BIT 0
99 #define PS2_INT_INIT() do { \
100 EICRA |= ((1<<ISC11) | \
103 #define PS2_INT_ON() do { \
104 EIMSK |= (1<<INT1); \
106 #define PS2_INT_OFF() do { \
107 EIMSK &= ~(1<<INT1); \
109 #define PS2_INT_VECT INT1_vect
113 * PS/2 Busywait configuration
115 #ifdef PS2_USE_BUSYWAIT
116 #define PS2_CLOCK_PORT PORTD
117 #define PS2_CLOCK_PIN PIND
118 #define PS2_CLOCK_DDR DDRD
119 #define PS2_CLOCK_BIT 1
121 #define PS2_DATA_PORT PORTD
122 #define PS2_DATA_PIN PIND
123 #define PS2_DATA_DDR DDRD
124 #define PS2_DATA_BIT 0