PAS CO2 Sensor  1.0.3
C++ library for Infineon Photoacoustic Spectroscopy (PAS) XENSIV™ CO2 miniaturized sensor
pas-co2.hpp
Go to the documentation of this file.
1 
10 #ifndef PAS_CO2_HPP_
11 #define PAS_CO2_HPP_
12 
13 #include <stdint.h>
14 #include "pas-co2-sbus.hpp"
15 #include "pas-co2-pal-pwm.hpp"
16 #include "pas-co2-pal-timer.hpp"
17 #include "pas-co2-pal-gpio.hpp"
18 #include "pas-co2-reg.hpp"
19 
20 #undef PWM
21 
22 using namespace pasco2;
23 
29 class PASCO2
30 {
31  public:
32 
33  PASCO2(pasco2::SBus * const sbus,
34  pasco2::PWM * const pwm,
35  pasco2::Timer * const timer = nullptr,
36  pasco2::GPIO * const interrupt = nullptr,
37  pasco2::GPIO * const protoSelect = nullptr,
38  pasco2::GPIO * const power3V3 = nullptr,
39  pasco2::GPIO * const power12V = nullptr,
40  pasco2::GPIO * const pwmSelect = nullptr);
41 
42  virtual ~PASCO2 ();
43 
44  Error_t init ();
45  Error_t deinit ();
46 
47  Error_t enableLogic ();
48  Error_t disableLogic ();
49 
50  Error_t enableIREmitter ();
51  Error_t disableIREmitter ();
52 
53  Error_t softReset ();
54  Error_t hardReset ();
55 
56  Error_t setOperationMode (OpMode_t mode);
57 
58  Error_t enablePWM ();
59  Error_t disablePWM ();
60  Error_t setPWMMode (PWMMode_t mode);
61 
62  Error_t setMeasPeriod (int16_t periodInSec);
63 
64  Error_t getCO2 (int16_t & CO2PMM);
65 
66  Error_t getDiagnosis (Diag_t & diagnosis);
67 
68  Error_t getMeasStatus (MeasStatus_t & measSt);
69 
70  Error_t enableInterrupt (void (*cback) (void *), Int_t intType, IntIOConf_t ioConf);
71  Error_t disableInterrupt ();
72 
73  Error_t enableABOCompensation (ABOC_t aboc, int16_t abocRef);
74  Error_t disableABOCompensation ();
75 
76  Error_t setPressureCompensation(uint16_t pressRef);
77 
78  Error_t enableAlarm (int16_t thres, Alarm_t alarmType);
79  Error_t disableAlarm ();
80 
81  Error_t getDeviceID (uint8_t & prodID, uint8_t & revID);
82 
83  Status_t getStatus () { return status; }
84 
85  protected:
86 
87  pasco2::SBus * const sbus;
88  pasco2::PWM * const pwm;
89  pasco2::Timer * const timer;
99  virtual Error_t setStatus (const Status_t newStatus,
100  bool enoughIfImplicit = false);
101  virtual Error_t preResetSaveConfig (void);
102  virtual Error_t postResetRestoreConfig (void);
103 
104  static const int16_t periodMeasMin = 0x0005;
105  static const int16_t periodMeasMax = 0x0FFF;
106  static const uint16_t pressRefMin = 0x258;
107  static const uint16_t pressRefMax = 0x640;
109 };
110 
113 #endif
pasco2::GPIO *const interrupt
Definition: pas-co2.hpp:90
Definition: pas-co2-pal-pwm.hpp:23
pasco2::GPIO *const pwmSelect
Definition: pas-co2.hpp:94
Status_t getStatus()
Definition: pas-co2.hpp:83
pasco2::GPIO *const protoSelect
Definition: pas-co2.hpp:91
PAS CO2 Serial Interface.
Definition: pas-co2-i2c.hpp:21
IntIOConf_t
Definition: pas-co2-types.hpp:129
Error_t
Definition: pas-co2-types.hpp:24
PWMMode_t
Definition: pas-co2-types.hpp:80
Definition: pas-co2-sbus.hpp:23
pasco2::Reg reg
Definition: pas-co2.hpp:96
Status_t status
Definition: pas-co2.hpp:97
PAS CO2 Register Map.
ABOC_t
Definition: pas-co2-types.hpp:91
Status_t
Definition: pas-co2-types.hpp:54
Definition: pas-co2-reg.hpp:24
Definition: pas-co2-types.hpp:163
Definition: pas-co2-pal-gpio.hpp:25
Int_t
Definition: pas-co2-types.hpp:115
pasco2::GPIO *const power3V3
Definition: pas-co2.hpp:92
OpMode_t
Definition: pas-co2-types.hpp:68
Alarm_t
Definition: pas-co2-types.hpp:140
PAS CO2 Timer Platform Abstraction Layer.
Definition: pas-co2-pal-timer.hpp:24
pasco2::GPIO *const power12V
Definition: pas-co2.hpp:93
PAS CO2 GPIO Platform Abstraction Layer.
pasco2::SBus *const sbus
Definition: pas-co2.hpp:87
pasco2::PWM *const pwm
Definition: pas-co2.hpp:88
Definition: pas-co2-types.hpp:151
pasco2::Timer *const timer
Definition: pas-co2.hpp:89
PAS CO2 PWM Platform Abstraction Layer.
Definition: pas-co2.hpp:29