From e5ed62251a89d040a84e227216f9eb2aaac7b8ee Mon Sep 17 00:00:00 2001 From: misonyo Date: Wed, 22 May 2019 15:04:55 +0800 Subject: [PATCH] [bsp/lpc54608]write high to scl and sda pin after init --- bsp/lpc54608-LPCXpresso/drivers/drv_i2c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bsp/lpc54608-LPCXpresso/drivers/drv_i2c.c b/bsp/lpc54608-LPCXpresso/drivers/drv_i2c.c index 2d9a3c4d17..39e08af2d3 100644 --- a/bsp/lpc54608-LPCXpresso/drivers/drv_i2c.c +++ b/bsp/lpc54608-LPCXpresso/drivers/drv_i2c.c @@ -56,7 +56,7 @@ static void gpio_set_scl(void *data, rt_int32_t state) else { //bd->scl.base->B[bd->sda.port][bd->sda.pin] = 0; - GPIO_WritePinOutput(bd->scl.base, bd->scl.port, bd->scl.pin, 1); + GPIO_WritePinOutput(bd->scl.base, bd->scl.port, bd->scl.pin, 0); } } @@ -244,6 +244,9 @@ int rt_hw_i2c_init(void) GPIO_PinInit(GPIO, _i2c_bdata.sda.port, _i2c_bdata.sda.pin, &pin_config); GPIO_PinInit(GPIO, _i2c_bdata.scl.port, _i2c_bdata.scl.pin, &pin_config); + GPIO_WritePinOutput(GPIO, _i2c_bdata.sda.port, _i2c_bdata.sda.pin, 1); + GPIO_WritePinOutput(GPIO, _i2c_bdata.scl.port, _i2c_bdata.scl.pin, 1); + i2c_device.priv = (void *)&_i2c_bit_ops; rt_i2c_bit_add_bus(&i2c_device, "i2c2"); } /* register I2C */