• Thought I'd give the Espruino Jobs board a go to see if someone can give me a hand with a project I'm working on :)

    I'm looking for a dev to write some code to scan a 4x16 matrix of keys using the Espruino MDBT42Q and an MCP23017 port expander chip.

    The code should be split into a hardware handling module (communication with the MCP chip/driving the matrix/detecting state changes), and a metadata module (keeping track of if keys were pressed or released & how long they were pressed for, determining if they key was 'tapped' or 'held') which fires events.

    The hardware handling module should:

    • Drive the matrix row outputs sequentially from MDBT42Q GPIO pins
    • Detect matrix column inputs from the MCP23017 (ideally using IRQs to handle state changes)
    • Be efficient, keeping as much off the main Espruino thread as possible (likely using NRF52 Programmable Peripheral Interconnect events/tasks)
    • Handle switch debouncing
    • Only fire a key press or release event when a key state has changed, not on every matrix scan
    • Emit hardwareKeyPress/hardwareKeyRelease events with the row & column in the data payload
    • Expose a method to get the current state of a single key
    • Expose a method to get the current state of all keys

    The metadata module should:

    • Keep track of when a key was pressed/released
    • Keep track of how long a key was pressed for
    • Figure out if a key press was a 'tap' or a 'hold', based on a configurable timeout (key press/release cycles below 200ms classed as a 'tap', above 200ms classed as a 'hold')
    • Fire events for all of the above:
      • keyPress when a key is pressed, payload containing key row/column
      • keyRelease when a key is released, payload containing row/column, duration of press
      • keyTap when a key press/release cycle is < 200ms, payload containing row/column
      • keyHold when a a key press/release is > 200ms, payload containing row/column
      • keyHoldStart when a key has been pressed for > 200ms, payload containing row/column
      • keyHoldEnd fired when held key is released, payload containing row/column, duration of press


    • Code should have unit tests, but I know that can be a little tricky with Espruino so I'm happy to drop this
    • Code should be versioned in git if possible, but not essential
    • Code should be reasonably 'tidy' and readable, split into multiple files if needed
    • Code should have at least basic documentation so I can modify it in future, or alternatively a quick handover so I have a good understanding of your approach

    I'm technical with a lot of commercial experience in Javascript & a decent amount with embedded code, but I'm super busy right now and some of this code is a little above my experience level (especially the NRF52 PPI). I can work with you to get this done or leave you to do it solo, whichever you prefer, and I'm pretty flexible on the requirements & implementation - if anything sounds crazy I'm open to a different approach :)

    Primer on keyboard matrix scanning: https://summivox.wordpress.com/2016/06/0­3/keyboard-matrix-scanning-and-debouncin­g/
    Espruino NRF52 Programmable Peripheral Interconnect library: https://www.espruino.com/NRF52LL
    Espruino MCP23017 library: https://www.espruino.com/MCP23xxx
    Untested MCP23017 library with interrupt handling: http://forum.espruino.com/comments/14047­043/


Avatar for consolenaut @consolenaut started