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.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. Copyright 2012 Jun Wako <[email protected]>
  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. #define VENDOR_ID 0xFEED
  17. #define PRODUCT_ID 0x3333
  18. #define DEVICE_VER 0x0100
  19. #define MANUFACTURER t.m.k.
  20. #define PRODUCT PC98 keyboard converter
  21. #define DESCRIPTION converts PC98 keyboard protocol into USB
  22. /* matrix size */
  23. #define MATRIX_ROWS 16
  24. #define MATRIX_COLS 8
  25. /* key combination for command */
  26. #define IS_COMMAND() ( \
  27. keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
  28. keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
  29. keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
  30. )
  31. /* PC98 control */
  32. #define PC98_RST_DDR DDRD
  33. #define PC98_RST_PORT PORTD
  34. #define PC98_RST_BIT 1
  35. #define PC98_RDY_DDR DDRD
  36. #define PC98_RDY_PORT PORTD
  37. #define PC98_RDY_BIT 4
  38. #define PC98_RTY_DDR DDRD
  39. #define PC98_RTY_PORT PORTD
  40. #define PC98_RTY_BIT 5
  41. /* Serial(USART) configuration
  42. * asynchronous, negative logic, 19200baud, no flow control
  43. * 1-start bit, 8-data bit, odd parity, 1-stop bit
  44. */
  45. #define SERIAL_BAUD 19200
  46. #define SERIAL_PARITY_ODD
  47. #define SERIAL_BIT_ORDER_MSB
  48. #define SERIAL_RXD_DDR DDRD
  49. #define SERIAL_RXD_PORT PORTD
  50. #define SERIAL_RXD_PIN PIND
  51. #define SERIAL_RXD_BIT 2
  52. #define SERIAL_RXD_VECT INT2_vect
  53. #define SERIAL_RXD_INIT() do { \
  54. /* pin configuration: input with pull-up */ \
  55. SERIAL_RXD_DDR &= ~(1<<SERIAL_RXD_BIT); \
  56. SERIAL_RXD_PORT |= (1<<SERIAL_RXD_BIT); \
  57. /* enable interrupt: INT2(rising edge) */ \
  58. EICRA |= ((1<<ISC21)|(1<<ISC20)); \
  59. EIMSK |= (1<<INT2); \
  60. } while (0)
  61. #define SERIAL_RXD_INT_ENTER()
  62. #define SERIAL_RXD_INT_EXIT() do { \
  63. /* clear interrupt flag */ \
  64. EIFR = (1<<INTF2); \
  65. } while (0)
  66. #define SERIAL_RXD_READ() (~SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT))
  67. #define SERIAL_TXD_DDR DDRD
  68. #define SERIAL_TXD_PORT PORTD
  69. #define SERIAL_TXD_PIN PIND
  70. #define SERIAL_TXD_BIT 3
  71. /* negative logic */
  72. #define SERIAL_TXD_ON() do { SERIAL_TXD_PORT &= ~(1<<SERIAL_TXD_BIT); } while (0)
  73. #define SERIAL_TXD_OFF() do { SERIAL_TXD_PORT |= (1<<SERIAL_TXD_BIT); } while (0)
  74. #define SERIAL_TXD_INIT() do { \
  75. /* pin configuration: output */ \
  76. SERIAL_TXD_DDR |= (1<<SERIAL_TXD_BIT); \
  77. /* idle */ \
  78. SERIAL_TXD_ON(); \
  79. } while (0)
  80. #endif