adafruit / Adafruit_Seesaw

Arduino library driver for seesaw multi-use chip
93 stars 64 forks source link

allow specifying the `i2c_bus` on neoKey and neoTrellis #63

Closed epinzur closed 2 years ago

epinzur commented 2 years ago

This change is to allow specifying the i2c_bus on neoKey and neoTrellis initialization.

This was done to allow the use of these libraries with boards like the Adafruit Feather RP2040, where the stemma connector is on Wire1 instead of Wire0.

Specifically for use with the Adafruit Feather RP2040, the following is required to use these libraries:

  // setup i2c for Adafruit Feather RP2040
  Wire1.setSDA(2);
  Wire1.setSCL(3);

  //setup neokey on Wire1
  neokey = Adafruit_NeoKey_1x4(NEOKEY_1X4_ADDR, &Wire1);
  neokey.begin()

  // setup neotrellis on Wire1
  trellis = Adafruit_NeoTrellis(NEO_TRELLIS_ADDR, &Wire1);
  trellis.begin()

After the above changes are applied, the examples should work as normal on the Adafruit Feather RP2040 board.