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.

пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /* Serial(USART) configuration
  32. * asynchronous, negative logic, 1200baud, no flow control
  33. * 1-start bit, 8-data bit, non parity, 1-stop bit
  34. */
  35. #define SERIAL_BAUD 1200
  36. #define SERIAL_RXD_DDR DDRD
  37. #define SERIAL_RXD_PORT PORTD
  38. #define SERIAL_RXD_PIN PIND
  39. #define SERIAL_RXD_BIT 2
  40. #define SERIAL_RXD_VECT INT2_vect
  41. #define SERIAL_RXD_INIT() do { \
  42. /* pin configuration: input with pull-up */ \
  43. SERIAL_RXD_DDR &= ~(1<<SERIAL_RXD_BIT); \
  44. SERIAL_RXD_PORT |= (1<<SERIAL_RXD_BIT); \
  45. /* enable interrupt: INT2(rising edge) */ \
  46. EICRA |= ((1<<ISC21)|(1<<ISC20)); \
  47. EIMSK |= (1<<INT2); \
  48. } while (0)
  49. #define SERIAL_RXD_INT_ENTER()
  50. #define SERIAL_RXD_INT_EXIT() do { \
  51. /* clear interrupt flag */ \
  52. EIFR = (1<<INTF2); \
  53. } while (0)
  54. #define SERIAL_RXD_READ() (~SERIAL_RXD_PIN&(1<<SERIAL_RXD_BIT))
  55. #define SERIAL_TXD_DDR DDRD
  56. #define SERIAL_TXD_PORT PORTD
  57. #define SERIAL_TXD_PIN PIND
  58. #define SERIAL_TXD_BIT 3
  59. /* negative logic */
  60. #define SERIAL_TXD_ON() do { SERIAL_TXD_PORT &= ~(1<<SERIAL_TXD_BIT); } while (0)
  61. #define SERIAL_TXD_OFF() do { SERIAL_TXD_PORT |= (1<<SERIAL_TXD_BIT); } while (0)
  62. #define SERIAL_TXD_INIT() do { \
  63. /* pin configuration: output */ \
  64. SERIAL_TXD_DDR |= (1<<SERIAL_TXD_BIT); \
  65. /* idle */ \
  66. SERIAL_TXD_ON(); \
  67. } while (0)
  68. #endif