forked from ROMEO/obsw
working on thread safety, preparing for static RTOS
This commit is contained in:
@ -4,6 +4,29 @@
|
||||
|
||||
// TODO namespace the names
|
||||
|
||||
SemaphoreHandle_t * global_threading_semaphore = NULL;
|
||||
|
||||
uint8_t global_threading_available_c() {
|
||||
if (global_threading_semaphore == NULL) {
|
||||
|
||||
global_threading_semaphore = xSemaphoreCreateBinary();
|
||||
//xSemaphoreGive(global_threading_semaphore);
|
||||
}
|
||||
if (uxSemaphoreGetCount(global_threading_semaphore) == 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void enable_global_threading_c() {
|
||||
xSemaphoreGive(global_threading_semaphore);
|
||||
}
|
||||
|
||||
void disable_global_threading_c() {
|
||||
xSemaphoreTake(global_threading_semaphore, portMAX_DELAY);
|
||||
}
|
||||
|
||||
const char *get_task_name() { return pcTaskGetName(NULL); }
|
||||
|
||||
void stop_it() { taskENTER_CRITICAL(); }
|
||||
|
Reference in New Issue
Block a user