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/>.
21 #include "config_common.h"
23 /* USB Device descriptor parameter */
24 #define VENDOR_ID 0xFEED
25 #define PRODUCT_ID 0x6660
26 #define DEVICE_VER 0x0001
27 #define MANUFACTURER Priyadi
28 #define PRODUCT Promethium Keyboard
29 #define DESCRIPTION Promethium Keyboard
36 #define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
37 #define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
40 /* COL2ROW or ROW2COL */
41 #define DIODE_DIRECTION COL2ROW
43 /* define if matrix has ghost */
44 //#define MATRIX_HAS_GHOST
46 /* number of backlight levels */
47 #define BACKLIGHT_LEVELS 3
49 /* Set 0 if debouncing isn't needed */
50 #define DEBOUNCING_DELAY 5
52 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
53 #define LOCKING_SUPPORT_ENABLE
54 /* Locking resynchronize hack */
55 #define LOCKING_RESYNC_ENABLE
57 /* key combination for command */
58 #define IS_COMMAND() ( \
59 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
63 * Feature disable options
64 * These options are also useful to firmware size reduction.
67 /* disable debug print */
73 /* disable action features */
74 //#define NO_ACTION_LAYER
75 //#define NO_ACTION_TAPPING
76 //#define NO_ACTION_ONESHOT
77 //#define NO_ACTION_MACRO
78 //#define NO_ACTION_FUNCTION
81 #ifdef PS2_USE_BUSYWAIT
82 # define PS2_CLOCK_PORT PORTD
83 # define PS2_CLOCK_PIN PIND
84 # define PS2_CLOCK_DDR DDRD
85 # define PS2_CLOCK_BIT 1
86 # define PS2_DATA_PORT PORTD
87 # define PS2_DATA_PIN PIND
88 # define PS2_DATA_DDR DDRD
89 # define PS2_DATA_BIT 2
92 /* PS/2 mouse interrupt version */
94 /* uses INT1 for clock line(ATMega32U4) */
95 #define PS2_CLOCK_PORT PORTD
96 #define PS2_CLOCK_PIN PIND
97 #define PS2_CLOCK_DDR DDRD
98 #define PS2_CLOCK_BIT 3
99 #define PS2_DATA_PORT PORTD
100 #define PS2_DATA_PIN PIND
101 #define PS2_DATA_DDR DDRD
102 #define PS2_DATA_BIT 2
104 #define PS2_INT_INIT() do { \
105 EICRA |= ((1<<ISC31) | \
108 #define PS2_INT_ON() do { \
109 EIMSK |= (1<<INT3); \
111 #define PS2_INT_OFF() do { \
112 EIMSK &= ~(1<<INT3); \
114 #define PS2_INT_VECT INT3_vect
117 /* PS/2 mouse USART version */
119 /* XCK for clock line and RXD for data line */
120 #define PS2_CLOCK_PORT PORTD
121 #define PS2_CLOCK_PIN PIND
122 #define PS2_CLOCK_DDR DDRD
123 #define PS2_CLOCK_BIT 5
124 #define PS2_DATA_PORT PORTD
125 #define PS2_DATA_PIN PIND
126 #define PS2_DATA_DDR DDRD
127 #define PS2_DATA_BIT 2
129 /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
130 /* set DDR of CLOCK as input to be slave */
131 #define PS2_USART_INIT() do { \
132 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
133 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
134 UCSR1C = ((1 << UMSEL10) | \
143 #define PS2_USART_RX_INT_ON() do { \
144 UCSR1B = ((1 << RXCIE1) | \
147 #define PS2_USART_RX_POLL_ON() do { \
148 UCSR1B = (1 << RXEN1); \
150 #define PS2_USART_OFF() do { \
152 UCSR1B &= ~((1 << RXEN1) | \
155 #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
156 #define PS2_USART_RX_DATA UDR1
157 #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
158 #define PS2_USART_RX_VECT USART1_RX_vect