config.h (5675B)
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 #pragma once 19 20 21 /* key matrix size */ 22 #define MATRIX_COLS 6 23 #define MATRIX_ROWS 9 24 25 /* default pin-out */ 26 #define MATRIX_COL_PINS \ 27 { F4, F1, F0, D6, D0, D1 } 28 #define MATRIX_ROW_PINS \ 29 { F5, F6, F7, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } 30 #define TRACKPOINT_PINS \ 31 { B7, B6, D7 } 32 33 /* 34 * Keyboard Matrix Assignments 35 * 36 * Change this to how you wired your keyboard 37 * COLS: AVR pins used for columns, left to right 38 * ROWS: AVR pins used for rows, top to bottom 39 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) 40 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) 41 * 42 */ 43 #define DIODE_DIRECTION COL2ROW 44 45 /* key combination for command */ 46 #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))) 47 48 49 /* 50 * Feature disable options 51 * These options are also useful to firmware size reduction. 52 */ 53 54 /* disable debug print */ 55 // #define NO_DEBUG 56 57 /* disable print */ 58 // #define NO_PRINT 59 60 /* disable action features */ 61 //#define NO_ACTION_LAYER 62 //#define NO_ACTION_TAPPING 63 //#define NO_ACTION_ONESHOT 64 65 #define PS2_MOUSE_INIT_DELAY 2000 66 67 #ifndef __ASSEMBLER__ // assembler doesn't like enum in .h file 68 enum led_sequence { 69 LED_IND_LINUX, 70 LED_IND_APPLE, 71 LED_IND_WINDOWS, 72 LED_IND_QWERTY, 73 LED_IND_ALT, 74 LED_IND_AUDIO, 75 LED_IND_BLUETOOTH, 76 LED_IND_USB, 77 78 LED_IND_BATTERY, 79 LED_IND_CAPSLOCK, 80 LED_IND_GUI, 81 LED_IND_FUN, 82 LED_IND_NUM, 83 LED_IND_PUNC, 84 LED_IND_EMOJI, 85 LED_IND_GREEK, 86 87 LED_BKSP, 88 LED_ENT, 89 LED_RSFT, 90 LED_RCTL, 91 92 LED_RALT, 93 LED_SLSH, 94 LED_SCLN, 95 LED_P, 96 97 LED_O, 98 LED_L, 99 LED_DOT, 100 LED_RGUI, 101 102 LED_GREEK, 103 LED_COMM, 104 LED_K, 105 LED_I, 106 107 LED_U, 108 LED_J, 109 LED_M, 110 LED_FUN, 111 112 LED_RSPC, 113 LED_N, 114 LED_HH, 115 LED_Y, 116 117 LED_TRACKPOINT3, 118 LED_TRACKPOINT2, 119 LED_TRACKPOINT1, 120 121 LED_T, 122 LED_G, 123 LED_B, 124 LED_LSPC, 125 126 LED_NUM, 127 LED_V, 128 LED_F, 129 LED_R, 130 131 LED_E, 132 LED_D, 133 LED_C, 134 LED_EMPTY, 135 136 LED_LGUI, 137 LED_X, 138 LED_S, 139 LED_W, 140 141 LED_Q, 142 LED_A, 143 LED_Z, 144 LED_LALT, 145 146 LED_LCTL, 147 LED_LSFT, 148 LED_ESC, 149 LED_TAB, 150 151 LED_TOTAL 152 }; 153 154 # define RGBSPS_NUM LED_TOTAL 155 # define WS2812_LED_COUNT RGBSPS_NUM 156 #endif 157 158 /* PS/2 mouse */ 159 #ifdef PS2_DRIVER_BUSYWAIT 160 # define PS2_CLOCK_PIN D3 161 # define PS2_DATA_PIN D2 162 #endif 163 164 /* PS/2 mouse interrupt version */ 165 #ifdef PS2_DRIVER_INTERRUPT 166 /* uses INT1 for clock line(ATMega32U4) */ 167 # define PS2_CLOCK_PIN D3 168 # define PS2_DATA_PIN D2 169 170 # define PS2_INT_INIT() \ 171 do { \ 172 EICRA |= ((1 << ISC31) | (0 << ISC30)); \ 173 } while (0) 174 # define PS2_INT_ON() \ 175 do { \ 176 EIMSK |= (1 << INT3); \ 177 } while (0) 178 # define PS2_INT_OFF() \ 179 do { \ 180 EIMSK &= ~(1 << INT3); \ 181 } while (0) 182 # define PS2_INT_VECT INT3_vect 183 #endif 184 185 /* PS/2 mouse USART version */ 186 #ifdef PS2_DRIVER_USART 187 /* XCK for clock line and RXD for data line */ 188 #define PS2_CLOCK_PIN D5 189 #define PS2_DATA_PIN D2 190 191 /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ 192 /* set DDR of CLOCK as input to be slave */ 193 # define PS2_USART_INIT() \ 194 do { \ 195 PS2_CLOCK_DDR &= ~(1 << PS2_CLOCK_BIT); \ 196 PS2_DATA_DDR &= ~(1 << PS2_DATA_BIT); \ 197 UCSR1C = ((1 << UMSEL10) | (3 << UPM10) | (0 << USBS1) | (3 << UCSZ10) | (0 << UCPOL1)); \ 198 UCSR1A = 0; \ 199 UBRR1H = 0; \ 200 UBRR1L = 0; \ 201 } while (0) 202 # define PS2_USART_RX_INT_ON() \ 203 do { \ 204 UCSR1B = ((1 << RXCIE1) | (1 << RXEN1)); \ 205 } while (0) 206 # define PS2_USART_RX_POLL_ON() \ 207 do { \ 208 UCSR1B = (1 << RXEN1); \ 209 } while (0) 210 # define PS2_USART_OFF() \ 211 do { \ 212 UCSR1C = 0; \ 213 UCSR1B &= ~((1 << RXEN1) | (1 << TXEN1)); \ 214 } while (0) 215 # define PS2_USART_RX_READY (UCSR1A & (1 << RXC1)) 216 # define PS2_USART_RX_DATA UDR1 217 # define PS2_USART_ERROR (UCSR1A & ((1 << FE1) | (1 << DOR1) | (1 << UPE1))) 218 # define PS2_USART_RX_VECT USART1_RX_vect 219 #endif