You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

config.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. Converter for 70% IBM Terminal Keyboard
  3. Author: Benjamin Gould, 2013
  4. Based on code Copyright 2011 Jun Wako <[email protected]>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef CONFIG_H
  17. #define CONFIG_H
  18. #define VENDOR_ID 0xFEED
  19. #define PRODUCT_ID 0x6535
  20. #define DEVICE_VER 0x0100
  21. #define MANUFACTURER t.m.k.
  22. #define PRODUCT 70% IBM Terminal Keyboard Converter w/ Bluetooth
  23. #define DESCRIPTION USB converter for IBM Terminal Keyboard w/ Bluetooth
  24. /* matrix size */
  25. #define MATRIX_ROWS 17 // keycode bit: 3-0
  26. #define MATRIX_COLS 8 // keycode bit: 6-4
  27. /* legacy keymap support */
  28. // #define USE_LEGACY_KEYMAP
  29. /* key combination for command */
  30. #define IS_COMMAND() ( \
  31. (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
  32. (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
  33. )
  34. /* USART configuration
  35. * asynchronous, 9600baud, 8-data bit, non parity, 1-stop bit, no flow control
  36. */
  37. #ifdef __AVR_ATmega32U4__
  38. #define SERIAL_UART_BAUD 9600
  39. #define SERIAL_UART_DATA UDR1
  40. #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
  41. #define SERIAL_UART_RXD_VECT USART1_RX_vect
  42. #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
  43. #define SERIAL_UART_INIT() do { \
  44. UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
  45. UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
  46. UCSR1B = (1<<TXEN1); /* TX: enable */ \
  47. UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
  48. (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
  49. sei(); \
  50. } while(0)
  51. #else
  52. # error "USART configuration is needed."
  53. #endif
  54. /*
  55. * PS/2 Interrupt configuration
  56. */
  57. #ifdef PS2_USE_INT
  58. /* uses INT1 for clock line(ATMega32U4) */
  59. #define PS2_CLOCK_PORT PORTD
  60. #define PS2_CLOCK_PIN PIND
  61. #define PS2_CLOCK_DDR DDRD
  62. #define PS2_CLOCK_BIT 1
  63. #define PS2_DATA_PORT PORTD
  64. #define PS2_DATA_PIN PIND
  65. #define PS2_DATA_DDR DDRD
  66. #define PS2_DATA_BIT 0
  67. #define PS2_INT_INIT() do { \
  68. EICRA |= ((1<<ISC11) | \
  69. (0<<ISC10)); \
  70. } while (0)
  71. #define PS2_INT_ON() do { \
  72. EIMSK |= (1<<INT1); \
  73. } while (0)
  74. #define PS2_INT_OFF() do { \
  75. EIMSK &= ~(1<<INT1); \
  76. } while (0)
  77. #define PS2_INT_VECT INT1_vect
  78. #endif
  79. /*
  80. * PS/2 Busywait configuration
  81. */
  82. #ifdef PS2_USE_BUSYWAIT
  83. #define PS2_CLOCK_PORT PORTD
  84. #define PS2_CLOCK_PIN PIND
  85. #define PS2_CLOCK_DDR DDRD
  86. #define PS2_CLOCK_BIT 1
  87. #define PS2_DATA_PORT PORTD
  88. #define PS2_DATA_PIN PIND
  89. #define PS2_DATA_DDR DDRD
  90. #define PS2_DATA_BIT 0
  91. #endif
  92. #endif