Skip to content

MCP23008 driver is limited to one device #12

@rwaldron

Description

@rwaldron

The MCP23008 supports up to 8 devices on the same bus, by configuring hardware address pins, A0, A1 and A2:


  7-bit Slave Addr ->|
 B7 B6 B5 B4 B3 B2 B1|B0
  X  X  X  X A2 A1 A0|RW
  0  1  0  0  0  0  0| 0  = 0x20 (Default)
  0  1  0  0  0  0  1| 0  = 0x21
  0  1  0  0  0  1  0| 0  = 0x22
  0  1  0  0  0  1  1| 0  = 0x23
  0  1  0  0  1  0  0| 0  = 0x24
  0  1  0  0  1  0  1| 0  = 0x25
  0  1  0  0  1  1  0| 0  = 0x26
  0  1  0  0  1  1  1| 0  = 0x27

The present driver design only supports using 1 MCP23008 device at the default address.

Proposed Solution:

  • Redesign the driver to be a class that produces instances (vs. the present class that just has static methods)
  • Allow an explicitly provided address
  • Fallback to default when no explicit address is provided

If there is interest in pursuing this solution, I would like to try my hand at implementing the upgrade.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions