aboutsummaryrefslogtreecommitdiff
path: root/quantum/config_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/config_common.h')
-rw-r--r--quantum/config_common.h132
1 files changed, 72 insertions, 60 deletions
diff --git a/quantum/config_common.h b/quantum/config_common.h
index da53fce89..8ed5f4a10 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -1,70 +1,83 @@
1#ifndef CONFIG_DEFINITIONS_H 1#ifndef CONFIG_DEFINITIONS_H
2#define CONFIG_DEFINITIONS_H 2#define CONFIG_DEFINITIONS_H
3 3
4#define B0 0x20 4/* diode directions */
5#define B1 0x21 5#define COL2ROW 0
6#define B2 0x22 6#define ROW2COL 1
7#define B3 0x23 7/* I/O pins */
8#define B4 0x24 8#define B0 0x30
9#define B5 0x25 9#define B1 0x31
10#define B6 0x26 10#define B2 0x32
11#define B7 0x27 11#define B3 0x33
12#define C0 0x30 12#define B4 0x34
13#define C1 0x31 13#define B5 0x35
14#define C2 0x32 14#define B6 0x36
15#define C3 0x33 15#define B7 0x37
16#define C4 0x34 16#define C0 0x60
17#define C5 0x35 17#define C1 0x61
18#define C6 0x36 18#define C2 0x62
19#define C7 0x37 19#define C3 0x63
20#define D0 0x40 20#define C4 0x64
21#define D1 0x41 21#define C5 0x65
22#define D2 0x42 22#define C6 0x66
23#define D3 0x43 23#define C7 0x67
24#define D4 0x44 24#define D0 0x90
25#define D5 0x45 25#define D1 0x91
26#define D6 0x46 26#define D2 0x92
27#define D7 0x47 27#define D3 0x93
28#define E0 0x50 28#define D4 0x94
29#define E1 0x51 29#define D5 0x95
30#define E2 0x52 30#define D6 0x96
31#define E3 0x53 31#define D7 0x97
32#define E4 0x54 32#define E0 0xC0
33#define E5 0x55 33#define E1 0xC1
34#define E6 0x56 34#define E2 0xC2
35#define E7 0x57 35#define E3 0xC3
36#define F0 0x60 36#define E4 0xC4
37#define F1 0x61 37#define E5 0xC5
38#define F2 0x62 38#define E6 0xC6
39#define F3 0x63 39#define E7 0xC7
40#define F4 0x64 40#define F0 0xF0
41#define F5 0x65 41#define F1 0xF1
42#define F6 0x66 42#define F2 0xF2
43#define F7 0x67 43#define F3 0xF3
44#define F4 0xF4
45#define F5 0xF5
46#define F6 0xF6
47#define F7 0xF7
48#define A0 0x00
49#define A1 0x01
50#define A2 0x02
51#define A3 0x03
52#define A4 0x04
53#define A5 0x05
54#define A6 0x06
55#define A7 0x07
44 56
45#define COL2ROW 0x0
46#define ROW2COL 0x1
47 57
58/* USART configuration */
48#ifdef BLUETOOTH_ENABLE 59#ifdef BLUETOOTH_ENABLE
49#ifdef __AVR_ATmega32U4__ 60# ifdef __AVR_ATmega32U4__
50 #define SERIAL_UART_BAUD 9600 61# define SERIAL_UART_BAUD 9600
51 #define SERIAL_UART_DATA UDR1 62# define SERIAL_UART_DATA UDR1
52 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) 63# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
53 #define SERIAL_UART_RXD_VECT USART1_RX_vect 64# define SERIAL_UART_RXD_VECT USART1_RX_vect
54 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1)) 65# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
55 #define SERIAL_UART_INIT() do { \ 66# define SERIAL_UART_INIT() do { \
56 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \ 67 /* baud rate */ \
57 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \ 68 UBRR1L = SERIAL_UART_UBRR; \
58 UCSR1B = (1<<TXEN1); /* TX: enable */ \ 69 /* baud rate */ \
59 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \ 70 UBRR1H = SERIAL_UART_UBRR >> 8; \
60 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \ 71 /* enable TX */ \
61 sei(); \ 72 UCSR1B = _BV(TXEN1); \
62 } while(0) 73 /* 8-bit data */ \
63#else 74 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
64# error "USART configuration is needed." 75 sei(); \
76 } while(0)
77# else
78# error "USART configuration is needed."
65#endif 79#endif
66 80
67
68// I'm fairly sure these aren't needed, but oh well - Jack 81// I'm fairly sure these aren't needed, but oh well - Jack
69 82
70/* 83/*
@@ -113,4 +126,3 @@
113#endif 126#endif
114 127
115#endif 128#endif
116