diff options
Diffstat (limited to 'keyboards/converter/sun_usb/config.h')
-rw-r--r-- | keyboards/converter/sun_usb/config.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/keyboards/converter/sun_usb/config.h b/keyboards/converter/sun_usb/config.h new file mode 100644 index 000000000..c67ae5eba --- /dev/null +++ b/keyboards/converter/sun_usb/config.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | Copyright 2012 Jun Wako <[email protected]> | ||
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 | #pragma once | ||
19 | |||
20 | #define VENDOR_ID 0xFEED | ||
21 | #define PRODUCT_ID 0x3333 | ||
22 | #define DEVICE_VER 0x0100 | ||
23 | #define MANUFACTURER QMK | ||
24 | #define PRODUCT Sun keyboard converter | ||
25 | |||
26 | /* matrix size */ | ||
27 | #define MATRIX_ROWS 16 | ||
28 | #define MATRIX_COLS 8 | ||
29 | |||
30 | /* key combination for command */ | ||
31 | #define IS_COMMAND() ( \ | ||
32 | get_mods() == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \ | ||
33 | get_mods() == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \ | ||
34 | get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
35 | ) | ||
36 | |||
37 | |||
38 | /* Serial(USART) configuration | ||
39 | * asynchronous, negative logic, 1200baud, no flow control | ||
40 | * 1-start bit, 8-data bit, non parity, 1-stop bit | ||
41 | */ | ||
42 | #define SERIAL_SOFT_BAUD 1200 | ||
43 | #define SERIAL_SOFT_PARITY_NONE | ||
44 | #define SERIAL_SOFT_BIT_ORDER_LSB | ||
45 | #define SERIAL_SOFT_LOGIC_NEGATIVE | ||
46 | /* RXD Port */ | ||
47 | #define SERIAL_SOFT_RXD_ENABLE | ||
48 | #define SERIAL_SOFT_RXD_DDR DDRD | ||
49 | #define SERIAL_SOFT_RXD_PORT PORTD | ||
50 | #define SERIAL_SOFT_RXD_PIN PIND | ||
51 | #define SERIAL_SOFT_RXD_BIT 2 | ||
52 | #define SERIAL_SOFT_RXD_VECT INT2_vect | ||
53 | /* RXD Interupt */ | ||
54 | #define SERIAL_SOFT_RXD_INIT() do { \ | ||
55 | /* pin configuration: input with pull-up */ \ | ||
56 | SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \ | ||
57 | SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \ | ||
58 | /* enable interrupt: INT2(rising edge) */ \ | ||
59 | EICRA |= ((1<<ISC21)|(1<<ISC20)); \ | ||
60 | EIMSK |= (1<<INT2); \ | ||
61 | sei(); \ | ||
62 | } while (0) | ||
63 | #define SERIAL_SOFT_RXD_INT_ENTER() | ||
64 | #define SERIAL_SOFT_RXD_INT_EXIT() do { \ | ||
65 | /* clear interrupt flag */ \ | ||
66 | EIFR = (1<<INTF2); \ | ||
67 | } while (0) | ||
68 | #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT)) | ||
69 | /* TXD Port */ | ||
70 | #define SERIAL_SOFT_TXD_ENABLE | ||
71 | #define SERIAL_SOFT_TXD_DDR DDRD | ||
72 | #define SERIAL_SOFT_TXD_PORT PORTD | ||
73 | #define SERIAL_SOFT_TXD_PIN PIND | ||
74 | #define SERIAL_SOFT_TXD_BIT 3 | ||
75 | #define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0) | ||
76 | #define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0) | ||
77 | #define SERIAL_SOFT_TXD_INIT() do { \ | ||
78 | /* pin configuration: output */ \ | ||
79 | SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \ | ||
80 | /* idle */ \ | ||
81 | SERIAL_SOFT_TXD_ON(); \ | ||
82 | } while (0) | ||