mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Lock I2C before usage as it should
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@565 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
3281b1a128
commit
192134967d
@ -117,6 +117,7 @@ static void TestTask(void *pvParameters)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (PIOS_I2C_LockDevice(0))
|
||||
{
|
||||
uint8_t buf[20];
|
||||
if (PIOS_I2C_Transfer(I2C_Write, DEVICE_ADDRESS<<1, (uint8_t*)"\x10\xA0\xA1\xA2", 4) != 0)
|
||||
@ -140,6 +141,12 @@ static void TestTask(void *pvParameters)
|
||||
if (memcmp(buf, "\xA0\xA1\xA2",3) != 0)
|
||||
OnError();
|
||||
|
||||
PIOS_I2C_UnlockDevice();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Could not lock device
|
||||
OnError();
|
||||
}
|
||||
|
||||
vTaskDelayUntil(&xLastExecutionTime, 10 / portTICK_RATE_MS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user