Keyboard firmwares for Atmel AVR and Cortex-M
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.

config.h 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 Sun keyboard converter
  21. #define DESCRIPTION converts Sun 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. /* legacy keymap support */
  32. #define USE_LEGACY_KEYMAP
  33. /* Serial(USART) configuration
  34. * asynchronous, negative logic, 1200baud, no flow control
  35. * 1-start bit, 8-data bit, non parity, 1-stop bit
  36. */
  37. #define SERIAL_SOFT_BAUD 1200
  38. #define SERIAL_SOFT_PARITY_NONE
  39. #define SERIAL_SOFT_BIT_ORDER_LSB
  40. #define SERIAL_SOFT_LOGIC_NEGATIVE
  41. /* RXD Port */
  42. #define SERIAL_SOFT_RXD_ENABLE
  43. #define SERIAL_SOFT_RXD_DDR DDRD
  44. #define SERIAL_SOFT_RXD_PORT PORTD
  45. #define SERIAL_SOFT_RXD_PIN PIND
  46. #define SERIAL_SOFT_RXD_BIT 2
  47. #define SERIAL_SOFT_RXD_VECT INT2_vect
  48. /* RXD Interupt */
  49. #define SERIAL_SOFT_RXD_INIT() do { \
  50. /* pin configuration: input with pull-up */ \
  51. SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
  52. SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
  53. /* enable interrupt: INT2(rising edge) */ \
  54. EICRA |= ((1<<ISC21)|(1<<ISC20)); \
  55. EIMSK |= (1<<INT2); \
  56. sei(); \
  57. } while (0)
  58. #define SERIAL_SOFT_RXD_INT_ENTER()
  59. #define SERIAL_SOFT_RXD_INT_EXIT() do { \
  60. /* clear interrupt flag */ \
  61. EIFR = (1<<INTF2); \
  62. } while (0)
  63. #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
  64. /* TXD Port */
  65. #define SERIAL_SOFT_TXD_ENABLE
  66. #define SERIAL_SOFT_TXD_DDR DDRD
  67. #define SERIAL_SOFT_TXD_PORT PORTD
  68. #define SERIAL_SOFT_TXD_PIN PIND
  69. #define SERIAL_SOFT_TXD_BIT 3
  70. #define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
  71. #define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
  72. #define SERIAL_SOFT_TXD_INIT() do { \
  73. /* pin configuration: output */ \
  74. SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
  75. /* idle */ \
  76. SERIAL_SOFT_TXD_ON(); \
  77. } while (0)
  78. #endif