
This commit changes the I2C declarations so that the objects are instantiated in each chip file (e.g. machine_atsamd21e18.go) and used to define I2C0 (and similar) in the board file (e.g. board_qtpy.go). This should make it easier to define new board files, and reduces the need for separate *_baremetal.go files. I have tested this the following way: - With the LIS3DH driver example on the Circuit Playground Express and the PyBadge. - With the LSM6DS3 driver example on the Arduino Nano 33 IoT. They both still work fine.
11 строки
503 Б
Go
11 строки
503 Б
Go
// +build !baremetal,!arduino_mkr1000,!arduino_mkrwifi1010,!arduino_nano33,!arduino_zero,!circuitplay_express,!feather_m0,!feather_m4,!grandcentral_m4,!itsybitsy_m0,!itsybitsy_m4,!matrixportal_m4,!metro_m4_airlift,!p1am_100,!pybadge,!pygamer,!pyportal,!qtpy,!trinket_m0,!wioterminal,!xiao
|
|
|
|
package machine
|
|
|
|
// These peripherals are defined separately so that they can be excluded on
|
|
// boards that define their peripherals in the board file (e.g. board_qtpy.go).
|
|
|
|
var (
|
|
SPI0 = SPI{0}
|
|
I2C0 = &I2C{0}
|
|
)
|