Skip to content

Analog input keys for the keypad module #10527

@rivimey

Description

@rivimey

I have built a board that includes 4 keyswitches connected to an analog input on an rp2040 mcu. I have a function which reads the analog converter and decodes the result into 4 different keyup / keydown actions.

I would like to simplify the rest of my code by using an event abstration rather than if-blocks, and saw the keypad module includes "Event" and EventQueue, which sounded great -- until I saw that it was not instantiable in normal code.

So... I guess I could reimplement EventQueue in python, though I worry that would cause memory allocation thrashing. However the obvious thing would be to add in an AnalogKeys variant of the keypad module. My existing code is already "programmed" using an array of min-max values and a bitmask of keys, (which it is indeed annoying to prepare, but only needs doing once.)

What I don't know is how to go about making an AnalogKeys class a reality, even just for me. Can you suggest a direction to go in?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions