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:
Ayke van Laethem
2021-10-15 22:52:34 +02:00
committed by Ron Evans
parent e50885a6f2
commit ae864bdf0c
42 changed files with 169 additions and 153 deletions
+4 -16
View File
@@ -254,28 +254,16 @@ var (
// I2C on the SAM E54 Xplained Pro
var (
// Extension Header EXT1
I2C0 = I2C{
Bus: sam.SERCOM3_I2CM,
SERCOM: 3,
}
I2C0 = sercomI2CM3
// Extension Header EXT2
I2C1 = I2C{
Bus: sam.SERCOM7_I2CM,
SERCOM: 7,
}
I2C1 = sercomI2CM7
// Extension Header EXT3
I2C2 = I2C{
Bus: sam.SERCOM7_I2CM,
SERCOM: 7,
}
I2C2 = sercomI2CM7
// Data Gateway Interface
I2C3 = I2C{
Bus: sam.SERCOM7_I2CM,
SERCOM: 7,
}
I2C3 = sercomI2CM7
)
// SPI on the SAM E54 Xplained Pro