1 #ifndef CONFIG_DEFINITIONS_H
2 #define CONFIG_DEFINITIONS_H
49 /* USART configuration */
50 #ifdef BLUETOOTH_ENABLE
51 # ifdef __AVR_ATmega32U4__
52 # define SERIAL_UART_BAUD 9600
53 # define SERIAL_UART_DATA UDR1
54 # define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
55 # define SERIAL_UART_RXD_VECT USART1_RX_vect
56 # define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
57 # define SERIAL_UART_INIT() do { \
59 UBRR1L = SERIAL_UART_UBRR; \
61 UBRR1H = SERIAL_UART_UBRR >> 8; \
63 UCSR1B = _BV(TXEN1); \
65 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
69 # error "USART configuration is needed."
72 // I'm fairly sure these aren't needed, but oh well - Jack
75 * PS/2 Interrupt configuration
78 /* uses INT1 for clock line(ATMega32U4) */
79 #define PS2_CLOCK_PORT PORTD
80 #define PS2_CLOCK_PIN PIND
81 #define PS2_CLOCK_DDR DDRD
82 #define PS2_CLOCK_BIT 1
84 #define PS2_DATA_PORT PORTD
85 #define PS2_DATA_PIN PIND
86 #define PS2_DATA_DDR DDRD
87 #define PS2_DATA_BIT 0
89 #define PS2_INT_INIT() do { \
90 EICRA |= ((1<<ISC11) | \
93 #define PS2_INT_ON() do { \
96 #define PS2_INT_OFF() do { \
97 EIMSK &= ~(1<<INT1); \
99 #define PS2_INT_VECT INT1_vect
103 * PS/2 Busywait configuration
105 #ifdef PS2_USE_BUSYWAIT
106 #define PS2_CLOCK_PORT PORTD
107 #define PS2_CLOCK_PIN PIND
108 #define PS2_CLOCK_DDR DDRD
109 #define PS2_CLOCK_BIT 1
111 #define PS2_DATA_PORT PORTD
112 #define PS2_DATA_PIN PIND
113 #define PS2_DATA_DDR DDRD
114 #define PS2_DATA_BIT 0