mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
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
|
* Main.cpp bootstraps the device and then hands over to FreeRTOS and the threads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "main.hpp"
|
||||||
#include "BSP.h"
|
#include "BSP.h"
|
||||||
#include "LIS2DH12.hpp"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
#include <MMA8652FC.hpp>
|
#include "power.hpp"
|
||||||
#include <fusbpd.h>
|
|
||||||
#include <main.hpp>
|
|
||||||
#include <power.hpp>
|
|
||||||
uint8_t DetectedAccelerometerVersion = 0;
|
uint8_t DetectedAccelerometerVersion = 0;
|
||||||
bool settingsWereReset = false;
|
bool settingsWereReset = false;
|
||||||
// FreeRTOS variables
|
// FreeRTOS variables
|
||||||
@@ -46,28 +43,25 @@ int main(void) {
|
|||||||
settingsWereReset = restoreSettings(); // load the settings from flash
|
settingsWereReset = restoreSettings(); // load the settings from flash
|
||||||
resetWatchdog();
|
resetWatchdog();
|
||||||
/* Create the thread(s) */
|
/* 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*/
|
/* definition and creation of PIDTask - Heating control*/
|
||||||
osThreadStaticDef(PIDTask, startPIDTask, osPriorityRealtime, 0, PIDTaskStackSize, PIDTaskBuffer, &PIDTaskControlBlock);
|
osThreadStaticDef(PIDTask, startPIDTask, osPriorityRealtime, 0, PIDTaskStackSize, PIDTaskBuffer, &PIDTaskControlBlock);
|
||||||
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
|
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 */
|
/* definition and creation of MOVTask - Accelerometer management */
|
||||||
osThreadStaticDef(MOVTask, startMOVTask, osPriorityNormal, 0, MOVTaskStackSize, MOVTaskBuffer, &MOVTaskControlBlock);
|
osThreadStaticDef(MOVTask, startMOVTask, osPriorityNormal, 0, MOVTaskStackSize, MOVTaskBuffer, &MOVTaskControlBlock);
|
||||||
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
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();
|
resetWatchdog();
|
||||||
#ifdef POW_PD
|
|
||||||
if (usb_pd_detect() == true) {
|
|
||||||
// Spawn all of the USB-C processors
|
|
||||||
fusb302_start_processing();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Start scheduler */
|
/* Start scheduler */
|
||||||
osKernelStart();
|
osKernelStart();
|
||||||
/* We should never get here as control is now taken by the scheduler */
|
/* We should never get here as control is now taken by the scheduler */
|
||||||
|
|||||||
Reference in New Issue
Block a user