1 #ifndef CONFIG_DEFINITIONS_H
2 #define CONFIG_DEFINITIONS_H
48 #ifdef BLUETOOTH_ENABLE
49 #ifdef __AVR_ATmega32U4__
50 #define SERIAL_UART_BAUD 9600
51 #define SERIAL_UART_DATA UDR1
52 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
53 #define SERIAL_UART_RXD_VECT USART1_RX_vect
54 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
55 #define SERIAL_UART_INIT() do { \
56 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
57 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
58 UCSR1B = (1<<TXEN1); /* TX: enable */ \
59 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
60 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
64 # error "USART configuration is needed."
68 // I'm fairly sure these aren't needed, but oh well - Jack
71 * PS/2 Interrupt configuration
74 /* uses INT1 for clock line(ATMega32U4) */
75 #define PS2_CLOCK_PORT PORTD
76 #define PS2_CLOCK_PIN PIND
77 #define PS2_CLOCK_DDR DDRD
78 #define PS2_CLOCK_BIT 1
80 #define PS2_DATA_PORT PORTD
81 #define PS2_DATA_PIN PIND
82 #define PS2_DATA_DDR DDRD
83 #define PS2_DATA_BIT 0
85 #define PS2_INT_INIT() do { \
86 EICRA |= ((1<<ISC11) | \
89 #define PS2_INT_ON() do { \
92 #define PS2_INT_OFF() do { \
93 EIMSK &= ~(1<<INT1); \
95 #define PS2_INT_VECT INT1_vect
99 * PS/2 Busywait configuration
101 #ifdef PS2_USE_BUSYWAIT
102 #define PS2_CLOCK_PORT PORTD
103 #define PS2_CLOCK_PIN PIND
104 #define PS2_CLOCK_DDR DDRD
105 #define PS2_CLOCK_BIT 1
107 #define PS2_DATA_PORT PORTD
108 #define PS2_DATA_PIN PIND
109 #define PS2_DATA_DDR DDRD
110 #define PS2_DATA_BIT 0