|
@@ -46,8 +46,8 @@ static void gd32_i2c_busy_recovery(uint32_t i2c_periph){
|
|
|
if (i2c_periph == I2C0) {
|
|
if (i2c_periph == I2C0) {
|
|
|
gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_8|GPIO_PIN_9);
|
|
gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_8|GPIO_PIN_9);
|
|
|
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_8|GPIO_PIN_9);
|
|
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_8|GPIO_PIN_9);
|
|
|
- gpio_bit_set(GPIOB, GPIO_PIN_6);
|
|
|
|
|
- gpio_bit_set(GPIOB, GPIO_PIN_7);
|
|
|
|
|
|
|
+ gpio_bit_set(GPIOB, GPIO_PIN_8);
|
|
|
|
|
+ gpio_bit_set(GPIOB, GPIO_PIN_9);
|
|
|
} else {
|
|
} else {
|
|
|
gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_10|GPIO_PIN_11);
|
|
gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_10|GPIO_PIN_11);
|
|
|
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_10|GPIO_PIN_11);
|
|
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_10|GPIO_PIN_11);
|
|
@@ -69,7 +69,7 @@ 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_NONE, 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);
|