Merge branch 'xt_rev2'

This commit is contained in:
tmk 2018-04-17 10:56:55 +09:00
commit ec49ce3be6
12 changed files with 5084 additions and 103 deletions

View file

@ -11,7 +11,8 @@ TMK_DIR = ../../tmk_core
TARGET_DIR = .
# project specific files
SRC = matrix.c \
SRC = protocol/xt_interrupt.c \
matrix.c \
led.c
ifdef KEYMAP
@ -61,7 +62,7 @@ ARCH = AVR8
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
@ -71,6 +72,7 @@ F_USB = $(F_CPU)
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=512
#OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
@ -84,11 +86,6 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # USB Nkey Rollover
# XT/2 Options
#
XT_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -45,8 +45,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* XT Pin interrupt
*/
#ifdef XT_USE_INT
/* uses INT1 for clock line(ATMega32U4) */
#define XT_CLOCK_PORT PORTD
#define XT_CLOCK_PIN PIND
#define XT_CLOCK_DDR DDRD
@ -55,17 +53,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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
/* 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); \
} while (0)
/* INT1 for falling edge of clock line */
#define XT_INT_INIT() do { \
EICRA |= ((1<<ISC11) | \
(1<<ISC10)); \
(0<<ISC10)); \
} while (0)
/* clears flag and enables interrupt */
#define XT_INT_ON() do { \
EIFR |= (1<<INTF1); \
EIMSK |= (1<<INT1); \
} while (0)
#define XT_INT_OFF() do { \
EIMSK &= ~(1<<INT1); \
} while (0)
#define XT_INT_VECT INT1_vect
#endif
#endif

View file

@ -120,6 +120,7 @@ uint8_t matrix_scan(void)
}
uint8_t code = xt_host_recv();
if (code) xprintf("%02X ", code);
switch (state) {
case INIT:
switch (code) {
@ -131,10 +132,8 @@ uint8_t matrix_scan(void)
break;
default: // normal key make
if (code < 0x80 && code != 0x00) {
xprintf("make: %X\r\n", code);
matrix_make(code);
} else if (code > 0x80 && code < 0xFF && code != 0x00) {
xprintf("break %X\r\n", code);
matrix_break(code - 0x80);
}
state = INIT;