devices icon indicating copy to clipboard operation
devices copied to clipboard

Direct Register Access for MCP23xxx

Open gsexton opened this issue 4 years ago • 1 comments

What kind of new feature are you looking for?

I'm trying to figure out how to get direct access to the MCP23008 GPIO register using the MCP23xxx package. The only interface I see exposed is via pins. I'm writing a driver for the Adafruit I2c/SPI backpack, and it uses the MCP23008.

The need is because to send a character to the backpack you have to:

Set the reset pin on the GPIO Write A value to pins 3-6 (data), and pin 2 low (enable) Toggle Pin 2 High Wait a period Toggle Pin 2 Low Write A value to pins 3-6 (data), and pin 2 low (enable) Toggle Pin 2 High Wait a period Toggle Pin 2 Low

If I have to set each pin individually, that stacks up to a fair number of I2c transactions.

  • Hardware: MCP23008 (on Adafruit i2c/SPI backpack)
  • Software: Linux, Raspbian, I2C

Do you plan to: If there's not a method, I could contribute a patch.

  • Contribute an initial driver: I could contribute a patch.
  • Write unit tests: Yes
  • Update https://github.com/periph/cmd to use the new functionality: No

Thanks

George

gsexton avatar Aug 10 '21 23:08 gsexton

I'm fine with a specific new method on the Dev struct. I wished I had to time to make a pure mechanism but still hasn't done that.

maruel avatar Aug 15 '21 00:08 maruel