|
@@ -69,13 +69,15 @@ void gd32_i2c_init(uint32_t i2c_device, uint32_t rate){
|
|
|
gd32_i2c_busy_recovery(I2C0);
|
|
gd32_i2c_busy_recovery(I2C0);
|
|
|
_i2c_deinit(I2C0);
|
|
_i2c_deinit(I2C0);
|
|
|
gpio_af_set(GPIOB, GPIO_AF_1, GPIO_PIN_8|GPIO_PIN_9);
|
|
gpio_af_set(GPIOB, GPIO_AF_1, GPIO_PIN_8|GPIO_PIN_9);
|
|
|
- gpio_mode_af(GPIOB ,GPIO_PUPD_NONE, GPIO_PIN_8|GPIO_PIN_9);
|
|
|
|
|
|
|
+ gpio_mode_af(GPIOB ,GPIO_PUPD_PULLUP, GPIO_PIN_8|GPIO_PIN_9);
|
|
|
|
|
+ //gpio_output_options_set(GPIOB, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ,GPIO_PIN_8|GPIO_PIN_9);
|
|
|
} else {
|
|
} else {
|
|
|
rcu_periph_clock_enable(RCU_I2C1);
|
|
rcu_periph_clock_enable(RCU_I2C1);
|
|
|
gd32_i2c_busy_recovery(I2C1);
|
|
gd32_i2c_busy_recovery(I2C1);
|
|
|
_i2c_deinit(I2C1);
|
|
_i2c_deinit(I2C1);
|
|
|
gpio_af_set(GPIOB, GPIO_AF_1, GPIO_PIN_10|GPIO_PIN_11);
|
|
gpio_af_set(GPIOB, GPIO_AF_1, GPIO_PIN_10|GPIO_PIN_11);
|
|
|
- gpio_mode_af(GPIOB ,GPIO_PUPD_NONE, GPIO_PIN_10|GPIO_PIN_11);
|
|
|
|
|
|
|
+ gpio_mode_af(GPIOB ,GPIO_PUPD_PULLUP, GPIO_PIN_10|GPIO_PIN_11);
|
|
|
|
|
+ //gpio_output_options_set(GPIOB, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ,GPIO_PIN_10|GPIO_PIN_11);
|
|
|
}
|
|
}
|
|
|
i2c_clock_config(device, rate, I2C_DTCY_2);
|
|
i2c_clock_config(device, rate, I2C_DTCY_2);
|
|
|
i2c_enable(device);
|
|
i2c_enable(device);
|