CN0396 (4-Wire Electrochemical Dual Toxic Gas Sensing System)
Dependencies: AD5270 AD7798 ADT7310
CN0396 Class Reference
#include <CN0396.h>
Public Member Functions | |
CN0396 (PinName csad, PinName csrdac, PinName cstemp) | |
CN0396 class constructor. | |
void | init () |
Initializes the board. | |
void | read () |
| |
float | get_feedback_resistor_value (float sensitivity, float range) |
computes the feedback resistor value for the sensor | |
void | configure_feedback_resistors (float resistance1, float resistance2) |
configures the RDACs with the resistance values | |
void | data_to_voltage (uint16_t adcValue, float *voltage, int gain_adc=1) |
computes ADC counts-to-voltage in unipolar configuration | |
void | data_to_voltage_bipolar (uint16_t adcValue, float *voltage, int gain_adc=1) |
computes ADC counts-to-voltage in bipolar configuration | |
float | compensate_ppm (float result, float temp, sensor_type_t sensor) |
compensates ppm value based on temperature reading | |
Data Fields | |
ppm_compensation_t | ppm_compensation [COMPENSATION_TABLE_SIZE] |
compensation look-up table |
Detailed Description
The CN0396 class.
Definition at line 12 of file CN0396.h.
Constructor & Destructor Documentation
CN0396 | ( | PinName | csad, |
PinName | csrdac, | ||
PinName | cstemp | ||
) |
CN0396 class constructor.
- Parameters:
-
csad - chipselect pin of the ADC csrdac - chipselect pin of the RDAC cstemp - chipselect pin of the temperature sensor
Definition at line 35 of file CN0396.cpp.
Member Function Documentation
float compensate_ppm | ( | float | result, |
float | temp, | ||
sensor_type_t | sensor | ||
) |
compensates ppm value based on temperature reading
- Parameters:
-
result - ppm value before compensation temp - temperature used in compensation sensor - sensor id
- Returns:
- compensated value
Definition at line 123 of file CN0396.cpp.
void configure_feedback_resistors | ( | float | resistance1, |
float | resistance2 | ||
) |
configures the RDACs with the resistance values
- Parameters:
-
resistance1 - resistance of RDAC1 resistance2 - resistance of RDAC2
- Returns:
Definition at line 56 of file CN0396.cpp.
void data_to_voltage | ( | uint16_t | adcValue, |
float * | voltage, | ||
int | gain_adc = 1 |
||
) |
computes ADC counts-to-voltage in unipolar configuration
- Parameters:
-
adcValue - value in counts voltage - voltage value returned by the method gain_adc - the gain of the adc
Definition at line 41 of file CN0396.cpp.
void data_to_voltage_bipolar | ( | uint16_t | adcValue, |
float * | voltage, | ||
int | gain_adc = 1 |
||
) |
computes ADC counts-to-voltage in bipolar configuration
- Parameters:
-
adcValue - value in counts voltage - voltage value returned by the method gain_adc - the gain of the adc
Definition at line 46 of file CN0396.cpp.
float get_feedback_resistor_value | ( | float | sensitivity, |
float | range | ||
) |
computes the feedback resistor value for the sensor
- Parameters:
-
sensitivity - sensor sensitivity range - sensor range
- Returns:
- resistor value
Definition at line 51 of file CN0396.cpp.
void init | ( | ) |
Initializes the board.
Definition at line 87 of file CN0396.cpp.
void read | ( | ) |
- Reads the sensor and computes the PPM values
Definition at line 138 of file CN0396.cpp.
Field Documentation
ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE] |
Generated on Fri Jul 15 2022 03:23:55 by 1.7.2