]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/config_common.h
Backlight abstraction and other changes (#439)
[qmk_firmware.git] / quantum / config_common.h
1 #ifndef CONFIG_DEFINITIONS_H
2 #define CONFIG_DEFINITIONS_H
3
4 /* diode directions */
5 #define COL2ROW 0
6 #define ROW2COL 1
7 /* I/O pins */
8 #define B0 0x30
9 #define B1 0x31
10 #define B2 0x32
11 #define B3 0x33
12 #define B4 0x34
13 #define B5 0x35
14 #define B6 0x36
15 #define B7 0x37
16 #define C0 0x60
17 #define C1 0x61
18 #define C2 0x62
19 #define C3 0x63
20 #define C4 0x64
21 #define C5 0x65
22 #define C6 0x66
23 #define C7 0x67
24 #define D0 0x90
25 #define D1 0x91
26 #define D2 0x92
27 #define D3 0x93
28 #define D4 0x94
29 #define D5 0x95
30 #define D6 0x96
31 #define D7 0x97
32 #define E0 0xC0
33 #define E1 0xC1
34 #define E2 0xC2
35 #define E3 0xC3
36 #define E4 0xC4
37 #define E5 0xC5
38 #define E6 0xC6
39 #define E7 0xC7
40 #define F0 0xF0
41 #define F1 0xF1
42 #define F2 0xF2
43 #define F3 0xF3
44 #define F4 0xF4
45 #define F5 0xF5
46 #define F6 0xF6
47 #define F7 0xF7
48
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 { \
58             /* baud rate */ \
59             UBRR1L = SERIAL_UART_UBRR; \
60             /* baud rate */ \
61             UBRR1H = SERIAL_UART_UBRR >> 8; \
62             /* enable TX */ \
63             UCSR1B = _BV(TXEN1); \
64             /* 8-bit data */ \
65             UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
66             sei(); \
67         } while(0)
68 #   else
69 #       error "USART configuration is needed."
70 #endif
71
72 // I'm fairly sure these aren't needed, but oh well - Jack
73
74 /*
75  * PS/2 Interrupt configuration
76  */
77 #ifdef PS2_USE_INT
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
83
84 #define PS2_DATA_PORT   PORTD
85 #define PS2_DATA_PIN    PIND
86 #define PS2_DATA_DDR    DDRD
87 #define PS2_DATA_BIT    0
88
89 #define PS2_INT_INIT()  do {    \
90     EICRA |= ((1<<ISC11) |      \
91               (0<<ISC10));      \
92 } while (0)
93 #define PS2_INT_ON()  do {      \
94     EIMSK |= (1<<INT1);         \
95 } while (0)
96 #define PS2_INT_OFF() do {      \
97     EIMSK &= ~(1<<INT1);        \
98 } while (0)
99 #define PS2_INT_VECT    INT1_vect
100 #endif
101
102 /*
103  * PS/2 Busywait configuration
104  */
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
110
111 #define PS2_DATA_PORT   PORTD
112 #define PS2_DATA_PIN    PIND
113 #define PS2_DATA_DDR    DDRD
114 #define PS2_DATA_BIT    0
115 #endif
116
117 #endif
118
119 #endif