Merge pull request #81 from bgould/master
[tmk_keyboard.git] / converter / terminal_bluefruit / config.h
1 /*
2 Converter for 70% IBM Terminal Keyboard
3 Author: Benjamin Gould, 2013
4 Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef CONFIG_H
21 #define CONFIG_H
22
23
24 #define VENDOR_ID 0xFEED
25 #define PRODUCT_ID 0x6535
26 #define DEVICE_VER 0x0100
27 #define MANUFACTURER t.m.k.
28 #define PRODUCT 70% IBM Terminal Keyboard Converter w/ Bluetooth
29 #define DESCRIPTION USB converter for IBM Terminal Keyboard w/ Bluetooth
30
31
32 /* matrix size */
33 #define MATRIX_ROWS 17 // keycode bit: 3-0
34 #define MATRIX_COLS 8 // keycode bit: 6-4
35
36
37 /* legacy keymap support */
38 // #define USE_LEGACY_KEYMAP
39
40
41 /* key combination for command */
42 #define IS_COMMAND() ( \
43 (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
44 (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
45 )
46
47 /* USART configuration
48 * asynchronous, 9600baud, 8-data bit, non parity, 1-stop bit, no flow control
49 */
50 #ifdef __AVR_ATmega32U4__
51 #define SERIAL_UART_BAUD 9600
52 #define SERIAL_UART_DATA UDR1
53 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
54 #define SERIAL_UART_RXD_VECT USART1_RX_vect
55 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
56 #define SERIAL_UART_INIT() do { \
57 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
58 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
59 UCSR1B = (1<<TXEN1); /* TX: enable */ \
60 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
61 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
62 sei(); \
63 } while(0)
64 #else
65 # error "USART configuration is needed."
66 #endif
67
68 /*
69 * PS/2 Interrupt configuration
70 */
71 #ifdef PS2_USE_INT
72 /* uses INT1 for clock line(ATMega32U4) */
73 #define PS2_CLOCK_PORT PORTD
74 #define PS2_CLOCK_PIN PIND
75 #define PS2_CLOCK_DDR DDRD
76 #define PS2_CLOCK_BIT 1
77
78 #define PS2_DATA_PORT PORTD
79 #define PS2_DATA_PIN PIND
80 #define PS2_DATA_DDR DDRD
81 #define PS2_DATA_BIT 0
82
83 #define PS2_INT_INIT() do { \
84 EICRA |= ((1<<ISC11) | \
85 (0<<ISC10)); \
86 } while (0)
87 #define PS2_INT_ON() do { \
88 EIMSK |= (1<<INT1); \
89 } while (0)
90 #define PS2_INT_OFF() do { \
91 EIMSK &= ~(1<<INT1); \
92 } while (0)
93 #define PS2_INT_VECT INT1_vect
94 #endif
95
96
97 /*
98 * PS/2 Busywait configuration
99 */
100 #ifdef PS2_USE_BUSYWAIT
101 #define PS2_CLOCK_PORT PORTD
102 #define PS2_CLOCK_PIN PIND
103 #define PS2_CLOCK_DDR DDRD
104 #define PS2_CLOCK_BIT 1
105
106 #define PS2_DATA_PORT PORTD
107 #define PS2_DATA_PIN PIND
108 #define PS2_DATA_DDR DDRD
109 #define PS2_DATA_BIT 0
110 #endif
111
112 #endif
Imprint / Impressum