config.h 4.4 KB

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