mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Back to a basic setup, lets walk before running.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@106 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
8a0d906647
commit
3a0ecba2cc
@ -32,7 +32,6 @@
|
|||||||
#include <openpilot.h>
|
#include <openpilot.h>
|
||||||
|
|
||||||
/* Task Priorities */
|
/* Task Priorities */
|
||||||
#define PRIORITY_TASK_HOOKS ( tskIDLE_PRIORITY + 3 )
|
|
||||||
|
|
||||||
/* Local Variables */
|
/* Local Variables */
|
||||||
static uint32_t ulIdleCycleCount = 0;
|
static uint32_t ulIdleCycleCount = 0;
|
||||||
@ -42,8 +41,7 @@ static uint32_t IdleTimePercent = 0;
|
|||||||
void vApplicationIdleHook(void);
|
void vApplicationIdleHook(void);
|
||||||
|
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
static void HooksTask(void *pvParameters);
|
void TestTask( void *pvParameters );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function
|
* Main function
|
||||||
*/
|
*/
|
||||||
@ -55,7 +53,7 @@ int main()
|
|||||||
PIOS_SYS_Init();
|
PIOS_SYS_Init();
|
||||||
|
|
||||||
/* Enables the SDCard */
|
/* Enables the SDCard */
|
||||||
PIOS_SDCARD_Init();
|
// PIOS_SDCARD_Init();
|
||||||
|
|
||||||
/* Call LoadSettings which populates System Vars
|
/* Call LoadSettings which populates System Vars
|
||||||
so the rest of the hardware can be configured. */
|
so the rest of the hardware can be configured. */
|
||||||
@ -69,9 +67,8 @@ int main()
|
|||||||
|
|
||||||
/* Initialise OpenPilot application */
|
/* Initialise OpenPilot application */
|
||||||
// OpenPilotInit();
|
// OpenPilotInit();
|
||||||
|
|
||||||
/* Start the task which calls the application hooks */
|
xTaskCreate( TestTask, ( signed portCHAR * ) "Test", configMINIMAL_STACK_SIZE, NULL, 2, NULL );
|
||||||
xTaskCreate(HooksTask, (signed portCHAR *)"Hooks", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_HOOKS, NULL);
|
|
||||||
|
|
||||||
/* Start the FreeRTOS scheduler */
|
/* Start the FreeRTOS scheduler */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
@ -81,29 +78,15 @@ int main()
|
|||||||
return 0;
|
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
|
while(1)
|
||||||
xLastExecutionTime = xTaskGetTickCount();
|
{
|
||||||
|
PIOS_LED_Toggle(LED1);
|
||||||
while(1) {
|
vTaskDelay(xDelay);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user