92cda14f |
1 | /* |
2 | Copyright 2014 Jun Wako <wakojun@gmail.com> |
3 | |
4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by |
6 | the Free Software Foundation, either version 2 of the License, or |
7 | (at your option) any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | |
18 | #ifndef CONFIG_H |
19 | #define CONFIG_H |
20 | |
21 | #define VENDOR_ID 0xFEED |
22 | #define PRODUCT_ID 0x5C01 |
23 | #define DEVICE_VER 0x0100 |
24 | #define MANUFACTURER t.m.k. |
25 | #define PRODUCT ASCII keyboard converter |
26 | #define DESCRIPTION converts Serial Console Terminal into USB keyboard |
27 | |
28 | |
29 | /* matrix size */ |
30 | #define MATRIX_ROWS 16 |
31 | #define MATRIX_COLS 16 |
32 | |
33 | /* key combination for command */ |
34 | #define IS_COMMAND() ( \ |
35 | host_get_first_key() == KC_BRK \ |
36 | ) |
37 | |
38 | |
39 | /* |
40 | * Serial(USART) configuration |
41 | * asynchronous, positive logic, 19200baud, bit order: LSB first |
42 | * 1-start bit, 8-data bit, odd parity, 1-stop bit |
43 | */ |
44 | #ifdef __AVR_ATmega32U4__ |
45 | #define SERIAL_UART_BAUD 19200 |
46 | #define SERIAL_UART_DATA UDR1 |
47 | #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) |
48 | #define SERIAL_UART_RXD_VECT USART1_RX_vect |
49 | #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1)) |
50 | #define SERIAL_UART_INIT() do { \ |
51 | UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \ |
52 | UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \ |
53 | UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \ |
54 | UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \ |
55 | UCSR1C |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \ |
56 | sei(); \ |
57 | } while(0) |
58 | #else |
59 | #error "USART configuration is needed." |
60 | #endif |
61 | |
62 | /* disable action features */ |
63 | #define NO_ACTION_LAYER |
64 | #define NO_ACTION_TAPPING |
65 | #define NO_ACTION_ONESHOT |
66 | #define NO_ACTION_MACRO |
67 | #define NO_ACTION_FUNCTION |
68 | |
69 | |
70 | #endif |