Merge pull request #2712 from misonyo/rttdev

[bsp/lpc54608]write high to scl and sda pin after init
This commit is contained in:
Bernard Xiong 2019-05-22 18:36:33 +08:00 committed by GitHub
commit 292d88e5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 */