Skip to content

Commit 3eb33df

Browse files
authored
feather-stm32f405: add I2C support (#1378)
* machine/stm32f405: add initial I2C support
1 parent bb146ed commit 3eb33df

File tree

4 files changed

+573
-5
lines changed

4 files changed

+573
-5
lines changed

src/machine/board_feather-stm32f405.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ const (
202202
// #===========#==========#==============#==============#=======#=======#
203203
// | Interface | Hardware | Bus(Freq) | SDA/SCL Pins | AltFn | Alias |
204204
// #===========#==========#==============#==============#=======#=======#
205-
// | I2C1 | I2C1 | | D14/D15 | | ~ |
206-
// | I2C2 | I2C2 | | D0/D1 | | ~ |
207-
// | I2C3 | I2C1 | | D9/D10 | | ~ |
205+
// | I2C1 | I2C1 | APB1(42 MHz) | D14/D15 | 4 | ~ |
206+
// | I2C2 | I2C2 | APB1(42 MHz) | D0/D1 | 4 | ~ |
207+
// | I2C3 | I2C1 | APB1(42 MHz) | D9/D10 | 4 | ~ |
208208
// | --------- | -------- | ------------ | ------------ | ----- | ----- |
209-
// | I2C0 | I2C1 | | D14/D15 | | I2C1 |
209+
// | I2C0 | I2C1 | APB1(42 MHz) | D14/D15 | 4 | I2C1 |
210210
// #===========#==========#==============#==============#=======#=======#
211211
NUM_I2C_INTERFACES = 3
212212

@@ -226,4 +226,20 @@ const (
226226
I2C_SCL_PIN = I2C0_SCL_PIN //
227227
)
228228

229+
var (
230+
I2C1 = I2C{
231+
Bus: stm32.I2C1,
232+
AltFuncSelector: stm32.AF4_I2C1_2_3,
233+
}
234+
I2C2 = I2C{
235+
Bus: stm32.I2C2,
236+
AltFuncSelector: stm32.AF4_I2C1_2_3,
237+
}
238+
I2C3 = I2C{
239+
Bus: stm32.I2C1,
240+
AltFuncSelector: stm32.AF4_I2C1_2_3,
241+
}
242+
I2C0 = I2C1
243+
)
244+
229245
func initI2C() {}

src/machine/i2c.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build avr nrf sam stm32,!stm32f4 fe310 k210
1+
// +build avr nrf sam stm32,!stm32f407 fe310 k210
22

33
package machine
44

0 commit comments

Comments
 (0)