A collection of Analog Devices drivers for the mbed platform

Embed: (wiki syntax)

« Back to documentation index

CN0357 Class Reference

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

CN0357 shield jumper configuration.

Enumerator:
INTERNAL_AD7790 

The shield's AD7790 is used.

EXTERNAL_ADC 

Sensor analog output is routed to A1 pin of the shield.

Definition at line 72 of file CN0357.h.


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:
resistancenew 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

AD5270 instance - can be used for manual overriding.

Definition at line 69 of file CN0357.h.

AD7790 instance - can be used for manual overriding.

Definition at line 68 of file CN0357.h.