mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-04-08 00:53:48 +02: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:
parent
92d0044f50
commit
163862af54
@ -105,6 +105,8 @@ int main()
|
|||||||
/* Initialise OpenPilot application */
|
/* Initialise OpenPilot application */
|
||||||
// OpenPilotInit();
|
// OpenPilotInit();
|
||||||
|
|
||||||
|
PIOS_I2C_Init();
|
||||||
|
|
||||||
/* Create a FreeRTOS task */
|
/* Create a FreeRTOS task */
|
||||||
xTaskCreate(TaskTick, (signed portCHAR *)"Test", configMINIMAL_STACK_SIZE , NULL, 1, NULL);
|
xTaskCreate(TaskTick, (signed portCHAR *)"Test", configMINIMAL_STACK_SIZE , NULL, 1, NULL);
|
||||||
xTaskCreate(TaskTesting, (signed portCHAR *)"TaskTesting", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
|
xTaskCreate(TaskTesting, (signed portCHAR *)"TaskTesting", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
|
||||||
@ -168,7 +170,17 @@ static void TaskTick(void *pvParameters)
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
PIOS_LED_Toggle(LED1);
|
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;;
|
portTickType xDelay = 1000 / portTICK_RATE_MS;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
int32_t state = PIOS_USB_CableConnected();
|
int32_t state = PIOS_USB_CableConnected();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user