Skip to content

Commit c12f9d5

Browse files
committed
polish
1 parent 059e0c5 commit c12f9d5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bsp/gd32/arm/libraries/gd32_drivers/drv_hw_i2c.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static const struct gd32_i2c_config i2c_configs[] =
1717
{
1818
#ifdef BSP_USING_HW_I2C0
1919
{
20-
.i2c_periph = I2C0, .device_name = "i2c0", .periph_clk = RCU_I2C0,.i2c_clock_hz = BSP_HW_I2C0_CLOCK_SPEED,
20+
.i2c_periph = I2C0, .device_name = "i2c0", .periph_clk = RCU_I2C0, .i2c_clock_hz = BSP_HW_I2C0_CLOCK_SPEED,
2121
.scl_clk = RCU_GPIOB, .scl_port = GPIOB, .scl_pin = GPIO_PIN_6, .scl_af = GPIO_AF_1,
2222
.sda_clk = RCU_GPIOB, .sda_port = GPIOB, .sda_pin = GPIO_PIN_7, .sda_af = GPIO_AF_1,
2323
.ev_irq_type = I2C0_EV_IRQn, .er_irq_type = I2C0_ER_IRQn,
@@ -431,11 +431,13 @@ static rt_ssize_t gd32_i2c_master_xfer(struct rt_i2c_bus_device *bus, struct rt_
431431
{
432432
LOG_D("[%s] Last message, Waiting STOP.", cfg->device_name);
433433
rt_uint32_t timeout = 1000;
434-
while(I2C_STAT1(cfg->i2c_periph) & I2C_STAT1_I2CBSY && timeout--)
434+
while (I2C_STAT1(cfg->i2c_periph) & I2C_STAT1_I2CBSY && timeout--)
435435
{
436436
rt_hw_us_delay(1);
437437
}
438-
} else {
438+
}
439+
else
440+
{
439441
LOG_D("[%s] Last message has NO_STOP flag, leaving bus active.", cfg->device_name);
440442
}
441443
}

bsp/gd32/arm/libraries/gd32_drivers/drv_hw_i2c.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* Change Logs:
7-
* Date Author Notes
86
*/
97

108
#ifndef __DRV_HW_I2C_H__

0 commit comments

Comments
 (0)