config.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. #ifndef CONFIG_H
  15. #define CONFIG_H
  16. #include "config_common.h"
  17. #define USB_VENDOR_ID_LENOVO 0x17ef
  18. #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
  19. #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
  20. #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
  21. #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
  22. /* USB Device descriptor parameter */
  23. #define VENDOR_ID USB_VENDOR_ID_LENOVO
  24. #define PRODUCT_ID USB_DEVICE_ID_LENOVO_CBTKBD
  25. #define DEVICE_VER 0x0001
  26. #define MANUFACTURER Priyadi
  27. #define PRODUCT Promethium Keyboard
  28. #define DESCRIPTION
  29. /* key matrix size */
  30. #define MATRIX_ROWS 8
  31. #define MATRIX_COLS 6
  32. /* default pin-out */
  33. #define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
  34. #define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
  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 DEBOUNCING_DELAY 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. /* key combination for command */
  80. #define IS_COMMAND() ( \
  81. keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
  82. )
  83. /* control how magic key switches layers */
  84. //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
  85. //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
  86. //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
  87. /* override magic key keymap */
  88. //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
  89. //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
  90. //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
  91. //#define MAGIC_KEY_HELP1 H
  92. //#define MAGIC_KEY_HELP2 SLASH
  93. //#define MAGIC_KEY_DEBUG D
  94. //#define MAGIC_KEY_DEBUG_MATRIX X
  95. //#define MAGIC_KEY_DEBUG_KBD K
  96. //#define MAGIC_KEY_DEBUG_MOUSE M
  97. //#define MAGIC_KEY_VERSION V
  98. //#define MAGIC_KEY_STATUS S
  99. //#define MAGIC_KEY_CONSOLE C
  100. //#define MAGIC_KEY_LAYER0_ALT1 ESC
  101. //#define MAGIC_KEY_LAYER0_ALT2 GRAVE
  102. //#define MAGIC_KEY_LAYER0 0
  103. //#define MAGIC_KEY_LAYER1 1
  104. //#define MAGIC_KEY_LAYER2 2
  105. //#define MAGIC_KEY_LAYER3 3
  106. //#define MAGIC_KEY_LAYER4 4
  107. //#define MAGIC_KEY_LAYER5 5
  108. //#define MAGIC_KEY_LAYER6 6
  109. //#define MAGIC_KEY_LAYER7 7
  110. //#define MAGIC_KEY_LAYER8 8
  111. //#define MAGIC_KEY_LAYER9 9
  112. //#define MAGIC_KEY_BOOTLOADER PAUSE
  113. //#define MAGIC_KEY_LOCK CAPS
  114. //#define MAGIC_KEY_EEPROM E
  115. //#define MAGIC_KEY_NKRO N
  116. //#define MAGIC_KEY_SLEEP_LED Z
  117. /*
  118. * Feature disable options
  119. * These options are also useful to firmware size reduction.
  120. */
  121. /* disable debug print */
  122. // #define NO_DEBUG
  123. /* disable print */
  124. // #define NO_PRINT
  125. /* disable action features */
  126. //#define NO_ACTION_LAYER
  127. //#define NO_ACTION_TAPPING
  128. //#define NO_ACTION_ONESHOT
  129. //#define NO_ACTION_MACRO
  130. //#define NO_ACTION_FUNCTION
  131. /* PS/2 mouse */
  132. #ifdef PS2_USE_BUSYWAIT
  133. # define PS2_CLOCK_PORT PORTD
  134. # define PS2_CLOCK_PIN PIND
  135. # define PS2_CLOCK_DDR DDRD
  136. # define PS2_CLOCK_BIT 1
  137. # define PS2_DATA_PORT PORTD
  138. # define PS2_DATA_PIN PIND
  139. # define PS2_DATA_DDR DDRD
  140. # define PS2_DATA_BIT 2
  141. #endif
  142. /* PS/2 mouse interrupt version */
  143. #ifdef PS2_USE_INT
  144. /* uses INT1 for clock line(ATMega32U4) */
  145. #define PS2_CLOCK_PORT PORTD
  146. #define PS2_CLOCK_PIN PIND
  147. #define PS2_CLOCK_DDR DDRD
  148. #define PS2_CLOCK_BIT 3
  149. #define PS2_DATA_PORT PORTD
  150. #define PS2_DATA_PIN PIND
  151. #define PS2_DATA_DDR DDRD
  152. #define PS2_DATA_BIT 2
  153. #define PS2_INT_INIT() do { \
  154. EICRA |= ((1<<ISC31) | \
  155. (0<<ISC30)); \
  156. } while (0)
  157. #define PS2_INT_ON() do { \
  158. EIMSK |= (1<<INT3); \
  159. } while (0)
  160. #define PS2_INT_OFF() do { \
  161. EIMSK &= ~(1<<INT3); \
  162. } while (0)
  163. #define PS2_INT_VECT INT3_vect
  164. #endif
  165. /* PS/2 mouse USART version */
  166. #ifdef PS2_USE_USART
  167. /* XCK for clock line and RXD for data line */
  168. #define PS2_CLOCK_PORT PORTD
  169. #define PS2_CLOCK_PIN PIND
  170. #define PS2_CLOCK_DDR DDRD
  171. #define PS2_CLOCK_BIT 5
  172. #define PS2_DATA_PORT PORTD
  173. #define PS2_DATA_PIN PIND
  174. #define PS2_DATA_DDR DDRD
  175. #define PS2_DATA_BIT 2
  176. /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
  177. /* set DDR of CLOCK as input to be slave */
  178. #define PS2_USART_INIT() do { \
  179. PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
  180. PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
  181. UCSR1C = ((1 << UMSEL10) | \
  182. (3 << UPM10) | \
  183. (0 << USBS1) | \
  184. (3 << UCSZ10) | \
  185. (0 << UCPOL1)); \
  186. UCSR1A = 0; \
  187. UBRR1H = 0; \
  188. UBRR1L = 0; \
  189. } while (0)
  190. #define PS2_USART_RX_INT_ON() do { \
  191. UCSR1B = ((1 << RXCIE1) | \
  192. (1 << RXEN1)); \
  193. } while (0)
  194. #define PS2_USART_RX_POLL_ON() do { \
  195. UCSR1B = (1 << RXEN1); \
  196. } while (0)
  197. #define PS2_USART_OFF() do { \
  198. UCSR1C = 0; \
  199. UCSR1B &= ~((1 << RXEN1) | \
  200. (1 << TXEN1)); \
  201. } while (0)
  202. #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
  203. #define PS2_USART_RX_DATA UDR1
  204. #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
  205. #define PS2_USART_RX_VECT USART1_RX_vect
  206. #endif
  207. #endif