config.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. /* COL2ROW or ROW2COL */
  37. #define DIODE_DIRECTION COL2ROW
  38. /* define if matrix has ghost */
  39. //#define MATRIX_HAS_GHOST
  40. /* number of backlight levels */
  41. #define BACKLIGHT_LEVELS 3
  42. /* Set 0 if debouncing isn't needed */
  43. #define DEBOUNCING_DELAY 5
  44. /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
  45. #define LOCKING_SUPPORT_ENABLE
  46. /* Locking resynchronize hack */
  47. #define LOCKING_RESYNC_ENABLE
  48. /* key combination for command */
  49. #define IS_COMMAND() ( \
  50. keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
  51. )
  52. /*
  53. * Feature disable options
  54. * These options are also useful to firmware size reduction.
  55. */
  56. /* disable debug print */
  57. //#define NO_DEBUG
  58. /* disable print */
  59. //#define NO_PRINT
  60. /* disable action features */
  61. //#define NO_ACTION_LAYER
  62. //#define NO_ACTION_TAPPING
  63. //#define NO_ACTION_ONESHOT
  64. //#define NO_ACTION_MACRO
  65. //#define NO_ACTION_FUNCTION
  66. /* PS/2 mouse */
  67. #ifdef PS2_USE_BUSYWAIT
  68. # define PS2_CLOCK_PORT PORTD
  69. # define PS2_CLOCK_PIN PIND
  70. # define PS2_CLOCK_DDR DDRD
  71. # define PS2_CLOCK_BIT 1
  72. # define PS2_DATA_PORT PORTD
  73. # define PS2_DATA_PIN PIND
  74. # define PS2_DATA_DDR DDRD
  75. # define PS2_DATA_BIT 2
  76. #endif
  77. /* PS/2 mouse interrupt version */
  78. #ifdef PS2_USE_INT
  79. /* uses INT1 for clock line(ATMega32U4) */
  80. #define PS2_CLOCK_PORT PORTD
  81. #define PS2_CLOCK_PIN PIND
  82. #define PS2_CLOCK_DDR DDRD
  83. #define PS2_CLOCK_BIT 3
  84. #define PS2_DATA_PORT PORTD
  85. #define PS2_DATA_PIN PIND
  86. #define PS2_DATA_DDR DDRD
  87. #define PS2_DATA_BIT 2
  88. #define PS2_INT_INIT() do { \
  89. EICRA |= ((1<<ISC31) | \
  90. (0<<ISC30)); \
  91. } while (0)
  92. #define PS2_INT_ON() do { \
  93. EIMSK |= (1<<INT3); \
  94. } while (0)
  95. #define PS2_INT_OFF() do { \
  96. EIMSK &= ~(1<<INT3); \
  97. } while (0)
  98. #define PS2_INT_VECT INT3_vect
  99. #endif
  100. /* PS/2 mouse USART version */
  101. #ifdef PS2_USE_USART
  102. /* XCK for clock line and RXD for data line */
  103. #define PS2_CLOCK_PORT PORTD
  104. #define PS2_CLOCK_PIN PIND
  105. #define PS2_CLOCK_DDR DDRD
  106. #define PS2_CLOCK_BIT 5
  107. #define PS2_DATA_PORT PORTD
  108. #define PS2_DATA_PIN PIND
  109. #define PS2_DATA_DDR DDRD
  110. #define PS2_DATA_BIT 2
  111. /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
  112. /* set DDR of CLOCK as input to be slave */
  113. #define PS2_USART_INIT() do { \
  114. PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
  115. PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
  116. UCSR1C = ((1 << UMSEL10) | \
  117. (3 << UPM10) | \
  118. (0 << USBS1) | \
  119. (3 << UCSZ10) | \
  120. (0 << UCPOL1)); \
  121. UCSR1A = 0; \
  122. UBRR1H = 0; \
  123. UBRR1L = 0; \
  124. } while (0)
  125. #define PS2_USART_RX_INT_ON() do { \
  126. UCSR1B = ((1 << RXCIE1) | \
  127. (1 << RXEN1)); \
  128. } while (0)
  129. #define PS2_USART_RX_POLL_ON() do { \
  130. UCSR1B = (1 << RXEN1); \
  131. } while (0)
  132. #define PS2_USART_OFF() do { \
  133. UCSR1C = 0; \
  134. UCSR1B &= ~((1 << RXEN1) | \
  135. (1 << TXEN1)); \
  136. } while (0)
  137. #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
  138. #define PS2_USART_RX_DATA UDR1
  139. #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
  140. #define PS2_USART_RX_VECT USART1_RX_vect
  141. #endif
  142. #endif