From 3a0ecba2cc58cfceeab99cbe438868acaddc2834 Mon Sep 17 00:00:00 2001 From: dankers Date: Wed, 23 Dec 2009 07:14:52 +0000 Subject: [PATCH] Back to a basic setup, lets walk before running. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@106 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/PiOS/pios.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/flight/PiOS/pios.c b/flight/PiOS/pios.c index 6d4af0b13..2f1257876 100644 --- a/flight/PiOS/pios.c +++ b/flight/PiOS/pios.c @@ -32,7 +32,6 @@ #include /* Task Priorities */ -#define PRIORITY_TASK_HOOKS ( tskIDLE_PRIORITY + 3 ) /* Local Variables */ static uint32_t ulIdleCycleCount = 0; @@ -42,8 +41,7 @@ static uint32_t IdleTimePercent = 0; void vApplicationIdleHook(void); /* Function Prototypes */ -static void HooksTask(void *pvParameters); - +void TestTask( void *pvParameters ); /** * Main function */ @@ -55,7 +53,7 @@ int main() PIOS_SYS_Init(); /* Enables the SDCard */ - PIOS_SDCARD_Init(); +// PIOS_SDCARD_Init(); /* Call LoadSettings which populates System Vars so the rest of the hardware can be configured. */ @@ -69,9 +67,8 @@ int main() /* Initialise OpenPilot application */ // OpenPilotInit(); - - /* Start the task which calls the application hooks */ - xTaskCreate(HooksTask, (signed portCHAR *)"Hooks", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_HOOKS, NULL); + + xTaskCreate( TestTask, ( signed portCHAR * ) "Test", configMINIMAL_STACK_SIZE, NULL, 2, NULL ); /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -81,29 +78,15 @@ int main() return 0; } -static void HooksTask(void *pvParameters) +void TestTask( void *pvParameters ) { - portTickType xLastExecutionTime; +const portTickType xDelay = 500 / portTICK_RATE_MS; - // Initialise the xLastExecutionTime variable on task entry - xLastExecutionTime = xTaskGetTickCount(); - - while(1) { - vTaskDelayUntil(&xLastExecutionTime, 1 / portTICK_RATE_MS); - - /* Skip delay gap if we had to wait for more than 5 ticks to avoid */ - /* unnecessary repeats until xLastExecutionTime reached xTaskGetTickCount() again */ - portTickType xCurrentTickCount = xTaskGetTickCount(); - if(xLastExecutionTime < (xCurrentTickCount - 5)) { - xLastExecutionTime = xCurrentTickCount; - } - - /* Check for ADC pin changes, call ADCNotifyChange on each pin change */ - //ADCHandler(ADCNotifyChange); - - /* Check for incoming COM messages */ - PIOS_COM_ReceiveHandler(); - } + while(1) + { + PIOS_LED_Toggle(LED1); + vTaskDelay(xDelay); + } }