mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
f845b469b1
This fixes/improves a few issues with I2C support:
* Validate I2C pins, so only pins that are supported by the hardware
can be used (similar to how it's done with PWM).
* Add address to Tx API (without it, the simulator can't really
simulate I2C).
* Add frequency when configuring. Not currently used, but might be
useful in the future and adding it now avoids possibly breaking
changes.
This is a breaking change, but since the simulator doesn't support I2C
yet that seems fine to me. (It does in my local changes, but those need
to be cleaned up before I can push them).
7 lines
124 B
Go
7 lines
124 B
Go
//go:build !baremetal && (microbit || pca10031 || hw_651)
|
|
|
|
package machine
|
|
|
|
var I2C0 = &I2C{Bus: 0}
|
|
var I2C1 = &I2C{Bus: 1}
|