mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
sam: simplify I2C peripheral declarations
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.
This commit is contained in:
committed by
Ron Evans
parent
e50885a6f2
commit
ae864bdf0c
@@ -5,8 +5,6 @@ package machine
|
||||
// Dummy machine package that calls out to external functions.
|
||||
|
||||
var (
|
||||
SPI0 = SPI{0}
|
||||
I2C0 = &I2C{0}
|
||||
UART0 = &UART{0}
|
||||
USB = &UART{100}
|
||||
)
|
||||
@@ -175,4 +173,13 @@ var (
|
||||
sercomUSART3 = UART{3}
|
||||
sercomUSART4 = UART{4}
|
||||
sercomUSART5 = UART{5}
|
||||
|
||||
sercomI2CM0 = &I2C{0}
|
||||
sercomI2CM1 = &I2C{1}
|
||||
sercomI2CM2 = &I2C{2}
|
||||
sercomI2CM3 = &I2C{3}
|
||||
sercomI2CM4 = &I2C{4}
|
||||
sercomI2CM5 = &I2C{5}
|
||||
sercomI2CM6 = &I2C{6}
|
||||
sercomI2CM7 = &I2C{7}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user