generated from RIT-EVT/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedundantADC.hpp
More file actions
57 lines (48 loc) · 1.57 KB
/
RedundantADC.hpp
File metadata and controls
57 lines (48 loc) · 1.57 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
#pragma once
#include <dev/ADS8689IPWR.hpp>
namespace io = core::io;
namespace HIB::DEV {
/**
* This class allows processing readings from redundant ADCs and checking for errors
*/
class RedundantADC {
public:
/**
* Enum class representing the status of RedundantADC processing.
*/
enum Status {
/** No error */
OK = 0,
/** The reading is off by more than precision margin but less than the accepted margin */
PRECISION_MARGIN_EXCEEDED = 1,
/** The reading is off by less than the acceptable margin */
ACCEPTABLE_MARGIN_EXCEEDED = 2,
/** The readings do not match */
COMPARISON_ERROR = 3,
};
/**
* Constructs a RedundantADC object with the given ADC instances.
*
* @param[in] adc0 The first ADC instance.
* @param[in] adc1 The second ADC instance.
* @param[in] adc2 The third ADC instance.
*/
RedundantADC(ADS8689IPWR& adc0, ADS8689IPWR& adc1, ADS8689IPWR& adc2);
/**
* Read voltage readings from the ADCs and check for redundancy.
*
* This function reads values from three ADCs and checks for redundancy.
*
* @param[out] return_val Reference to the variable to store the value read from the ADCs
* @return RedundantADC::Status The status of the processing.
*/
RedundantADC::Status read(uint32_t& return_val);
private:
/** Reference to the first ADC. */
ADS8689IPWR& adc0;
/** Reference to the second ADC. */
ADS8689IPWR& adc1;
/** Reference to the third ADC. */
ADS8689IPWR& adc2;
};
}// namespace HIB::DEV