1 #ifndef CONFIG_DEFINITIONS_H
2 #define CONFIG_DEFINITIONS_H
58 /* USART configuration */
59 #ifdef BLUETOOTH_ENABLE
60 # ifdef __AVR_ATmega32U4__
61 # define SERIAL_UART_BAUD 9600
62 # define SERIAL_UART_DATA UDR1
63 # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
64 # define SERIAL_UART_RXD_VECT USART1_RX_vect
65 # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
66 # define SERIAL_UART_INIT() do { \
68 UBRR1L = SERIAL_UART_UBRR; \
70 UBRR1H = SERIAL_UART_UBRR >> 8; \
72 UCSR1B = _BV(TXEN1); \
74 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
78 # error "USART configuration is needed."
81 // I'm fairly sure these aren't needed, but oh well - Jack
84 * PS/2 Interrupt configuration
87 /* uses INT1 for clock line(ATMega32U4) */
88 #define PS2_CLOCK_PORT PORTD
89 #define PS2_CLOCK_PIN PIND
90 #define PS2_CLOCK_DDR DDRD
91 #define PS2_CLOCK_BIT 1
93 #define PS2_DATA_PORT PORTD
94 #define PS2_DATA_PIN PIND
95 #define PS2_DATA_DDR DDRD
96 #define PS2_DATA_BIT 0
98 #define PS2_INT_INIT() do { \
99 EICRA |= ((1<<ISC11) | \
102 #define PS2_INT_ON() do { \
103 EIMSK |= (1<<INT1); \
105 #define PS2_INT_OFF() do { \
106 EIMSK &= ~(1<<INT1); \
108 #define PS2_INT_VECT INT1_vect
112 * PS/2 Busywait configuration
114 #ifdef PS2_USE_BUSYWAIT
115 #define PS2_CLOCK_PORT PORTD
116 #define PS2_CLOCK_PIN PIND
117 #define PS2_CLOCK_DDR DDRD
118 #define PS2_CLOCK_BIT 1
120 #define PS2_DATA_PORT PORTD
121 #define PS2_DATA_PIN PIND
122 #define PS2_DATA_DDR DDRD
123 #define PS2_DATA_BIT 0