1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Fixed test

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@576 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
FredericG 2010-05-03 18:18:43 +00:00 committed by FredericG
parent 2dc5e416ac
commit 58514baa49

View File

@ -109,7 +109,16 @@ static void Task1(void *pvParameters)
int i = 0; int i = 0;
PIOS_I2C_Transfer(I2C_Write, DEVICE_1_ADDRESS<<1, (uint8_t*)"\x20\xB0\xB1\xB2", 4); if (PIOS_I2C_LockDevice(100))
{
if (PIOS_I2C_Transfer(I2C_Write, DEVICE_1_ADDRESS<<1, (uint8_t*)"\x20\xB0\xB1\xB2", 4) != 0)
OnError();
PIOS_I2C_UnlockDevice();
}
else
{
OnError();
}
for(;;) for(;;)
{ {
@ -179,10 +188,10 @@ static void Task2(void *pvParameters)
if (PIOS_I2C_LockDevice(100)) if (PIOS_I2C_LockDevice(100))
{ {
if (PIOS_I2C_Transfer(I2C_Write_WithoutStop, DEVICE_1_ADDRESS<<1, (uint8_t*)"\x10", 1) != 0) if (PIOS_I2C_Transfer(I2C_Write_WithoutStop, DEVICE_2_ADDRESS<<1, (uint8_t*)"\x10", 1) != 0)
OnError(); OnError();
if (PIOS_I2C_Transfer(I2C_Read, DEVICE_1_ADDRESS<<1, buf, 3) != 0) if (PIOS_I2C_Transfer(I2C_Read, DEVICE_2_ADDRESS<<1, buf, 3) != 0)
OnError(); OnError();
if (memcmp(buf, "\xF0\xF1\xF2",3) != 0) if (memcmp(buf, "\xF0\xF1\xF2",3) != 0)