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
// driver_OxygenSensor.h

#ifndef _DRIVER_OXYGENSENSOR_h
#define _DRIVER_OXYGENSENSOR_h

#if defined(ARDUINO) && ARDUINO >= 100
	#include "arduino.h"
#else
	#include "WProgram.h"
#endif

#include "DriverContext.h"

typedef enum { OxygenSensorA } t_OxygenSensorModel;

/**
 * \brief This class manage the sersor oxygen conversion.
 */
class OxygenSensor
{
public:
	void Init(t_OxygenSensorModel model, void* handle);
	float GetConcentration();
	bool setData(float adc_oxygen, float temperature);
	void CalibrateAir();
	void CalibratePureOxygen();
	bool CheckNeedRecalibrate();
	void Tick();

private:

	HW* hwi;
	DebugIfaceClass* dbg;
	float calib_q;
	float calib_m;
	float _adc_oxygen;
	float _temperature;
	uint64_t calib_interval_seconds;
	uint64_t calib_second_counter;
	uint64_t second_counter;
	t_OxygenSensorModel _oxmodel;
};

#endif



//                  #     # ### 
//                  ##    #  #  
//                  # #   #  #  
//                  #  #  #  #  
//                  #   # #  #  
//                  #    ##  #  
//                  #     # ### 
//
// Nuclear Instruments 2020 - All rights reserved
// Any commercial use of this code is forbidden
// Contact info@nuclearinstruments.eu