mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Fixed pin ownership checks for I2C.
This commit is contained in:
parent
6aeac3caa6
commit
37209b4826
2 changed files with 6 additions and 10 deletions
|
@ -287,16 +287,13 @@ void i2cInit(I2CDevice device)
|
|||
i2cDevice_t *pDev = &i2cDevice[device];
|
||||
|
||||
const i2cHardware_t *hardware = pDev->hardware;
|
||||
const IO_t scl = pDev->scl;
|
||||
const IO_t sda = pDev->sda;
|
||||
|
||||
if (!hardware) {
|
||||
if (!hardware || IOGetOwner(scl) || IOGetOwner(sda)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IO_t scl = pDev->scl;
|
||||
IO_t sda = pDev->sda;
|
||||
|
||||
RCC_ClockCmd(hardware->rcc, ENABLE);
|
||||
|
||||
IOInit(scl, OWNER_I2C_SCL, RESOURCE_INDEX(device));
|
||||
IOInit(sda, OWNER_I2C_SDA, RESOURCE_INDEX(device));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue