Add advanced layers.

These will need more testing and some ported to tapdance. The bigest
case of this would be TT
This commit is contained in:
Kyle Brown
2018-09-28 14:35:52 -07:00
parent f5dae5f249
commit ad3da0694b
7 changed files with 154 additions and 24 deletions

View File

@@ -13,6 +13,7 @@ HID_REPORT_EVENT = const(5)
KEYCODE_UP_EVENT = const(6)
KEYCODE_DOWN_EVENT = const(7)
MACRO_COMPLETE_EVENT = const(8)
PENDING_KEYCODE_POP_EVENT = const(9)
logger = logging.getLogger(__name__)
@@ -100,6 +101,12 @@ def macro_complete_event():
)
def pending_keycode_pop_event():
return BareEvent(
type=PENDING_KEYCODE_POP_EVENT,
)
def matrix_changed(new_pressed):
def _key_pressed(dispatch, get_state):
dispatch(new_matrix_event(new_pressed))
@@ -116,6 +123,18 @@ def matrix_changed(new_pressed):
except ImportError:
logger.warning('Tried to reset to bootloader, but not supported on this chip?')
if state.pending_keys:
for key in state.pending_keys:
if not key.no_press:
dispatch(keycode_down_event(key))
dispatch(hid_report_event())
if not key.no_release:
dispatch(keycode_up_event(key))
dispatch(hid_report_event())
dispatch(pending_keycode_pop_event())
if state.macro_pending:
macro = state.macro_pending