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

Temp I2C test-code

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@198 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
FredericG 2010-02-24 10:50:55 +00:00 committed by FredericG
parent 92d0044f50
commit 163862af54

View File

@ -105,6 +105,8 @@ int main()
/* Initialise OpenPilot application */
// OpenPilotInit();
PIOS_I2C_Init();
/* Create a FreeRTOS task */
xTaskCreate(TaskTick, (signed portCHAR *)"Test", configMINIMAL_STACK_SIZE , NULL, 1, NULL);
xTaskCreate(TaskTesting, (signed portCHAR *)"TaskTesting", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
@ -168,7 +170,17 @@ static void TaskTick(void *pvParameters)
for(;;)
{
PIOS_LED_Toggle(LED1);
vTaskDelayUntil(&xLastExecutionTime, 500 / portTICK_RATE_MS);
// I2C Test: communicate with external PCF8570 ram chip
{
char buf[20];
PIOS_I2C_Transfer(I2C_Write, 0x50<<1, "\x0\x10\x11\x12", 4);
PIOS_I2C_Transfer(I2C_Write_WithoutStop, 0x50<<1, "\x0", 1);
PIOS_I2C_Transfer(I2C_Read, 0x50<<1, buf, 3);
}
vTaskDelayUntil(&xLastExecutionTime, 100 / portTICK_RATE_MS);
}
}
@ -176,6 +188,8 @@ static void TaskTesting(void *pvParameters)
{
portTickType xDelay = 1000 / portTICK_RATE_MS;;
for(;;)
{
int32_t state = PIOS_USB_CableConnected();