Commit Graph

110 Commits

Author SHA1 Message Date
Josh Klar
0d847f99ef
Make some events (and especially macros) faster by caching BareEvents and many key events in RAM 2018-10-08 05:04:06 -07:00
Josh Klar
aa423e3690
Fix an exhausted generator bug by converting to list 2018-10-08 03:59:16 -07:00
Josh Klar
eca4bf087e
Ability to create emote/emoji macros from strings directly, on-board. 2018-10-08 03:51:02 -07:00
Josh Klar
bf8ad1319a
Allow natural LEADER_MODE rollover 2018-10-08 03:21:39 -07:00
Josh Klar
c6d8e5b406
Simplify LeaderHelper stuff, unbreak my own boards 2018-10-08 02:41:43 -07:00
Josh Klar
8c9fc9db95
@kdb424's Leader Mode work as a clean diff 2018-10-08 02:31:30 -07:00
Josh Klar
6d204176e0
Unbreak pyboards 2018-10-07 04:54:25 -07:00
Josh Klar
392f8d7e51
Abstract away platform-dependent pin references
Quote taken straight from the docstring of get_pin:

>Cross-platform method to find a pin by string.
>
>The pin definitions are platform-dependent, but this provides
>a way to say "I'm using pin D20" without rolling a D20 and
>having to actually learn MicroPython/CircuitPython and the
>differences in how they handle pinouts.
>
>This also makes the keymap sanity checker actually work for
>CircuitPython boards, since it's not possible in CPY to
>define a module stub for `board` that uses Passthrough
>natively (which is how the MicroPython stub worked originally)
2018-10-07 01:40:09 -07:00
Josh Klar
a23acc6131
Update various internal key handling stuff to be CircuitPython-compatible 2018-10-07 00:45:35 -07:00
Josh Klar
d379acfc97
Support ItsyBitsy M4 Express as an effective clone of the Feather M4 Express with less pins. Because that's what it is. 2018-10-07 00:45:34 -07:00
Josh Klar
c4c28ad039
Decrease typing lag by about 80 billion percent by upping the logging threshold to WARNING on SAMD51 2018-10-07 00:45:33 -07:00
Josh Klar
472b08d77b
Support KEYBOARD and CONSUMER modes of HID on Feather M4 Express 2018-10-07 00:45:32 -07:00
Josh Klar
ae3eda26b9
Make kmk_keyboard_user importable on SAMD51 by reducing recursion (read: import) depth 2018-10-07 00:45:31 -07:00
Josh Klar
e11934ab2d
Able to build a VERY basic KMK image for Feather M4 Express, flashable over UF2 only 2018-10-07 00:45:30 -07:00
Josh Klar
d61f4470af
Make KC object lazy but cached to avoid huge AttrDict compilation (most keycodes probably are not used anyway) 2018-10-06 03:28:17 -07:00
Kyle Brown
ad3da0694b Add advanced layers.
These will need more testing and some ported to tapdance. The bigest
case of this would be TT
2018-10-03 22:35:00 -07:00
Josh Klar
fbefed283b
Return state by default on Macro if not a key up or key down event 2018-10-01 21:54:01 -07:00
Josh Klar
552e848a27
Handle macros more consistently: make them a proper internal keycode-style object and not a weird one-off. Fixes sanity_checker on my keymaps. 2018-10-01 11:54:43 -07:00
Josh Klar
f80873fdd0
Roll back the tuple indexing change (now access by dot notation), optimize GESC and fix a bug in how it interacts with the reducer 2018-10-01 01:07:57 -07:00
Josh Klar
b5457534bf
Completely overhaul the entire MatrixScanner and KEY_UP/DOWN_EVENT system for efficiency. Less delay() on HID sends. Speed is only BARELY slower than QMK now. 2018-10-01 00:33:59 -07:00
Josh Klar
784f8885bd
Remove a ton of dict lookups for minor perf gains 2018-10-01 00:33:58 -07:00
Josh Klar
fde9b7e274
Add support for millisecond delays within a macro sequence 2018-09-30 21:34:16 -07:00
Josh Klar
2c05efa805
Support a massively-enhanced SEND_STRING equivalent 2018-09-30 21:14:30 -07:00
Josh Klar
96b5c4ee03
Ensure we always send at least four characters when sending Unicode sequences to better support MacOS/Windows 2018-09-30 20:49:40 -07:00
Josh Klar
0ccd27703d
Support Unicode sequences on Windows through WinCompose ONLY 2018-09-30 20:35:41 -07:00
Josh Klar
692d95018f
Enable switching Unicode modes at runtime; lots of Keycode cleanup again 2018-09-30 20:21:42 -07:00
Josh Klar
ffa81bcf43
Massive refactor largely to support Unicode on Mac
This does a bunch of crazy stuff:

