[bsp/lpc54608]write high to scl and sda pin after init

This commit is contained in:
misonyo 2019-05-22 15:04:55 +08:00
parent 874ca543ac
commit e5ed62251a
1 changed files with 4 additions and 1 deletions

View File

@ -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 */