logo

qmk_firmware

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

config.h (2848B)


  1. /*
  2. Copyright 2021 KapCave
  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. /* Only required if you add in a trackpoint hardware to the pcb */
  16. #ifdef PS2_DRIVER_USART
  17. #define PS2_CLOCK_PIN D5
  18. #define PS2_DATA_PIN D2
  19. /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling
  20. * edge */
  21. /* set DDR of CLOCK as input to be slave */
  22. #define PS2_USART_INIT() do { \
  23. PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
  24. PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
  25. UCSR1C = ((1 << UMSEL10) | \
  26. (3 << UPM10) | \
  27. (0 << USBS1) | \
  28. (3 << UCSZ10) | \
  29. (0 << UCPOL1)); \
  30. UCSR1A = 0; \
  31. UBRR1H = 0; \
  32. UBRR1L = 0; \
  33. } while (0)
  34. #define PS2_USART_RX_INT_ON() do { \
  35. UCSR1B = ((1 << RXCIE1) | \
  36. (1 << RXEN1)); \
  37. } while (0)
  38. #define PS2_USART_RX_POLL_ON() do { \
  39. UCSR1B = (1 << RXEN1); \
  40. } while (0)
  41. #define PS2_USART_OFF() do { \
  42. UCSR1C = 0; \
  43. UCSR1B &= ~((1 << RXEN1) | \
  44. (1 << TXEN1)); \
  45. } while (0)
  46. #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
  47. #define PS2_USART_RX_DATA UDR1
  48. #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
  49. #define PS2_USART_RX_VECT USART1_RX_vect
  50. #endif
  51. #ifdef PS2_DRIVER_INTERRUPT
  52. #define PS2_CLOCK_PIN D2
  53. #define PS2_DATA_PIN D5
  54. #define PS2_INT_INIT() do { \
  55. EICRA |= ((1<<ISC21) | \
  56. (0<<ISC20)); \
  57. } while (0)
  58. #define PS2_INT_ON() do { \
  59. EIMSK |= (1<<INT2); \
  60. } while (0)
  61. #define PS2_INT_OFF() do { \
  62. EIMSK &= ~(1<<INT2); \
  63. } while (0)
  64. #define PS2_INT_VECT INT2_vect
  65. #endif