- The ability to set a unicode mode (right now only Linux+ibus or
MacOS-RALT) in the keymap. This will be changeable at runtime soon, to
allow a single keyboard to be able to send table flips and whatever
other crazy stuff on any OS the board is plugged into (something that's
not currently doable on QMK, so yay us?)

- As part of the above, there is now just one user-facing macro for
unicode codepoint submission,
`kmk.common.macros.unicode.unicode_sequence`. Users should never use the
platform-specific macros, partly because they just outright won't work.
There's all sorts of fun stuff in these methods now, thank goodness
MicroPython supports the `yield from` construct.

- Keycode (these should really be renamed Keysym or something) objects
that are intended to not be pressed, or not be released. Right now these
properties are completely ignored if not part of a macro, and it's
probably sane to keep it that way. This was necessary to support MacOS's
"hold RALT while typing the codepoint characters" flow.

- Other refactor-y bits, like moving macro support to `kmk/common`
rather than sitting at the top level of the tree. One day `kmk/common`
may make sense to surface at top level `kmk/`, but that's a discussion
for another day.
2018-09-30 19:33:23 -07:00
Josh Klar
2024eb959f
Support the real reason we're all here: unicode key sequences (Linux only). Basically takes the same output style as klardotsh/qmk_emote_macro_generator outputs 2018-09-30 18:20:18 -07:00
Josh Klar
bdd4f86472
Support a simple macro of a sequence of keycodes (basis for SEND_STRING) 2018-09-30 18:03:43 -07:00
Josh Klar
99573de217
Epic keycode cleanup; make modifiers callable and chainable 2018-09-30 17:58:36 -07:00
Josh Klar
b7b1866ac9
HID: Support Consumer (media) keys
What a short title for such a massive diff.

This (heavily squashed) commit adds support for Consumer keys such as
volume keys, media play/pause/stop, etc. by exposing four HID devices
over a single USB lane (as opposed to just exposing a keyboard). This
heavily refactors how HIDHelper works due to the new reporting
structure.

Many of the media keys were changed (mostly Keycodes.Media section), but
many (especially anything regarding Application keys) haven't been
touched yet - thus many keycodes may still be wrong. Probably worth
updating those soon, but I didn't get around to it yet. The definitive
list I refered to was
http://www.freebsddiary.org/APC/usb_hid_usages.php, which is basically
copy-pasta from the official USB HID spec at
https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
(warning: massive PDF, not light reading).

The only known regression this introduces is that instead of 6KRO as the
USB spec usually supports, we can now only have 5KRO (maybe even 4KRO),
for reasons I have yet to fully debug - this seems to be related to the
report having to include the device descriptor _and_ not supporting a
full 8 bytes as it used to. For now I'm willing to accept this, but it
definitely will be great to squash that bug.

This adds descriptor support for MOUSE and SYSCONTROL devices, as of yet
unimplemented.
2018-09-30 16:08:08 -07:00
Kyle Brown
5de46e33bc
KC_GESC: Escape key that can also work as Grave/Tilde 2018-09-29 16:20:21 -07:00
Kyle Brown
b3469d9fb2 Most changes requested were done, and other general improvements. 2018-09-28 20:20:10 -07:00
Kyle Brown
b8a27b9605 Set better keycode values for KC_NO and KC_TRANSPARENT which is an alias to KC_TRNS 2018-09-24 18:01:03 -07:00
Josh Klar
ef921a5b99
Support ShiftedKeys, though the CODE_ stuff is odd 2018-09-23 05:19:57 -07:00
Josh Klar
94130740c4
Write a basic keymap sanity checker utility 2018-09-23 03:03:49 -07:00
Josh Klar
97091ff4fd
Make user keymaps fully declarative
This removes the need for the user to define... most things, honestly.
Notably, `main()` is no longer the end user's responsibility. This also
allows us to do fun stuff going forward like validating keymaps for
sanity (ex: the key assigned to `KC_MO(x)` should be assigned to
`KC_TRNS` on the target layer or the user will never be able to escape
that layer).

