Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CN0357 Class Reference
EVAL-CN0357 toxic gas sensor shield. More...
#include <CN0357.h>
Public Types | |
| enum | JumperConfig_t { INTERNAL_AD7790 = 0, EXTERNAL_ADC } |
CN0357 shield jumper configuration. More... | |
Public Member Functions | |
| CN0357 (PinName CSAD7790=D8, PinName CSAD5270=D6, PinName MOSI=SPI_MOSI, PinName MISO=SPI_MISO, PinName SCK=SPI_SCK) | |
| CN0357 constructor. | |
| void | init (float range, float sensitivity, JumperConfig_t jp=INTERNAL_AD7790, uint8_t mode_val=_DEFAULT_MODE_VAL, uint8_t filter_val=_DEFAULT_FILTER_VAL) |
| initializes the AD7790 and the AD5270 | |
| uint8_t | read_adc_status (void) |
| reads the status register of the AD7790 | |
| uint16_t | read_sensor (void) |
| reads the data register of the AD7790 | |
| float | read_sensor_voltage (void) |
| reads the ADC and computes the sensor voltage | |
| float | data_to_voltage (uint16_t data) |
| computes voltage from a 16 bit ADC value received as a parameter | |
| float | calc_ppm (float adcVoltage) |
| computes a value in PPM from a reading received as a param | |
| float | read_ppm (void) |
| reads and computes the sensor reading in PPM | |
| void | set_RDAC_value (float resistor_val) |
| sets a new value for the RDAC | |
| float | get_RDAC_value (void) |
| getter method for RDAC value | |
| float | set_sensor_parameters (float range, float sensitivity) |
| set sensor range and sensitivity sets sensor range, sensitivity returns suggested resistance value for feedback resistor | |
| float | get_sensor_range (void) |
| getter method for sensor range | |
| float | get_sensor_sensitivity (void) |
| getter method for sensor sensitivity | |
Data Fields | |
| AD7790 | ad7790 |
| AD7790 instance - can be used for manual overriding. | |
| AD5270 | ad5270 |
| AD5270 instance - can be used for manual overriding. | |
Detailed Description
EVAL-CN0357 toxic gas sensor shield.
Definition at line 58 of file CN0357.h.
Member Enumeration Documentation
| enum JumperConfig_t |
Constructor & Destructor Documentation
| CN0357 | ( | PinName | CSAD7790 = D8, |
| PinName | CSAD5270 = D6, |
||
| PinName | MOSI = SPI_MOSI, |
||
| PinName | MISO = SPI_MISO, |
||
| PinName | SCK = SPI_SCK |
||
| ) |
CN0357 constructor.
- Parameters:
-
CSAD7790 - (optional)chip select of the AD7790 CSAD5270 - (optional)chip select of the AD5270 MOSI - (optional)pin of the SPI interface MISO - (optional)pin of the SPI interface SCK - (optional)pin of the SPI interface
Definition at line 61 of file CN0357.cpp.
Member Function Documentation
| float calc_ppm | ( | float | adcVoltage ) |
computes a value in PPM from a reading received as a param
- Parameters:
-
adcVoltage - voltage to be converted to PPM
- Returns:
- sensor value in PPM
Definition at line 162 of file CN0357.cpp.
| float data_to_voltage | ( | uint16_t | data ) |
computes voltage from a 16 bit ADC value received as a parameter
- Parameters:
-
data - ADC value
- Returns:
- sensor voltage
Definition at line 174 of file CN0357.cpp.
| float get_RDAC_value | ( | void | ) |
getter method for RDAC value
- Returns:
- value of the RDAC in ohms
Definition at line 193 of file CN0357.cpp.
| float get_sensor_range | ( | void | ) |
getter method for sensor range
- Returns:
- sensor range (in ppm)
Definition at line 226 of file CN0357.cpp.
| float get_sensor_sensitivity | ( | void | ) |
getter method for sensor sensitivity
- Returns:
- sensor sensitivity (in A/ppm)
Definition at line 217 of file CN0357.cpp.
| void init | ( | float | range, |
| float | sensitivity, | ||
| JumperConfig_t | jp = INTERNAL_AD7790, |
||
| uint8_t | mode_val = _DEFAULT_MODE_VAL, |
||
| uint8_t | filter_val = _DEFAULT_FILTER_VAL |
||
| ) |
initializes the AD7790 and the AD5270
- Parameters:
-
range - range of the sensor used (in ppm) sensitivity - sensitivity of the sensor (A/ppm) jp - (optional)jumper configuration of the CN0357 mode_val - (optional)if jp is set to InternalADC, configures the mode register of the Internal ADC filter_val - (optional)if jp is set to InternalADC, configures the filter register of the Internal ADC
Definition at line 77 of file CN0357.cpp.
| uint8_t read_adc_status | ( | void | ) |
reads the status register of the AD7790
- Returns:
- status register value
Definition at line 125 of file CN0357.cpp.
| float read_ppm | ( | void | ) |
reads and computes the sensor reading in PPM
- Returns:
- value of the sensor reading in PPM
Definition at line 152 of file CN0357.cpp.
| uint16_t read_sensor | ( | void | ) |
reads the data register of the AD7790
- Returns:
- data register value
Definition at line 143 of file CN0357.cpp.
| float read_sensor_voltage | ( | void | ) |
reads the ADC and computes the sensor voltage
- Returns:
- sensor voltage
Definition at line 134 of file CN0357.cpp.
| void set_RDAC_value | ( | float | resistance ) |
sets a new value for the RDAC
- Parameters:
-
resistance new value for the resistance
- Returns:
- none
Definition at line 184 of file CN0357.cpp.
| float set_sensor_parameters | ( | float | range, |
| float | sensitivity | ||
| ) |
set sensor range and sensitivity sets sensor range, sensitivity returns suggested resistance value for feedback resistor
- Parameters:
-
range - range of the sensor used (in ppm) sensitivity - sensitivity of the sensor (in A/ppm)
- Returns:
- suggested resistance value for feedback resistor
Definition at line 206 of file CN0357.cpp.
Field Documentation
Generated on Tue Jul 12 2022 17:59:52 by
1.7.2
CN0357 - Toxic gas measurement
CN0216 - Weight Scale