mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Move I2CSemaphore creation outside postRToSInit
The code assumes that whenever scheduler is running I2CSemaphore is available. Initialising it in a task might lead to race conditions and is also not happening at all if the task is disabled (for debugging or due to lack of need for a particular usecase). The race condition can't happen with the current code though, as GUI task has lower priority than the MOV task, and they're the only tasks that currently use I2C. However, this might change in the future with the code refactoring or introduction of new features.
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
#include "task.h"
|
||||
#include "I2C_Wrapper.hpp"
|
||||
#include "fusbpd.h"
|
||||
|
||||
// Initialisation to be performed with scheduler active
|
||||
void postRToSInit() {
|
||||
// Any after RTos setup
|
||||
FRToSI2C::FRToSInit();
|
||||
#ifdef POW_PD
|
||||
//Spawn all of the USB-C processors
|
||||
fusb302_start_processing();
|
||||
|
||||
@@ -85,6 +85,9 @@ int main(void) {
|
||||
|
||||
resetWatchdog();
|
||||
|
||||
/* Init the IPC objects */
|
||||
FRToSI2C::FRToSInit();
|
||||
|
||||
/* Start scheduler */
|
||||
osKernelStart();
|
||||
/* We should never get here as control is now taken by the scheduler */
|
||||
|
||||
Reference in New Issue
Block a user