Commit Graph

6 Commits

Author SHA1 Message Date
ZodiusInfuser 41225090ef Added some C specific examples for Plasma Stick 2022-10-17 16:15:02 +01:00
ZodiusInfuser ce31f88e2d Added HEADER_I2C_PINS etc for rp application boards 2022-03-30 14:29:02 +01:00
Phil Howard 25bebd888f Use .begin() and .size() as per #213
Correct `I2C::write_bytes` to accept a `const uint8_t*` for the array of bytes.
2022-01-25 18:20:54 +00:00
Phil Howard 6a9697145b Reset unused I2C pins to default when an instance is initialised
This change is specifically intended to avoid a pitfall in MicroPython and will likely have no effect in C++.

When using the REPL in MicroPython it's possible to set up an I2C instance on two pins - ie: 20, 21 - and then subsequently realise these are the wrong pins for your board.

Before this change, these pins would be left hanging even if you created a new I2C instance with new pins - ie: 4, 5 - this would lead to communications failures where they really shouldn't happen. Confusing!
2021-05-21 15:01:11 +01:00
Phil Howard 445737088f Switch drivers over to I2C class, tidy up common include
Removes all driver-specific SDA/SCL pin definitions and defaults.
Pin type is "uint" everywhere, but "PIN_UNUSED" is *int*_max for MicroPython compat. That's still a lot of pins!
Adds baudrate to the I2C class, and allows a driver (like Trackball) to check the baudrate is supported
2021-05-17 11:46:12 +01:00
Phil Howard 42c7555c96 Add common I2C class
This change adds a common I2C class, gathering various I2C functions into a single point of responsibility.

It's necessary for correctly managing the I2C bus pins and state across multiple devices.
2021-05-14 23:02:38 +01:00