2 Copyright 2012 Jun Wako <wakojun@gmail.com>
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.
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.
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/>.
18 /* This code makes use of cy384's Arduino USB HID adapter for the Palm Portable
19 Keyboard, released under the BSD licence */
26 #define CUSTOM_MATRIX 2
28 #define VENDOR_ID 0xFEED
29 #define PRODUCT_ID 0x0001
30 #define DEVICE_VER 0x0100
31 #define MANUFACTURER QMK
32 #define PRODUCT Stowaway converter
33 #define DESCRIPTION USB converter for Stowaway keyboard
36 // https://deskthority.net/wiki/Arduino_Pro_Micro for pin lookup
37 #define VCC_PIN D1 // pro micro 2
38 #define RX_PIN D0 //pro micro 3 , was 8 on cy384
39 #define RTS_PIN C6 // 5 //[ was D4 // 4 on the cy384
40 #define DCD_PIN E6 //7
42 // if using the particular arduino pinout of CY384
44 #define GND_PIN D7 //6
45 #define PULLDOWN_PIN B1 // 15
49 // Set to 1 for Handspring or to disable RTS/DCD based handshake.
53 #define MAXDROP 10 // check if keyboard is connected every X polling cycles
54 #define SLEEP_TIMEOUT 500000 // check keyboard/reset this many millis
57 #define MATRIX_ROWS 12
60 /* key combination for command */
61 #define IS_COMMAND() ( \
62 get_mods() == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
63 get_mods() == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
64 get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
68 /* Serial(USART) configuration
69 * asynchronous, negative logic, 9600baud, no flow control
70 * 1-start bit, 8-data bit, non parity, 1-stop bit
72 #define SERIAL_SOFT_BAUD 9600
73 #define SERIAL_SOFT_PARITY_NONE
74 #define SERIAL_SOFT_BIT_ORDER_LSB
76 #define SERIAL_SOFT_LOGIC_NEGATIVE //RS232 logic
79 #define SERIAL_SOFT_RXD_ENABLE
81 // we are using Pro micro pin 3 / D0 as serial
82 #define SERIAL_SOFT_RXD_DDR DDRD
83 #define SERIAL_SOFT_RXD_PORT PORTD
84 #define SERIAL_SOFT_RXD_PIN PIND
85 #define SERIAL_SOFT_RXD_BIT 0
86 #define SERIAL_SOFT_RXD_VECT INT0_vect
89 #define SERIAL_SOFT_RXD_INIT() do { \
90 /* pin configuration: input with pull-up */ \
91 SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
92 SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
93 /* enable interrupt: INT0(rising edge) */ \
94 EICRA |= ((1<<ISC01)|(1<<ISC00)); \
98 #define SERIAL_SOFT_RXD_INT_ENTER()
99 #define SERIAL_SOFT_RXD_INT_EXIT() do { \
100 /* clear interrupt flag */ \
103 #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
106 #define SERIAL_SOFT_TXD_ENABLE
107 #define SERIAL_SOFT_TXD_DDR DDRD
108 #define SERIAL_SOFT_TXD_PORT PORTD
109 #define SERIAL_SOFT_TXD_PIN PIND
110 #define SERIAL_SOFT_TXD_BIT 3
111 #define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
112 #define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
113 #define SERIAL_SOFT_TXD_INIT() do { \
114 /* pin configuration: output */ \
115 SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
117 SERIAL_SOFT_TXD_ON(); \