fsfw-example-common/example/test/testdefinitions/demoDefinitions.h

57 lines
1.8 KiB
C
Raw Normal View History

2021-06-08 13:35:49 +02:00
#ifndef MISSION_DEMO_DEMODEFINITIONS_H_
#define MISSION_DEMO_DEMODEFINITIONS_H_
#include <fsfw/datapoollocal/LocalPoolVariable.h>
2022-05-05 20:55:28 +02:00
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
2021-06-08 13:35:49 +02:00
/**
* @brief This demo set showcases the local data pool functionality of the
* FSFW
* @details
* Each demo object will have an own instance of this set class, which contains
* pool variables (for read and write access respectively).
*/
2022-05-05 20:55:28 +02:00
class FsfwDemoSet : public StaticLocalDataSet<3> {
2022-05-22 15:30:08 +02:00
public:
2022-05-05 20:55:28 +02:00
static constexpr uint32_t DEMO_SET_ID = 0;
2021-06-08 13:35:49 +02:00
2022-05-05 20:55:28 +02:00
enum PoolIds { VARIABLE, VARIABLE_LIMIT };
2021-06-08 13:35:49 +02:00
2022-05-22 15:30:08 +02:00
FsfwDemoSet(HasLocalDataPoolIF *hkOwner)
: StaticLocalDataSet(hkOwner, DEMO_SET_ID) {}
2021-06-08 13:35:49 +02:00
2022-05-22 15:30:08 +02:00
lp_var_t<uint32_t> variableRead = lp_var_t<uint32_t>(
sid.objectId, PoolIds::VARIABLE, this, pool_rwm_t::VAR_READ);
lp_var_t<uint32_t> variableWrite = lp_var_t<uint32_t>(
sid.objectId, PoolIds::VARIABLE, this, pool_rwm_t::VAR_WRITE);
2022-05-05 20:55:28 +02:00
lp_var_t<uint16_t> variableLimit =
lp_var_t<uint16_t>(sid.objectId, PoolIds::VARIABLE_LIMIT, this);
2021-06-08 13:35:49 +02:00
2022-05-22 15:30:08 +02:00
private:
2021-06-08 13:35:49 +02:00
};
/**
* This set will enable object to read the dummy variables from the dataset
* above. An example application would be a consumer object like a controller
* which reads multiple sensor values at once.
*/
2022-05-05 20:55:28 +02:00
class CompleteDemoReadSet : public StaticLocalDataSet<3> {
2022-05-22 15:30:08 +02:00
public:
2022-05-05 20:55:28 +02:00
static constexpr uint32_t DEMO_SET_ID = 0;
2021-06-08 13:35:49 +02:00
2022-05-22 15:30:08 +02:00
CompleteDemoReadSet(object_id_t owner, gp_id_t variable1, gp_id_t variable2,
gp_id_t variable3)
2022-05-05 20:55:28 +02:00
: StaticLocalDataSet(sid_t(owner, DEMO_SET_ID)),
variable1(variable1, this, pool_rwm_t::VAR_READ),
variable2(variable2, this, pool_rwm_t::VAR_READ),
variable3(variable3, this, pool_rwm_t::VAR_READ) {}
2021-06-08 13:35:49 +02:00
2022-05-05 20:55:28 +02:00
lp_var_t<uint32_t> variable1;
lp_var_t<uint32_t> variable2;
lp_var_t<uint32_t> variable3;
2021-06-08 13:35:49 +02:00
2022-05-22 15:30:08 +02:00
private:
2022-05-05 20:55:28 +02:00
};
2021-06-08 13:35:49 +02:00
#endif /* MISSION_DEMO_DEMODEFINITIONS_H_ */