qmk_xap icon indicating copy to clipboard operation
qmk_xap copied to clipboard

[Feature] Add user functionality

Open elpekenin opened this issue 2 years ago • 2 comments

Description

Litle code allowing users to develop custom logic.

  1. Parse incoming user-level(id==3) XAP broadcast messages (receive info from the keyboard) and generate events to be handled by user. Un-populated struct representing the message's content to be filled by user

  2. Hooks for

    • Handling custom messages
    • Pre init
    • On exit
    • New device
    • Device disconnected
    • Housekeeping (run every 0.5 seconds)

    These currently are just empty placeholder functions within user.rs

  3. UserData struct so custom data can be stored/used on user's functions. In the same way as UserBroadcast, the specific implementation is left as an exercise to the reader

Extra: Some minor refactors due to cargo fmt

PS: Haven't tested this particular code further than seeing it compiles, but my fork's code (which is way more complex) works, so this one should too... Unless i forgot copying some small piece

elpekenin avatar Feb 16 '23 19:02 elpekenin