Ken Van Hoeylandt 0188ce721c
Boot splash and more (#98)
* Boot splash and more

- Added developer sdkconfig
- Refactored the way FreeRTOS includes are included
- Improved Gui/Loader logic
- Implemented boot app with splash screen

* Updated naming for Gui and Loader services

* Renamed Screenshot service methods

* Renames

* Service renames
2024-11-30 15:37:16 +01:00

43 lines
914 B
C++

#include "Critical.h"
#include "CoreDefines.h"
#include "RtosCompatTask.h"
#ifdef ESP_PLATFORM
static portMUX_TYPE critical_mutex;
#define TT_ENTER_CRITICAL() taskENTER_CRITICAL(&critical_mutex)
#else
#define TT_ENTER_CRITICAL() taskENTER_CRITICAL()
#endif
namespace tt::critical {
TtCriticalInfo enter() {
TtCriticalInfo info;
info.isrm = 0;
info.from_isr = TT_IS_ISR();
info.kernel_running = (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING);
if (info.from_isr) {
info.isrm = taskENTER_CRITICAL_FROM_ISR();
} else if (info.kernel_running) {
TT_ENTER_CRITICAL();
} else {
portDISABLE_INTERRUPTS();
}
return info;
}
void exit(TtCriticalInfo info) {
if (info.from_isr) {
taskEXIT_CRITICAL_FROM_ISR(info.isrm);
} else if (info.kernel_running) {
TT_ENTER_CRITICAL();
} else {
portENABLE_INTERRUPTS();
}
}
}