logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

config.h (2940B)


  1. /*
  2. Copyright 2012 Jun Wako <wakojun@gmail.com>
  3. Copyright 2016 Priyadi Iman Nurcahyo <priyadi@priyadi.net>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. /* matrix size */
  17. #define MATRIX_ROWS 17 // keycode bit: 3-0
  18. #define MATRIX_COLS 8 // keycode bit: 6-4
  19. /* legacy keymap support */
  20. #define USE_LEGACY_KEYMAP
  21. /* key combination for command */
  22. #define IS_COMMAND() ( \
  23. get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT) | MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL)) \
  24. )
  25. /*
  26. * PS/2 USART configuration for ATMega32U4
  27. */
  28. #ifdef PS2_DRIVER_USART
  29. /* XCK for clock line */
  30. #define PS2_CLOCK_PIN D5
  31. #define PS2_DATA_PIN D2
  32. /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
  33. /* set DDR of CLOCK as input to be slave */
  34. #define PS2_USART_INIT() do { \
  35. PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
  36. PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
  37. UCSR1C = ((1 << UMSEL10) | \
  38. (3 << UPM10) | \
  39. (0 << USBS1) | \
  40. (3 << UCSZ10) | \
  41. (0 << UCPOL1)); \
  42. UCSR1A = 0; \
  43. UBRR1H = 0; \
  44. UBRR1L = 0; \
  45. } while (0)
  46. #define PS2_USART_RX_INT_ON() do { \
  47. UCSR1B = ((1 << RXCIE1) | \
  48. (1 << RXEN1)); \
  49. } while (0)
  50. #define PS2_USART_RX_POLL_ON() do { \
  51. UCSR1B = (1 << RXEN1); \
  52. } while (0)
  53. #define PS2_USART_OFF() do { \
  54. UCSR1C = 0; \
  55. UCSR1B &= ~((1 << RXEN1) | \
  56. (1 << TXEN1)); \
  57. } while (0)
  58. #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
  59. #define PS2_USART_RX_DATA UDR1
  60. #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
  61. #define PS2_USART_RX_VECT USART1_RX_vect
  62. #endif
  63. /*
  64. * PS/2 Interrupt configuration
  65. */
  66. #ifdef PS2_DRIVER_INTERRUPT
  67. /* uses INT1 for clock line(ATMega32U4) */
  68. #define PS2_CLOCK_PIN D1
  69. #define PS2_DATA_PIN D0
  70. #define PS2_INT_INIT() do { \
  71. EICRA |= ((1<<ISC11) | \
  72. (0<<ISC10)); \
  73. } while (0)
  74. #define PS2_INT_ON() do { \
  75. EIMSK |= (1<<INT1); \
  76. } while (0)
  77. #define PS2_INT_OFF() do { \
  78. EIMSK &= ~(1<<INT1); \
  79. } while (0)
  80. #define PS2_INT_VECT INT1_vect
  81. #endif
  82. /*
  83. * PS/2 Busywait configuration
  84. */
  85. #ifdef PS2_DRIVER_BUSYWAIT
  86. #define PS2_CLOCK_PIN D1
  87. #define PS2_DATA_PIN D0
  88. #endif