mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
ae864bdf0c
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.
20 lines
234 B
Go
20 lines
234 B
Go
// +build grandcentral_m4
|
|
|
|
package machine
|
|
|
|
import (
|
|
"device/sam"
|
|
)
|
|
|
|
// SPI on the Grand Central M4
|
|
var (
|
|
SPI0 = SPI{
|
|
Bus: sam.SERCOM7_SPIM,
|
|
SERCOM: 7,
|
|
}
|
|
SPI1 = SPI{ // SD card
|
|
Bus: sam.SERCOM2_SPIM,
|
|
SERCOM: 2,
|
|
}
|
|
)
|