1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

OP-423 Fix some comment from code review:

- update example module
- use module init macro for POSIX and WIN to make code cleaner.
This commit is contained in:
Mathieu Rondonneau 2011-06-24 06:59:51 -07:00
parent 3677521168
commit dcd2774103
5 changed files with 43 additions and 42 deletions

View File

@ -79,15 +79,6 @@ int main()
/* Initialize modules */
MODULE_INITIALISE_ALL();
#if defined(ARCH_POSIX) || defined(ARCH_WIN32)
/* Start the FreeRTOS scheduler which never returns.*/
/* only do this for posix and win32 since the caller will take care
* of starting the scheduler and increase the heap and swith back to
* MSP stack. (all arch specific is hidden from here and take care by reset handler)
*/
vTaskStartScheduler();
#endif
return 0;
}

View File

@ -49,9 +49,14 @@
#include "examplemodperiodic.h"
#include "examplemodthread.h"
void ExampleInitialize(void)
void ExampleStart(void)
{
ExampleModEventInitialize();
ExampleModPeriodicInitialize();
ExampleModThreadInitialize();
}
void ExampleInitialize(void)
{
ExampleModEventInitialize();
}
module_initcall(ExampleInitialize, 0, ExampleStart, 0, MODULE_EXEC_NOORDER_FLAG);

View File

@ -91,42 +91,17 @@ int main()
* */
PIOS_Board_Init();
#if !defined(ARCH_POSIX) && !defined(ARCH_WIN32)
/* Initialize modules */
MODULE_INITIALISE_ALL();
#if INCLUDE_TEST_TASKS
/* Create test tasks */
/* keep this just because it was there */
//xTaskCreate(TaskTesting, (signed portCHAR *)"Testing", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
//xTaskCreate(TaskHIDTest, (signed portCHAR *)"HIDTest", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
//xTaskCreate(TaskServos, (signed portCHAR *)"Servos", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
//xTaskCreate(TaskSDCard, (signed portCHAR *)"SDCard", configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 2), NULL);
#else
/* only do this for posix and win32 since the caller will take care
* of starting the scheduler and increase the heap and swith back to
* MSP stack. (all arch specific is hidden from here and take care by reset handler)
* LED blinking in case of scheduler returning back should be handled in NMI or other
* appropriate handlers like mem manager.
*/
/* Initialize modules */
InitModules();
/* Start the FreeRTOS scheduler which never returns.*/
vTaskStartScheduler();
/* If all is well we will never reach here as the scheduler will now be running. */
/* If we do get here, it will most likely be because we ran out of heap space. */
PIOS_LED_Off(LED1);
PIOS_LED_Off(LED2);
for(;;) {
PIOS_LED_Toggle(LED1);
PIOS_LED_Toggle(LED2);
PIOS_DELAY_WaitmS(100);
}
xTaskCreate(TaskTesting, (signed portCHAR *)"Testing", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
xTaskCreate(TaskHIDTest, (signed portCHAR *)"HIDTest", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
xTaskCreate(TaskServos, (signed portCHAR *)"Servos", configMINIMAL_STACK_SIZE , NULL, 3, NULL);
xTaskCreate(TaskSDCard, (signed portCHAR *)"SDCard", configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 2), NULL);
#endif
return 0;
}

View File

@ -43,6 +43,21 @@
#define MODULE_TASKCREATE_ALL();
#define MODULE_INITIALISE_ALL(); \
/* Initialize modules */ \
InitModules(); \
/* Start the FreeRTOS scheduler which never returns.*/ \
vTaskStartScheduler(); \
/* If all is well we will never reach here as the scheduler will now be running. */ \
/* If we do get here, it will most likely be because we ran out of heap space. */ \
PIOS_LED_Off(LED1); \
PIOS_LED_Off(LED2); \
for(;;) { \
PIOS_LED_Toggle(LED1); \
PIOS_LED_Toggle(LED2); \
PIOS_DELAY_WaitmS(100); \
}
#endif /* PIOS_INITCALL_H */
/**

View File

@ -43,6 +43,21 @@
#define MODULE_TASKCREATE_ALL();
#define MODULE_INITIALISE_ALL(); \
/* Initialize modules */ \
InitModules(); \
/* Start the FreeRTOS scheduler which never returns.*/ \
vTaskStartScheduler(); \
/* If all is well we will never reach here as the scheduler will now be running. */ \
/* If we do get here, it will most likely be because we ran out of heap space. */ \
PIOS_LED_Off(LED1); \
PIOS_LED_Off(LED2); \
for(;;) { \
PIOS_LED_Toggle(LED1); \
PIOS_LED_Toggle(LED2); \
PIOS_DELAY_WaitmS(100); \
}
#endif /* PIOS_INITCALL_H */