This also disambiguates `BOARD` to always refer to an actual slab of
silicon, renaming to `USER_KEYMAP`.

Entrypoints are now a bit more wild, and mostly-unsupported boards no
longer have working entrypoints. It's probably just time to scrap those
boards for now (until we have BLE HID and/or bitbang USB HID, at least).
2018-09-23 03:03:47 -07:00
Josh Klar
634e6f14e6
Support TO and TG layer switching 2018-09-23 00:14:30 -07:00
Josh Klar
8c7c9958f9
Unbreak the reset key by removing dead code path (for now) 2018-09-23 00:14:29 -07:00
Josh Klar
9bec905fce
Holy refactor, Batman: full layer support (MO/DF)
Wow, what a trip this was. Layer support is now fully implemented. Other
changes here mostly revolve around the event dispatching model: more
floating state (hidden in clases wherever) has been purged, with the
reducer (now mutable, comments inline) serving, as it should, as the
sole source of truth. Thunk support has been added to our fake Redux
clone, allowing Action Creators to handle sequences of events (which is
arguably a cleaner way of handling matrix changes when not all matrix
changes should result in a new HID report - in the case of internal
keys). A whole class has been deprecated (Keymap) which only served as
another arbitor of state: instead, the MatrixScanner has been made
smarter and handles diffing internally, dispatching an Action when
needed (and allowing the reducer to parse the keymap and figure out what
key is pressed - this is the infinitely cleaner solution when layers
come into play).
2018-09-23 00:14:28 -07:00
Kyle Brown
0ae3adcc84
Added more work to shifted keycodes. 2018-09-23 00:14:28 -07:00
Kyle Brown
fb053b7de4
Fix keycodes, and update keymap in prep for working layers 2018-09-23 00:14:24 -07:00
Josh Klar
5787731890
Add support for changing to N layers as needed 2018-09-23 00:13:32 -07:00
Josh Klar
392917082a
Unbreak the general idea of KC_DF and KC_MO, though still needs heavy refactors 2018-09-23 00:13:32 -07:00
Kyle Brown
7ae2d18e45
Very broken, but some work done probably 2018-09-23 00:13:30 -07:00
Kyle Brown
d0f35100b3
Start of internal keycodes 2018-09-23 00:13:28 -07:00
Kyle Brown
f84c58a03e Added more keycodes 2018-09-20 14:50:59 -07:00
Josh Klar
fa195a3e3d Save a shit ton of perf, turns out making huge dicts every keystroke was AWFUL 2018-09-16 23:31:00 -07:00
Josh Klar
3e99f0c8e3 Listen to KEY_DOWN_EVENT and KEY_UP_EVENT in the HIDHelper and actually send. Working keyboard! ⌨ 2018-09-16 23:20:16 -07:00
Josh Klar
6933d9c484 Allow super simple keymap keycode definitions (very QMK-ish) 2018-09-16 22:17:30 -07:00
Josh Klar
88807837d5 Misc. cleanup around the tree 2018-09-16 20:50:05 -07:00
Josh Klar
7f88f4f415 Implement basic HID keyboard support (send_string works great!) 2018-09-16 20:49:47 -07:00
Josh Klar
27f1e971b0 Add HID keycodes in a semi-structured manner 2018-09-16 18:30:44 -07:00
Josh Klar
f5fc555ac5 Support the PyBoard v1.1 as much as the Feather was, at least 2018-09-16 00:17:30 -07:00
Josh Klar
ffd47c478f Move all remaining state into the single store, woot! 2018-09-03 15:21:34 -07:00
Josh Klar
ea18655a21 On unhandled exceptions, blink the feather LED repeatedly 2018-09-03 15:20:27 -07:00
Josh Klar
ef639f5292 Add debug hooks to the event dispatcher, remove explicit prints 2018-09-03 13:50:12 -07:00
Josh Klar
d9b909d841 Event dispatching, super simply 2018-09-03 04:22:52 -07:00
Josh Klar
d5de2601d9 Prepare things for the event loop, also abstract gross stuff from end users 2018-09-03 03:22:11 -07:00
Josh Klar
e9d448af44 A basic 2x2 matrix that can auto-flash to a Feather with a compatible bootloader 2018-09-02 20:07:07 -07:00