-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpump.h
More file actions
64 lines (53 loc) · 1.69 KB
/
pump.h
File metadata and controls
64 lines (53 loc) · 1.69 KB
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
/**
* @brief Declares gardener pump controller.
*/
#ifndef PUMP_H
#define PUMP_H
#include "ipump.h"
#include "itimer.h"
namespace gardener
{
/**
* @brief Gardener pump controller.
*/
class Pump : public IPump
{
public:
/**
* @brief Initializes a new instance of the @ref Pump class.
*
* @param [in] fwdPin WiringPi PWM pin to control pump
in forward direction.
* @param [in] revPin WiringPi PWM pin to control pump
in reverse direction.
* @param [in,out] dwellTimer Timer for dwelling during ramp-up.
*/
Pump(
const int fwdPin,
const int revPin,
ITimer &dwellTimer);
virtual void requestChangeSpeed(const int newSpeed);
virtual bool isSpeedSteady(void);
virtual void transition(void);
virtual void execute(void);
private:
enum state
{
STEADY, /**< At requested speed */
CHANGE, /**< Changing to requested speed */
DWELL, /**< Dwelling at changed speed */
};
static const int deltaSpeed;
static const int dwellTime;
static const int dutyScaleBits;
static const int dutyDeadband;
int fwdPin;
int revPin;
ITimer &dwellTimer;
int currentSpeed;
int requestedSpeed;
state currentState;
void setCurrentSpeed(const int newSpeed);
};
}
#endif /* PUMP_H */