By using the flex break-out board, I’ve connected a Microchip MCP23008 8-Bit I/O Expander to the pogo pins of my pinephone.

schematic

MCP23008 DIP

After connecting, i2cdetect shows that the pinephone sees the MCP23008 on the I²C bus (20).

braveheart-swmo:~$ sudo i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

The MCP23008 has 11 registers to configure its functionality.

REGISTER ADDRESSES

  • With i2cset -y 2 0x20 0 0 b the GPIO pins are all set to output (altering register 0 IODIR).
  • With i2cset -y 2 0x20 9 0x01 b GPIO pin GP0 is set to high, turning the LED on (altering register 9 GPIO).
  • With i2cset -y 2 0x20 9 0x00 b GPIO pin GP0 is set to low, turning the LED off.
  • And the following makes the LED flash:
braveheart-swmo:~# while :
> do
> i2cset -y 2 0x20 9 0x01 b
> sleep .5
> i2cset -y 2 0x20 9 0x00 b
> sleep .5
> done
^C
braveheart-swmo:~#