-
Notifications
You must be signed in to change notification settings - Fork 0
/
isolatedBox_actuator.h
75 lines (49 loc) · 1.43 KB
/
isolatedBox_actuator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*****************************************************************//**
* \file isolatedBox_actuator.h
* \brief: Class to manage a generic PWM
* for PID actuation
* This class is merely a "template" framework class
*
* \author F.Morani
* \date May 2023
***********************************************************************/
#ifndef _ISO_ACTUATOR_H_
#define _ISO_ACTUATOR_H_
/**
* Various include to host the HW relevant
* s/w resources - GPIO - PWM IO etc
*/
#include <cstdint>
#include "isolatedBox_common.h"
constexpr auto ISO_PWM_FREQUENCY_MAX = 12345;
constexpr auto ISO_PWM_FREQUENCY_MIN = 0;
constexpr auto ISO_PWM_FREQUENCY_DEF = 100;
constexpr auto ISO_PWM_DUTY_CYCLE_MAX = 100;
constexpr auto ISO_PWM_DUTY_CYCLE_MIN = 0;
constexpr auto ISO_PWM_DUTY_CYCLE_DEF = 0;
constexpr auto ISO_PWM_INTENSITY_MAX_VALUE = 100;
class IsoActuator
{
public:
IsoActuator();
~IsoActuator();
bool init();
void operator!();
void operator++();
void operator+=(const uint8_t value);
void operator--();
void operator-=(const uint8_t value);
bool setIntensity(const uint8_t value);
uint8_t getIntensity() const;
bool setFrequency(const uint32_t value);
uint32_t getFrequency() const;
bool setDutyCycle(const uint8_t value);
uint8_t getDutyCycle() const;
EquipmentState getPwmState();
private:
EquipmentState m_pwmState;
uint8_t m_intensity;
uint32_t m_frequency;
uint8_t m_dutyCycle;
};
#endif /* _ISO_ACTUATOR_H_ */