determination of freeRTOS features from version

This commit is contained in:
Robin Müller 2020-12-14 23:38:06 +01:00
parent 9170f466e8
commit b8f4d8690b
3 changed files with 12 additions and 10 deletions

View File

@ -10,9 +10,6 @@
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
tskKERNEL_VERSION_MAJOR > 8
// todo: does not work for older FreeRTOS version, so we should
// actually check whether tskKERNEL_VERSION_MAJOR is larger than.. 7 or 8 ?
/**
* @brief Binary Semaphore implementation using the task notification value.
* The notification value should therefore not be used

View File

@ -80,10 +80,16 @@ void PeriodicTask::taskFunctionality() {
object->performOperation();
}
checkMissedDeadline(xLastWakeTime, xPeriod);
vTaskDelayUntil(&xLastWakeTime, xPeriod);
#if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || \
tskKERNEL_VERSION_MAJOR > 10
BaseType_t wasDelayed = xTaskDelayUntil(&xLastWakeTime, xPeriod);
if(wasDelayed == pdFALSE) {
handleMissedDeadline();
}
#else
checkMissedDeadline(xLastWakeTime, xPeriod);
vTaskDelayUntil(&xLastWakeTime, xPeriod);
#endif
}
}
@ -112,8 +118,6 @@ void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
* it. */
TickType_t currentTickCount = xTaskGetTickCount();
TickType_t timeToWake = xLastWakeTime + interval;
#if tskKERNEL_VERSION_MAJOR >= 10 && tskKERNEL_VERSION_MINOR > 4)
#else
// Time to wake has not overflown.
if(timeToWake > xLastWakeTime) {
/* If the current time has overflown exclusively or the current
@ -128,7 +132,7 @@ void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
else if((timeToWake < xLastWakeTime) and (currentTickCount > timeToWake)) {
handleMissedDeadline();
}
#endif
}
TaskHandle_t PeriodicTask::getTaskHandle() {

View File

@ -71,6 +71,7 @@ public:
TaskHandle_t getTaskHandle() override;
protected:
bool started;
TaskHandle_t handle;