Skip to content

Commit f578694

Browse files
ofauchondeadprogram
authored andcommitted
Fix bad I2C0/I2C1 declaration
1 parent 1f73941 commit f578694

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/machine/machine_stm32f103.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,23 @@ func (spi SPI) configurePins(config SPIConfig) {
204204
// There are 2 I2C interfaces on the STM32F103xx.
205205
// Since the first interface is named I2C1, both I2C0 and I2C1 refer to I2C1.
206206
// TODO: implement I2C2.
207+
208+
/*
207209
var (
208210
I2C1 = (*I2C)(unsafe.Pointer(stm32.I2C1))
209211
I2C0 = I2C1
210212
)
213+
*/
211214

212215
type I2C struct {
213216
Bus *stm32.I2C_Type
214217
}
215218

219+
var (
220+
I2C1 = &I2C{Bus: stm32.I2C1}
221+
I2C0 = I2C1
222+
)
223+
216224
func (i2c *I2C) configurePins(config I2CConfig) {
217225
if config.SDA == PB9 {
218226
// use alternate I2C1 pins PB8/PB9 via AFIO mapping

0 commit comments

Comments
 (0)