config.h 5.5 KB

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