aboutsummaryrefslogtreecommitdiff
path: root/keyboards/converter/palm_usb/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/converter/palm_usb/config.h')
-rw-r--r--keyboards/converter/palm_usb/config.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/keyboards/converter/palm_usb/config.h b/keyboards/converter/palm_usb/config.h
new file mode 100644
index 000000000..4afc654e8
--- /dev/null
+++ b/keyboards/converter/palm_usb/config.h
@@ -0,0 +1,117 @@
1/*
2Copyright 2012 Jun Wako <[email protected]>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/* This code makes use of cy384's Arduino USB HID adapter for the Palm Portable
19 Keyboard, released under the BSD licence */
20
21
22
23
24#pragma once
25
26#define VENDOR_ID 0xFEED
27#define PRODUCT_ID 0x0001
28#define DEVICE_VER 0x0100
29#define MANUFACTURER QMK
30#define PRODUCT Stowaway converter
31
32// IO pins to serial
33// https://deskthority.net/wiki/Arduino_Pro_Micro for pin lookup
34#define VCC_PIN D1 // pro micro 2
35#define RX_PIN D0 //pro micro 3 , was 8 on cy384
36#define RTS_PIN C6 // 5 //[ was D4 // 4 on the cy384
37#define DCD_PIN E6 //7
38
39// if using the particular arduino pinout of CY384
40#ifdef CY384
41 #define GND_PIN D7 //6
42 #define PULLDOWN_PIN B1 // 15
43#endif
44
45#ifndef HANDSPRING
46// Set to 1 for Handspring or to disable RTS/DCD based handshake.
47 #define HANDSPRING 0
48#endif
49
50#define MAXDROP 10 // check if keyboard is connected every X polling cycles
51#define SLEEP_TIMEOUT 500000 // check keyboard/reset this many millis
52
53
54#define MATRIX_ROWS 12
55#define MATRIX_COLS 8
56
57/* key combination for command */
58#define IS_COMMAND() ( \
59 get_mods() == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
60 get_mods() == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
61 get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
62)
63
64
65/* Serial(USART) configuration
66 * asynchronous, negative logic, 9600baud, no flow control
67 * 1-start bit, 8-data bit, non parity, 1-stop bit
68 */
69#define SERIAL_SOFT_BAUD 9600
70#define SERIAL_SOFT_PARITY_NONE
71#define SERIAL_SOFT_BIT_ORDER_LSB
72#if (HANDSPRING == 0)
73 #define SERIAL_SOFT_LOGIC_NEGATIVE //RS232 logic
74#endif
75/* RXD Port */
76#define SERIAL_SOFT_RXD_ENABLE
77
78// we are using Pro micro pin 3 / D0 as serial
79#define SERIAL_SOFT_RXD_DDR DDRD
80#define SERIAL_SOFT_RXD_PORT PORTD
81#define SERIAL_SOFT_RXD_PIN PIND
82#define SERIAL_SOFT_RXD_BIT 0
83#define SERIAL_SOFT_RXD_VECT INT0_vect
84
85/* RXD Interupt */
86#define SERIAL_SOFT_RXD_INIT() do { \
87 /* pin configuration: input with pull-up */ \
88 SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
89 SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
90 /* enable interrupt: INT0(rising edge) */ \
91 EICRA |= ((1<<ISC01)|(1<<ISC00)); \
92 EIMSK |= (1<<INT0); \
93 sei(); \
94} while (0)
95#define SERIAL_SOFT_RXD_INT_ENTER()
96#define SERIAL_SOFT_RXD_INT_EXIT() do { \
97 /* clear interrupt flag */ \
98 EIFR = (1<<INTF0); \
99} while (0)
100#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
101
102/* TXD Port */
103#define SERIAL_SOFT_TXD_ENABLE
104#define SERIAL_SOFT_TXD_DDR DDRD
105#define SERIAL_SOFT_TXD_PORT PORTD
106#define SERIAL_SOFT_TXD_PIN PIND
107#define SERIAL_SOFT_TXD_BIT 3
108#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
109#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
110#define SERIAL_SOFT_TXD_INIT() do { \
111 /* pin configuration: output */ \
112 SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
113 /* idle */ \
114 SERIAL_SOFT_TXD_ON(); \
115} while (0)
116
117