new generic freertos task interface

This commit is contained in:
Robin Müller 2020-07-12 18:01:09 +02:00
parent 99aef0cf28
commit b4f292f3d7
6 changed files with 31 additions and 7 deletions

View File

@ -157,6 +157,6 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
return HasReturnvaluesIF::RETURN_OK;
}
TaskHandle_t FixedTimeslotTask::getTaskHandle() const {
TaskHandle_t FixedTimeslotTask::getTaskHandle() {
return handle;
}

View File

@ -1,6 +1,7 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_
#define FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_
#include <framework/osal/FreeRTOS/FreeRTOSTaskIF.h>
#include <framework/tasks/FixedSlotSequence.h>
#include <framework/tasks/FixedTimeslotTaskIF.h>
#include <framework/tasks/Typedef.h>
@ -8,7 +9,7 @@
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
class FixedTimeslotTask: public FixedTimeslotTaskIF {
class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
public:
/**
@ -57,7 +58,7 @@ public:
ReturnValue_t sleepFor(uint32_t ms) override;
TaskHandle_t getTaskHandle() const;
TaskHandle_t getTaskHandle() override;
protected:
bool started;

View File

@ -0,0 +1,13 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_
#define FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
class FreeRTOSTaskIF {
public:
virtual~ FreeRTOSTaskIF() {}
virtual TaskHandle_t getTaskHandle() = 0;
};
#endif /* FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_ */

View File

@ -126,7 +126,7 @@ void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
}
}
TaskHandle_t PeriodicTask::getTaskHandle() const {
TaskHandle_t PeriodicTask::getTaskHandle() {
return handle;
}

View File

@ -1,10 +1,12 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_PERIODICTASK_H_
#define FRAMEWORK_OSAL_FREERTOS_PERIODICTASK_H_
#include <framework/osal/FreeRTOS/FreeRTOSTaskIF.h>
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/tasks/PeriodicTaskIF.h>
#include <framework/tasks/Typedef.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
@ -17,7 +19,7 @@ class ExecutableObjectIF;
* periodic activities of multiple objects.
* @ingroup task_handling
*/
class PeriodicTask: public PeriodicTaskIF {
class PeriodicTask: public PeriodicTaskIF, public FreeRTOSTaskIF {
public:
/**
* Keep in Mind that you need to call before this vTaskStartScheduler()!
@ -70,7 +72,7 @@ public:
ReturnValue_t sleepFor(uint32_t ms) override;
TaskHandle_t getTaskHandle() const;
TaskHandle_t getTaskHandle() override;
protected:
bool started;
TaskHandle_t handle;

View File

@ -15,7 +15,15 @@ public:
static const ReturnValue_t RETURN_FAILED = 1;
virtual ~HasReturnvaluesIF() {}
static ReturnValue_t makeReturnCode(uint8_t interfaceId, uint8_t number) {
/**
* It is discouraged to use the input parameters 0,0 and 0,1 as this
* will generate the RETURN_OK and RETURN_FAILED returnvalues.
* @param interfaceId
* @param number
* @return
*/
static constexpr ReturnValue_t makeReturnCode(uint8_t interfaceId,
uint8_t number) {
return (interfaceId << 8) + number;
}
};