Skip to content

mcp interrupt registers are cleared before they can be read. #122

@lanrat

Description

@lanrat

The display.begin() method initializes the i2c bus for talking to the MCP23017 and then immediately clears the MCP's registers before allowing any other method to read them out.

This is a problem if the MCP's registers contain information needed before being() is called.
For example, if setting the MCP's interrupts to wake the ESP32 on a touchpad event, the MCP can wake the ESP32 but once woken, the ESP has no way of knowing which touchpad was responsible for the wake event as that register is cleared in begin().

I have been able to hack around this by manually initializing the i2c bus, reading the MCP registers, de-initialize the i2c bus, and finally calling display.begin();

However, this solution is hacky and non-ideal. I propose saving the MCP's registers in begin() before they are cleared, and then allow them to be read out with a getter function.

This would allow developers to ask the display library about the registers at wake time and know which touchpad events (or anything really) caused the wake event.

If this sounds like a good idea I'm happy to provide a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions