config.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. /* USB Device descriptor parameter */
  17. #define VENDOR_ID 0xFEED
  18. #define PRODUCT_ID 0x6512
  19. #define DEVICE_VER 0x0001
  20. #define MANUFACTURER QMK
  21. #define PRODUCT XT keyboard converter
  22. /* key matrix size */
  23. #define MATRIX_ROWS 16 // keycode bit: 3-0
  24. #define MATRIX_COLS 8 // keycode bit: 6-4
  25. /* key combination for command */
  26. #define IS_COMMAND() ( \
  27. get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
  28. get_mods() == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
  29. )
  30. #define XT_CLOCK_PIN D1
  31. #define XT_DATA_PIN D0
  32. #define XT_RST_PIN B7
  33. /* hard reset: low pulse for 500ms and after that HiZ for safety */
  34. #define XT_RESET() do { \
  35. writePinLow(XT_RST_PIN); \
  36. setPinOutput(XT_RST_PIN); \
  37. wait_ms(500); \
  38. setPinInput(XT_RST_PIN); \
  39. } while (0)
  40. /* INT1 for falling edge of clock line */
  41. #define XT_INT_INIT() do { \
  42. EICRA |= ((1 << ISC11) | (0 << ISC10)); \
  43. } while (0)
  44. /* clears flag and enables interrupt */
  45. #define XT_INT_ON() do { \
  46. EIFR |= (1 << INTF1); \
  47. EIMSK |= (1 << INT1); \
  48. } while (0)
  49. #define XT_INT_OFF() do { \
  50. EIMSK &= ~(1 << INT1); \
  51. } while (0)
  52. #define XT_INT_VECT INT1_vect