Merge branch 'next_fix_753'
This commit is contained in:
commit
162674035d
6 changed files with 1125 additions and 1276 deletions
|
|
@ -95,6 +95,17 @@ SRC += next_kbd.c
|
|||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
# Suspend mode:
|
||||
# Mode Power consumption RemoteWakeup Replug during suspend
|
||||
# -----------------------------------------------------------------------------------
|
||||
# STANDBY 10mA NG OK
|
||||
# POWER_DOWN 10mA OK OK
|
||||
# IDLE 23mA OK OK
|
||||
# NOPOWERSAVE 23mA OK OK
|
||||
# NO_POWER_DOWN 23mA OK OK
|
||||
# RemoteWakeup does not work with STANDBY due to NeXT query&response protocol.
|
||||
# Use Power Down mode(default).
|
||||
#OPT_DEFS += -DSUSPEND_MODE_STANDBY
|
||||
|
||||
include $(TMK_DIR)/protocol.mk
|
||||
include $(TMK_DIR)/protocol/lufa.mk
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
TARGET = next_usb_unimap
|
||||
UNIMAP_ENABLE = yes
|
||||
KEYMAP_SECTION_ENABLE = yes
|
||||
|
||||
# LUFA debug print enabled temporarily for this issue:
|
||||
# https://github.com/tmk/tmk_keyboard/issues/753
|
||||
TMK_LUFA_DEBUG = yes
|
||||
|
||||
include Makefile
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -76,8 +76,6 @@ static bool is_modified = false;
|
|||
|
||||
#define NEXT_KBD_PWR_READ (NEXT_KBD_PWR_PIN&(1<<NEXT_KBD_PWR_BIT))
|
||||
|
||||
static bool power_state = false;
|
||||
|
||||
/* intialize matrix for scanning. should be called once. */
|
||||
void matrix_init(void)
|
||||
{
|
||||
|
|
@ -94,10 +92,7 @@ void matrix_init(void)
|
|||
NEXT_KBD_LED1_ON;
|
||||
|
||||
NEXT_KBD_PWR_DDR &= ~(1<<NEXT_KBD_PWR_BIT); // Power Button pin to input
|
||||
NEXT_KBD_PWR_PIN |= (1<<NEXT_KBD_PWR_BIT); // KBD_PWR pull up
|
||||
|
||||
power_state = NEXT_KBD_PWR_READ ? false : true;
|
||||
dprintf("Initial power button state: %b\n", power_state);
|
||||
NEXT_KBD_PWR_PORT |= (1<<NEXT_KBD_PWR_BIT); // KBD_PWR pull up
|
||||
|
||||
next_kbd_init();
|
||||
|
||||
|
|
@ -155,20 +150,8 @@ uint8_t matrix_scan(void)
|
|||
|
||||
if (!NEXT_KBD_PWR_READ) {
|
||||
matrix_make(NEXT_KBD_PWR_KEYCODE);
|
||||
power_state = 1;
|
||||
if (is_modified)
|
||||
{
|
||||
dprintf("Power state 1\n");
|
||||
|
||||
}
|
||||
} else {
|
||||
matrix_break(NEXT_KBD_PWR_KEYCODE);
|
||||
power_state = 0;
|
||||
if (is_modified)
|
||||
{
|
||||
dprintf("Power state 0\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t resp = (next_kbd_recv());
|
||||
|
|
@ -187,6 +170,7 @@ uint8_t matrix_scan(void)
|
|||
);
|
||||
#endif
|
||||
|
||||
/*
|
||||
dprintf("[ r=%04lX keycode=%02X pressed=%X CTRL=%X SHIFT_LEFT=%X SHIFT_RGHT=%X CMD_LEFT=%X CMD_RGHT=%X ALT_LEFT=%X ALT_RGHT=%X ]\n", \
|
||||
resp, \
|
||||
NEXT_KBD_KEYCODE(resp), \
|
||||
|
|
@ -199,6 +183,7 @@ uint8_t matrix_scan(void)
|
|||
NEXT_KBD_PRESSED_ALT_LEFT(resp), \
|
||||
NEXT_KBD_PRESSED_ALT_RGHT(resp) \
|
||||
);
|
||||
*/
|
||||
|
||||
// Modifier keys don't return keycode; have to check the upper bits
|
||||
NEXT_KBD_MAKE_OR_BREAK(ALT_RGHT, 0x51);
|
||||
|
|
@ -226,6 +211,7 @@ static void matrix_make(uint8_t code)
|
|||
if (!matrix_is_on(ROW(code), COL(code))) {
|
||||
matrix[ROW(code)] |= 1<<COL(code);
|
||||
is_modified = true;
|
||||
dprintf("%02X ", code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,5 +221,6 @@ static void matrix_break(uint8_t code)
|
|||
if (matrix_is_on(ROW(code), COL(code))) {
|
||||
matrix[ROW(code)] &= ~(1<<COL(code));
|
||||
is_modified = true;
|
||||
dprintf("%02X ", code | 0x80);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ TMK_LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_E
|
|||
TMK_LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
|
||||
TMK_LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
|
||||
# Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361
|
||||
ifeq ($(MCU),atmega32u2)
|
||||
ifeq (atmega32u2,$(strip $(MCU)))
|
||||
TMK_LUFA_OPTS += -DNO_LIMITED_CONTROLLER_CONNECT
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
|||
Endpoint_ClearOUT();
|
||||
Endpoint_ClearStatusStage();
|
||||
#ifdef TMK_LUFA_DEBUG
|
||||
xprintf("[L%d]", USB_ControlRequest.wIndex);
|
||||
xprintf("[L%d %02X]", USB_ControlRequest.wIndex, keyboard_led_stats);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
|
@ -490,7 +490,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
|||
keyboard_protocol = (USB_ControlRequest.wValue & 0xFF);
|
||||
clear_keyboard();
|
||||
#ifdef TMK_LUFA_DEBUG
|
||||
print("[P]");
|
||||
xprintf("[P%d %04X]", USB_ControlRequest.wIndex, USB_ControlRequest.wValue);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
@ -515,7 +515,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
|||
|
||||
keyboard_idle = ((USB_ControlRequest.wValue & 0xFF00) >> 8);
|
||||
#ifdef TMK_LUFA_DEBUG
|
||||
xprintf("[I%d]%d", USB_ControlRequest.wIndex, (USB_ControlRequest.wValue & 0xFF00) >> 8);
|
||||
xprintf("[I%d %04X]", USB_ControlRequest.wIndex, USB_ControlRequest.wValue);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue