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.

79 lines
2.2 KiB

  1. /*
  2. Copyright 2012 Jun Wako <wakojun@gmail.com>
  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. #include "config_common.h"
  16. #define VENDOR_ID 0xFEED
  17. #define PRODUCT_ID 0x6512
  18. #define DEVICE_VER 0x0001
  19. #define MANUFACTURER QMK
  20. #define PRODUCT XT keyboard converter
  21. /* matrix size */
  22. #define MATRIX_ROWS 16 // keycode bit: 3-0
  23. #define MATRIX_COLS 8 // keycode bit: 6-4
  24. /* key combination for command */
  25. #define IS_COMMAND() ( \
  26. get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
  27. get_mods() == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
  28. )
  29. //#define NO_SUSPEND_POWER_DOWN
  30. /*
  31. * XT Pin interrupt
  32. */
  33. #define XT_CLOCK_PORT PORTD
  34. #define XT_CLOCK_PIN PIND
  35. #define XT_CLOCK_DDR DDRD
  36. #define XT_CLOCK_BIT 1
  37. #define XT_DATA_PORT PORTD
  38. #define XT_DATA_PIN PIND
  39. #define XT_DATA_DDR DDRD
  40. #define XT_DATA_BIT 0
  41. #define XT_RST_PORT PORTB
  42. #define XT_RST_PIN PINB
  43. #define XT_RST_DDR DDRB
  44. #define XT_RST_BIT 7
  45. /* hard reset: low pulse for 500ms and after that HiZ for safety */
  46. #define XT_RESET() do { \
  47. XT_RST_PORT &= ~(1<<XT_RST_BIT); \
  48. XT_RST_DDR |= (1<<XT_RST_BIT); \
  49. _delay_ms(500); \
  50. XT_RST_DDR &= ~(1<<XT_RST_BIT); \
  51. } while (0)
  52. /* INT1 for falling edge of clock line */
  53. #define XT_INT_INIT() do { \
  54. EICRA |= ((1<<ISC11) | \
  55. (0<<ISC10)); \
  56. } while (0)
  57. /* clears flag and enables interrupt */
  58. #define XT_INT_ON() do { \
  59. EIFR |= (1<<INTF1); \
  60. EIMSK |= (1<<INT1); \
  61. } while (0)
  62. #define XT_INT_OFF() do { \
  63. EIMSK &= ~(1<<INT1); \
  64. } while (0)
  65. #define XT_INT_VECT INT1_vect