config.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #define DESCRIPTION convert XT keyboard to USB
  22. /* 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 NO_SUSPEND_POWER_DOWN
  31. /*
  32. * XT Pin interrupt
  33. */
  34. #define XT_CLOCK_PORT PORTD
  35. #define XT_CLOCK_PIN PIND
  36. #define XT_CLOCK_DDR DDRD
  37. #define XT_CLOCK_BIT 1
  38. #define XT_DATA_PORT PORTD
  39. #define XT_DATA_PIN PIND
  40. #define XT_DATA_DDR DDRD
  41. #define XT_DATA_BIT 0
  42. #define XT_RST_PORT PORTB
  43. #define XT_RST_PIN PINB
  44. #define XT_RST_DDR DDRB
  45. #define XT_RST_BIT 7
  46. /* hard reset: low pulse for 500ms and after that HiZ for safety */
  47. #define XT_RESET() do { \
  48. XT_RST_PORT &= ~(1<<XT_RST_BIT); \
  49. XT_RST_DDR |= (1<<XT_RST_BIT); \
  50. _delay_ms(500); \
  51. XT_RST_DDR &= ~(1<<XT_RST_BIT); \
  52. } while (0)
  53. /* INT1 for falling edge of clock line */
  54. #define XT_INT_INIT() do { \
  55. EICRA |= ((1<<ISC11) | \
  56. (0<<ISC10)); \
  57. } while (0)
  58. /* clears flag and enables interrupt */
  59. #define XT_INT_ON() do { \
  60. EIFR |= (1<<INTF1); \
  61. EIMSK |= (1<<INT1); \
  62. } while (0)
  63. #define XT_INT_OFF() do { \
  64. EIMSK &= ~(1<<INT1); \
  65. } while (0)
  66. #define XT_INT_VECT INT1_vect