XT converter cleanup (#12264)

This commit is contained in:
Ryan
2021-03-18 11:48:09 +11:00
committed by GitHub
parent cc84831cae
commit 9331c22620
9 changed files with 392 additions and 401 deletions

View File

@@ -19,14 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6512
#define DEVICE_VER 0x0001
#define MANUFACTURER QMK
#define PRODUCT XT keyboard converter
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6512
#define DEVICE_VER 0x0001
#define MANUFACTURER QMK
#define PRODUCT XT keyboard converter
/* matrix size */
/* key matrix size */
#define MATRIX_ROWS 16 // keycode bit: 3-0
#define MATRIX_COLS 8 // keycode bit: 6-4
@@ -36,44 +36,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
get_mods() == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
)
//#define NO_SUSPEND_POWER_DOWN
/*
* XT Pin interrupt
*/
#define XT_CLOCK_PORT PORTD
#define XT_CLOCK_PIN PIND
#define XT_CLOCK_DDR DDRD
#define XT_CLOCK_BIT 1
#define XT_DATA_PORT PORTD
#define XT_DATA_PIN PIND
#define XT_DATA_DDR DDRD
#define XT_DATA_BIT 0
#define XT_RST_PORT PORTB
#define XT_RST_PIN PINB
#define XT_RST_DDR DDRB
#define XT_RST_BIT 7
#define XT_CLOCK_PIN D1
#define XT_DATA_PIN D0
#define XT_RST_PIN B7
/* hard reset: low pulse for 500ms and after that HiZ for safety */
#define XT_RESET() do { \
XT_RST_PORT &= ~(1<<XT_RST_BIT); \
XT_RST_DDR |= (1<<XT_RST_BIT); \
_delay_ms(500); \
XT_RST_DDR &= ~(1<<XT_RST_BIT); \
writePinLow(XT_RST_PIN); \
setPinOutput(XT_RST_PIN); \
wait_ms(500); \
setPinInput(XT_RST_PIN); \
} while (0)
/* INT1 for falling edge of clock line */
#define XT_INT_INIT() do { \
EICRA |= ((1<<ISC11) | \
(0<<ISC10)); \
#define XT_INT_INIT() do { \
EICRA |= ((1 << ISC11) | (0 << ISC10)); \
} while (0)
/* clears flag and enables interrupt */
#define XT_INT_ON() do { \
EIFR |= (1<<INTF1); \
EIMSK |= (1<<INT1); \
#define XT_INT_ON() do { \
EIFR |= (1 << INTF1); \
EIMSK |= (1 << INT1); \
} while (0)
#define XT_INT_OFF() do { \
EIMSK &= ~(1<<INT1); \
#define XT_INT_OFF() do { \
EIMSK &= ~(1 << INT1); \
} while (0)
#define XT_INT_VECT INT1_vect
#define XT_INT_VECT INT1_vect