]> git.gir.st - tmk_keyboard.git/blob - converter/sun_usb/config.h
Merge commit '71381457fa1311dfa0b58ba882a96db740640871'
[tmk_keyboard.git] / converter / sun_usb / config.h
1 /*
2 Copyright 2012 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 0x3333
23 #define DEVICE_VER 0x0100
24 #define MANUFACTURER t.m.k.
25 #define PRODUCT Sun keyboard converter
26 #define DESCRIPTION converts Sun keyboard protocol into USB
27
28 /* matrix size */
29 #define MATRIX_ROWS 16
30 #define MATRIX_COLS 8
31
32 /* key combination for command */
33 #define IS_COMMAND() ( \
34 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
35 keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
36 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
37 )
38
39 /* legacy keymap support */
40 #define USE_LEGACY_KEYMAP
41
42
43 /* Serial(USART) configuration
44 * asynchronous, negative logic, 1200baud, no flow control
45 * 1-start bit, 8-data bit, non parity, 1-stop bit
46 */
47 #define SERIAL_SOFT_BAUD 1200
48 #define SERIAL_SOFT_PARITY_NONE
49 #define SERIAL_SOFT_BIT_ORDER_LSB
50 #define SERIAL_SOFT_LOGIC_NEGATIVE
51 /* RXD Port */
52 #define SERIAL_SOFT_RXD_ENABLE
53 #define SERIAL_SOFT_RXD_DDR DDRD
54 #define SERIAL_SOFT_RXD_PORT PORTD
55 #define SERIAL_SOFT_RXD_PIN PIND
56 #define SERIAL_SOFT_RXD_BIT 2
57 #define SERIAL_SOFT_RXD_VECT INT2_vect
58 /* RXD Interupt */
59 #ifdef SERIAL_SOFT_LOGIC_NEGATIVE
60 /* enable interrupt: INT2(rising edge) */
61 #define INTR_TRIG_EDGE ((1<<ISC21)|(1<<ISC20))
62 #else
63 /* enable interrupt: INT2(falling edge) */
64 #define INTR_TRIG_EDGE ((1<<ISC21)|(0<<ISC20))
65 #endif
66 #define SERIAL_SOFT_RXD_INIT() do { \
67 /* pin configuration: input with pull-up */ \
68 SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
69 SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
70 EICRA |= INTR_TRIG_EDGE; \
71 EIMSK |= (1<<INT2); \
72 sei(); \
73 } while (0)
74 #define SERIAL_SOFT_RXD_INT_ENTER()
75 #define SERIAL_SOFT_RXD_INT_EXIT() do { \
76 /* clear interrupt flag */ \
77 EIFR = (1<<INTF2); \
78 } while (0)
79 #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
80 /* TXD Port */
81 #define SERIAL_SOFT_TXD_ENABLE
82 #define SERIAL_SOFT_TXD_DDR DDRD
83 #define SERIAL_SOFT_TXD_PORT PORTD
84 #define SERIAL_SOFT_TXD_PIN PIND
85 #define SERIAL_SOFT_TXD_BIT 3
86 #define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
87 #define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
88 #define SERIAL_SOFT_TXD_INIT() do { \
89 /* pin configuration: output */ \
90 SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
91 /* idle */ \
92 SERIAL_SOFT_TXD_ON(); \
93 } while (0)
94
95 #endif
Imprint / Impressum