Этот коммит содержится в:
Olivier Fauchon 2021-05-03 00:57:21 +02:00 коммит произвёл Ron Evans
родитель 1f73941c43
коммит f5786941e5

Просмотреть файл

@ -204,15 +204,23 @@ func (spi SPI) configurePins(config SPIConfig) {
// There are 2 I2C interfaces on the STM32F103xx. // There are 2 I2C interfaces on the STM32F103xx.
// Since the first interface is named I2C1, both I2C0 and I2C1 refer to I2C1. // Since the first interface is named I2C1, both I2C0 and I2C1 refer to I2C1.
// TODO: implement I2C2. // TODO: implement I2C2.
/*
var ( var (
I2C1 = (*I2C)(unsafe.Pointer(stm32.I2C1)) I2C1 = (*I2C)(unsafe.Pointer(stm32.I2C1))
I2C0 = I2C1 I2C0 = I2C1
) )
*/
type I2C struct { type I2C struct {
Bus *stm32.I2C_Type Bus *stm32.I2C_Type
} }
var (
I2C1 = &I2C{Bus: stm32.I2C1}
I2C0 = I2C1
)
func (i2c *I2C) configurePins(config I2CConfig) { func (i2c *I2C) configurePins(config I2CConfig) {
if config.SDA == PB9 { if config.SDA == PB9 {
// use alternate I2C1 pins PB8/PB9 via AFIO mapping // use alternate I2C1 pins PB8/PB9 via AFIO mapping