added new method that yield from ISR after semaphore is given from ISR

This commit is contained in:
suiauthon
2016-02-17 09:46:36 +01:00
parent ada61ef06b
commit ee6ae3ec95
2 changed files with 11 additions and 4 deletions
@@ -20,9 +20,9 @@
#elif UAVCAN_STM32_FREERTOS #elif UAVCAN_STM32_FREERTOS
# include <stm32f4xx.h> # include <stm32f4xx.h>
# include <cmsis_os.h> # include <cmsis_os.h>
#ifndef MAX_SEMAPHORE_COUNT # ifndef MAX_SEMAPHORE_COUNT
#define MAX_SEMAPHORE_COUNT 50 # define MAX_SEMAPHORE_COUNT 50
#endif #endif
#else #else
# error "Unknown OS" # error "Unknown OS"
#endif #endif
@@ -186,12 +186,14 @@ public:
void signal(); void signal();
void signalFromInterrupt(); void signalFromInterrupt();
void yieldFromISR();
}; };
class Mutex class Mutex
{ {
SemaphoreHandle_t mtx_; SemaphoreHandle_t mtx_;
BaseType_t xHigherPriorityTaskWoken;
public: public:
Mutex(void) Mutex(void)
{ {
@@ -116,6 +116,11 @@ void BusEvent::signalFromInterrupt()
portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
} }
void BusEvent::yieldFromISR()
{
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
/* /*
* Mutex * Mutex
*/ */