You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

304 lines
8.4 KiB

Remove unused `IS_COMMAND()` instances and Magic Key definitions (#14610) * Remove unused IS_COMMAND() instances from keyboard-level config.h, 0-9 * Remove unused IS_COMMAND() instances from keyboard-level config.h, A-B * Remove unused IS_COMMAND() instances from keyboard-level config.h, C-D * Remove unused IS_COMMAND() instances from keyboard-level config.h, E-G * Remove unused IS_COMMAND() instances from keyboard-level config.h, handwired * Remove unused IS_COMMAND() instances from keyboard-level config.h, H-M * Remove unused IS_COMMAND() instances from keyboard-level config.h, N-R * Remove unused IS_COMMAND() instances from keyboard-level config.h, S-Z * Remove unused Magic Key definitions from keyboard-level config.h, 0-9 * Remove unused Magic Key definitions from keyboard-level config.h, A * Remove unused Magic Key definitions from keyboard-level config.h, B * Remove unused Magic Key definitions from keyboard-level config.h, C * Remove unused Magic Key definitions from keyboard-level config.h, D-E * Remove unused Magic Key definitions from keyboard-level config.h, F-H * Remove unused Magic Key definitions from keyboard-level config.h, handwired * Remove unused Magic Key definitions from keyboard-level config.h, I-K * Remove unused Magic Key definitions from keyboard-level config.h, L-M * Remove unused Magic Key definitions from keyboard-level config.h, N-R * Remove unused Magic Key definitions from keyboard-level config.h, S-V * Remove unused Magic Key definitions from keyboard-level config.h, W-Z * Merge remote-tracking branch 'upstream/master' into clean/command_and_magic * Remove remaining unused IS_COMMAND() instances from keyboard-level config.h
2 years ago
  1. /*
  2. Copyright 2012 Jun Wako <wakojun@gmail.com>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #pragma once
  15. #include "config_common.h"
  16. /* USB Device descriptor parameter */
  17. #define VENDOR_ID 0x17EF // Lenovo
  18. //#define PRODUCT_ID 0x6009 // ThinkPad Keyboard with TrackPoint
  19. //#define PRODUCT_ID 0x6047 // ThinkPad Compact USB Keyboard with TrackPoint
  20. #define PRODUCT_ID 0x6048 // ThinkPad Compact Bluetooth Keyboard with TrackPoint
  21. //#define PRODUCT_ID 0x6067 // ThinkPad Pro Docking Station
  22. #define DEVICE_VER 0x0001
  23. #define MANUFACTURER Priyadi
  24. #define PRODUCT Promethium Keyboard
  25. /* key matrix size */
  26. #define MATRIX_COLS 6
  27. #define MATRIX_ROWS 9
  28. /* default pin-out */
  29. #define MATRIX_COL_PINS \
  30. { F4, F1, F0, D6, D0, D1 }
  31. #define MATRIX_ROW_PINS \
  32. { F5, F6, F7, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
  33. #define TRACKPOINT_PINS \
  34. { B7, B6, D7 }
  35. #define UNUSED_PINS
  36. /*
  37. * Keyboard Matrix Assignments
  38. *
  39. * Change this to how you wired your keyboard
  40. * COLS: AVR pins used for columns, left to right
  41. * ROWS: AVR pins used for rows, top to bottom
  42. * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
  43. * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
  44. *
  45. */
  46. #define DIODE_DIRECTION COL2ROW
  47. // #define BACKLIGHT_PIN B7
  48. // #define BACKLIGHT_BREATHING
  49. // #define BACKLIGHT_LEVELS 3
  50. /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
  51. #define DEBOUNCE 5
  52. /* define if matrix has ghost (lacks anti-ghosting diodes) */
  53. //#define MATRIX_HAS_GHOST
  54. /* number of backlight levels */
  55. /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
  56. // #define LOCKING_SUPPORT_ENABLE
  57. /* Locking resynchronize hack */
  58. // #define LOCKING_RESYNC_ENABLE
  59. /*
  60. * Force NKRO
  61. *
  62. * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
  63. * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
  64. * makefile for this to work.)
  65. *
  66. * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
  67. * until the next keyboard reset.
  68. *
  69. * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
  70. * fully operational during normal computer usage.
  71. *
  72. * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
  73. * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
  74. * bootmagic, NKRO mode will always be enabled until it is toggled again during a
  75. * power-up.
  76. *
  77. */
  78. //#define FORCE_NKRO
  79. /*
  80. * Magic Key Options
  81. *
  82. * Magic keys are hotkey commands that allow control over firmware functions of
  83. * the keyboard. They are best used in combination with the HID Listen program,
  84. * found here: https://www.pjrc.com/teensy/hid_listen.html
  85. *
  86. * The options below allow the magic key functionality to be changed. This is
  87. * useful if your keyboard/keypad is missing keys and you want magic key support.
  88. *
  89. */
  90. /* key combination for command */
  91. #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)))
  92. /*
  93. * Feature disable options
  94. * These options are also useful to firmware size reduction.
  95. */
  96. /* disable debug print */
  97. // #define NO_DEBUG
  98. /* disable print */
  99. // #define NO_PRINT
  100. /* disable action features */
  101. //#define NO_ACTION_LAYER
  102. //#define NO_ACTION_TAPPING
  103. //#define NO_ACTION_ONESHOT
  104. //#define NO_ACTION_MACRO
  105. //#define NO_ACTION_FUNCTION
  106. #define PS2_MOUSE_INIT_DELAY 2000
  107. #define BATTERY_POLL 30000
  108. #define MAX_VOLTAGE 4.2
  109. #define MIN_VOLTAGE 3.2
  110. #ifndef __ASSEMBLER__ // assembler doesn't like enum in .h file
  111. enum led_sequence {
  112. LED_IND_LINUX,
  113. LED_IND_APPLE,
  114. LED_IND_WINDOWS,
  115. LED_IND_QWERTY,
  116. LED_IND_ALT,
  117. LED_IND_AUDIO,
  118. LED_IND_BLUETOOTH,
  119. LED_IND_USB,
  120. LED_IND_BATTERY,
  121. LED_IND_CAPSLOCK,
  122. LED_IND_GUI,
  123. LED_IND_FUN,
  124. LED_IND_NUM,
  125. LED_IND_PUNC,
  126. LED_IND_EMOJI,
  127. LED_IND_GREEK,
  128. LED_BKSP,
  129. LED_ENT,
  130. LED_RSFT,
  131. LED_RCTL,
  132. LED_RALT,
  133. LED_SLSH,
  134. LED_SCLN,
  135. LED_P,
  136. LED_O,
  137. LED_L,
  138. LED_DOT,
  139. LED_RGUI,
  140. LED_GREEK,
  141. LED_COMM,
  142. LED_K,
  143. LED_I,
  144. LED_U,
  145. LED_J,
  146. LED_M,
  147. LED_FUN,
  148. LED_RSPC,
  149. LED_N,
  150. LED_HH,
  151. LED_Y,
  152. LED_TRACKPOINT3,
  153. LED_TRACKPOINT2,
  154. LED_TRACKPOINT1,
  155. LED_T,
  156. LED_G,
  157. LED_B,
  158. LED_LSPC,
  159. LED_NUM,
  160. LED_V,
  161. LED_F,
  162. LED_R,
  163. LED_E,
  164. LED_D,
  165. LED_C,
  166. LED_EMPTY,
  167. LED_LGUI,
  168. LED_X,
  169. LED_S,
  170. LED_W,
  171. LED_Q,
  172. LED_A,
  173. LED_Z,
  174. LED_LALT,
  175. LED_LCTL,
  176. LED_LSFT,
  177. LED_ESC,
  178. LED_TAB,
  179. LED_TOTAL
  180. };
  181. # define RGB_DI_PIN B5
  182. # define RGBSPS_NUM LED_TOTAL
  183. #endif
  184. /* PS/2 mouse */
  185. #ifdef PS2_USE_BUSYWAIT
  186. # define PS2_CLOCK_PORT PORTD
  187. # define PS2_CLOCK_PIN PIND
  188. # define PS2_CLOCK_DDR DDRD
  189. # define PS2_CLOCK_BIT 3
  190. # define PS2_DATA_PORT PORTD
  191. # define PS2_DATA_PIN PIND
  192. # define PS2_DATA_DDR DDRD
  193. # define PS2_DATA_BIT 2
  194. #endif
  195. /* PS/2 mouse interrupt version */
  196. #ifdef PS2_USE_INT
  197. /* uses INT1 for clock line(ATMega32U4) */
  198. # define PS2_CLOCK_PORT PORTD
  199. # define PS2_CLOCK_PIN PIND
  200. # define PS2_CLOCK_DDR DDRD
  201. # define PS2_CLOCK_BIT 3
  202. # define PS2_DATA_PORT PORTD
  203. # define PS2_DATA_PIN PIND
  204. # define PS2_DATA_DDR DDRD
  205. # define PS2_DATA_BIT 2
  206. # define PS2_INT_INIT() \
  207. do { \
  208. EICRA |= ((1 << ISC31) | (0 << ISC30)); \
  209. } while (0)
  210. # define PS2_INT_ON() \
  211. do { \
  212. EIMSK |= (1 << INT3); \
  213. } while (0)
  214. # define PS2_INT_OFF() \
  215. do { \
  216. EIMSK &= ~(1 << INT3); \
  217. } while (0)
  218. # define PS2_INT_VECT INT3_vect
  219. #endif
  220. /* PS/2 mouse USART version */
  221. #ifdef PS2_USE_USART
  222. /* XCK for clock line and RXD for data line */
  223. # define PS2_CLOCK_PORT PORTD
  224. # define PS2_CLOCK_PIN PIND
  225. # define PS2_CLOCK_DDR DDRD
  226. # define PS2_CLOCK_BIT 5
  227. # define PS2_DATA_PORT PORTD
  228. # define PS2_DATA_PIN PIND
  229. # define PS2_DATA_DDR DDRD
  230. # define PS2_DATA_BIT 2
  231. /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
  232. /* set DDR of CLOCK as input to be slave */
  233. # define PS2_USART_INIT() \
  234. do { \
  235. PS2_CLOCK_DDR &= ~(1 << PS2_CLOCK_BIT); \
  236. PS2_DATA_DDR &= ~(1 << PS2_DATA_BIT); \
  237. UCSR1C = ((1 << UMSEL10) | (3 << UPM10) | (0 << USBS1) | (3 << UCSZ10) | (0 << UCPOL1)); \
  238. UCSR1A = 0; \
  239. UBRR1H = 0; \
  240. UBRR1L = 0; \
  241. } while (0)
  242. # define PS2_USART_RX_INT_ON() \
  243. do { \
  244. UCSR1B = ((1 << RXCIE1) | (1 << RXEN1)); \
  245. } while (0)
  246. # define PS2_USART_RX_POLL_ON() \
  247. do { \
  248. UCSR1B = (1 << RXEN1); \
  249. } while (0)
  250. # define PS2_USART_OFF() \
  251. do { \
  252. UCSR1C = 0; \
  253. UCSR1B &= ~((1 << RXEN1) | (1 << TXEN1)); \
  254. } while (0)
  255. # define PS2_USART_RX_READY (UCSR1A & (1 << RXC1))
  256. # define PS2_USART_RX_DATA UDR1
  257. # define PS2_USART_ERROR (UCSR1A & ((1 << FE1) | (1 << DOR1) | (1 << UPE1)))
  258. # define PS2_USART_RX_VECT USART1_RX_vect
  259. #endif