Implemented working I2C on F412.
This commit is contained in:
parent
d96aa8dac4
commit
78de4b70ed
@ -247,7 +247,7 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
|
|||||||
PB6 ------> I2C1_SCL
|
PB6 ------> I2C1_SCL
|
||||||
PB7 ------> I2C1_SDA
|
PB7 ------> I2C1_SDA
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = I2C1_SCL_Pin|I2C1_SDA_Pin;
|
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
@ -57,7 +57,9 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else if (mcu_i2c_list[i]->scl_pin == scl) {
|
}
|
||||||
|
|
||||||
|
if (mcu_i2c_list[i]->scl_pin == scl) {
|
||||||
switch (mcu_i2c_list[i]->i2c_index) {
|
switch (mcu_i2c_list[i]->i2c_index) {
|
||||||
case 1: I2Cx_check = I2C1;
|
case 1: I2Cx_check = I2C1;
|
||||||
break;
|
break;
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
//const mcu_i2c_periph_obj_t periph_I2C2 = I2C(1, NO_ALT, SDA(PB,11), SCL(PB,10));
|
//const mcu_i2c_periph_obj_t periph_I2C2 = I2C(1, NO_ALT, SDA(PB,11), SCL(PB,10));
|
||||||
//const mcu_i2c_periph_obj_t periph_I2C3 = I2C(1, NO_ALT, SDA(PB,9), SCL(PB,8));
|
//const mcu_i2c_periph_obj_t periph_I2C3 = I2C(1, NO_ALT, SDA(PB,9), SCL(PB,8));
|
||||||
|
|
||||||
|
//WARNING: The STM32F412 has a bunch of repeated ones on AF9 so BEWARE
|
||||||
|
|
||||||
const mcu_i2c_periph_obj_t periph_I2C1_0 = I2C(1, 0, &pin_PB07, &pin_PB06);
|
const mcu_i2c_periph_obj_t periph_I2C1_0 = I2C(1, 0, &pin_PB07, &pin_PB06);
|
||||||
const mcu_i2c_periph_obj_t periph_I2C1_1 = I2C(1, 1, &pin_PB09, &pin_PB08);
|
const mcu_i2c_periph_obj_t periph_I2C1_1 = I2C(1, 1, &pin_PB09, &pin_PB08);
|
||||||
const mcu_i2c_periph_obj_t periph_I2C2 = I2C(1, NO_ALT, &pin_PB11, &pin_PB10); //not on LQFP100
|
const mcu_i2c_periph_obj_t periph_I2C2 = I2C(1, NO_ALT, &pin_PB11, &pin_PB10); //not on LQFP100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user