Organise main tasks into order of priority
This commit is contained in:
@@ -4,14 +4,11 @@
|
||||
* Main.cpp bootstraps the device and then hands over to FreeRTOS and the threads
|
||||
*/
|
||||
|
||||
#include "main.hpp"
|
||||
#include "BSP.h"
|
||||
#include "LIS2DH12.hpp"
|
||||
#include "Settings.h"
|
||||
#include "cmsis_os.h"
|
||||
#include <MMA8652FC.hpp>
|
||||
#include <fusbpd.h>
|
||||
#include <main.hpp>
|
||||
#include <power.hpp>
|
||||
#include "power.hpp"
|
||||
uint8_t DetectedAccelerometerVersion = 0;
|
||||
bool settingsWereReset = false;
|
||||
// FreeRTOS variables
|
||||
@@ -46,28 +43,25 @@ int main(void) {
|
||||
settingsWereReset = restoreSettings(); // load the settings from flash
|
||||
resetWatchdog();
|
||||
/* Create the thread(s) */
|
||||
/* definition and creation of POWTask - Power management for QC */
|
||||
osThreadStaticDef(POWTask, startPOWTask, osPriorityAboveNormal, 0, POWTaskStackSize, POWTaskBuffer, &POWTaskControlBlock);
|
||||
POWTaskHandle = osThreadCreate(osThread(POWTask), NULL);
|
||||
|
||||
/* definition and creation of GUITask - The OLED control & update*/
|
||||
osThreadStaticDef(GUITask, startGUITask, osPriorityBelowNormal, 0, GUITaskStackSize, GUITaskBuffer, &GUITaskControlBlock);
|
||||
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
|
||||
|
||||
/* definition and creation of PIDTask - Heating control*/
|
||||
osThreadStaticDef(PIDTask, startPIDTask, osPriorityRealtime, 0, PIDTaskStackSize, PIDTaskBuffer, &PIDTaskControlBlock);
|
||||
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
|
||||
|
||||
/* definition and creation of POWTask - Power management for QC */
|
||||
osThreadStaticDef(POWTask, startPOWTask, osPriorityAboveNormal, 0, POWTaskStackSize, POWTaskBuffer, &POWTaskControlBlock);
|
||||
POWTaskHandle = osThreadCreate(osThread(POWTask), NULL);
|
||||
|
||||
/* definition and creation of MOVTask - Accelerometer management */
|
||||
osThreadStaticDef(MOVTask, startMOVTask, osPriorityNormal, 0, MOVTaskStackSize, MOVTaskBuffer, &MOVTaskControlBlock);
|
||||
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
||||
|
||||
/* definition and creation of GUITask - The OLED control & update*/
|
||||
osThreadStaticDef(GUITask, startGUITask, osPriorityBelowNormal, 0, GUITaskStackSize, GUITaskBuffer, &GUITaskControlBlock);
|
||||
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
|
||||
|
||||
resetWatchdog();
|
||||
#ifdef POW_PD
|
||||
if (usb_pd_detect() == true) {
|
||||
// Spawn all of the USB-C processors
|
||||
fusb302_start_processing();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start scheduler */
|
||||
osKernelStart();
|
||||
/* We should never get here as control is now taken by the scheduler */
|
||||
|
||||
Reference in New Issue
Block a user