A collection of Analog Devices drivers for the mbed platform

Embed: (wiki syntax)

« Back to documentation index

CN0398 Class Reference

CN0398 Class Reference

the CN0398 shield class More...

#include <CN0398.h>

Public Member Functions

 CN0398 (PinName cs, PinName swctrl0)
 CN0398 constructor.
float read_rtd ()
 reads the temperature sensor
float read_ph (float temperature=25.0)
 reads the pH sensor
float read_moist ()
 reads the moisture sensor
int32_t read_channel (uint8_t ch)
 reads the ADC channel
float data_to_voltage (uint32_t data, uint8_t gain=1, float VREF=2.5)
 converts counts to voltage - unipolar conversion
float data_to_voltage_bipolar (uint32_t data, uint8_t gain=1, float VREF=2.5)
 converts counts to voltage - bipolar conversion
void enable_channel (int channel)
 enables an ADC channel
void disable_channel (int channel)
 disables an ADC channel
void calibrate_ph_pt0 (float temperature=25.0)
 performs pt 0 calibration.
void calibrate_ph_pt1 (float temperature=25.0)
 performs pt 1 calibration.
void calibrate_ph_offset ()
 performs offset calibration.
void set_digital_output (ad_digital_output_t p, bool state)
 toggles the digital outputs on or off
void start_single_conversion ()
 triggers ADC start of single conversion
void reset ()
 resets the digital interface of the ADC
void setup ()
 initializes the ADC
void init ()
 configures the ADC for the CN0398 application

Detailed Description

the CN0398 shield class

Definition at line 103 of file CN0398.h.


Constructor & Destructor Documentation

CN0398 ( PinName  cs,
PinName  swctrl0 
)

CN0398 constructor.

Parameters:
cs- CN0398 external ADC chip select pin
swctrl0- CN0398 ADP7118 enable pin

Definition at line 16 of file CN0398.cpp.


Member Function Documentation

void calibrate_ph_offset (  )

performs offset calibration.

pH probes should be shorted before calling this method

Definition at line 74 of file CN0398.cpp.

void calibrate_ph_pt0 ( float  temperature = 25.0 )

performs pt 0 calibration.

ph probe should be in calibration solution before calling this method

Parameters:
temp- environment temperature

Definition at line 26 of file CN0398.cpp.

void calibrate_ph_pt1 ( float  temperature = 25.0 )

performs pt 1 calibration.

ph probe should be in calibration solution before calling this method

Parameters:
temp- environment temperature

Definition at line 49 of file CN0398.cpp.

float data_to_voltage ( uint32_t  data,
uint8_t  gain = 1,
float  VREF = 2.5 
)

converts counts to voltage - unipolar conversion

Parameters:
datain counts
gain(optional)- default 1
VREF(optional)- default 2.5 - reference voltage
Returns:
voltage

Definition at line 185 of file CN0398.cpp.

float data_to_voltage_bipolar ( uint32_t  data,
uint8_t  gain = 1,
float  VREF = 2.5 
)

converts counts to voltage - bipolar conversion

Parameters:
datain counts
gain(optional)- default 1
VREF(optional)- default 2.5 - reference voltage
Returns:
voltage

Definition at line 179 of file CN0398.cpp.

void disable_channel ( int  channel )

disables an ADC channel

Parameters:
channel- channel to be disabled

Definition at line 201 of file CN0398.cpp.

void enable_channel ( int  channel )

enables an ADC channel

Parameters:
channel- channel to be enabled

Definition at line 191 of file CN0398.cpp.

void init ( void   )

configures the ADC for the CN0398 application

Definition at line 272 of file CN0398.cpp.

int32_t read_channel ( uint8_t  ch )

reads the ADC channel

Parameters:
chchannel to be read
Returns:
ADC reading in counts

Definition at line 111 of file CN0398.cpp.

float read_moist (  )

reads the moisture sensor

Returns:
reading of the moisture sensor

Definition at line 147 of file CN0398.cpp.

float read_ph ( float  temperature = 25.0 )

reads the pH sensor

Parameters:
temperature(optional)- environment temperature
Returns:
reading of the pH sensor corrected with temperature(if provided)

Definition at line 126 of file CN0398.cpp.

float read_rtd (  )

reads the temperature sensor

Returns:
temperature

Definition at line 88 of file CN0398.cpp.

void reset ( void   )

resets the digital interface of the ADC

Definition at line 259 of file CN0398.cpp.

void set_digital_output ( ad_digital_output_t  p,
bool  state 
)

toggles the digital outputs on or off

Parameters:
p- digital output
state- state of the output

Definition at line 234 of file CN0398.cpp.

void setup (  )

initializes the ADC

Definition at line 267 of file CN0398.cpp.

void start_single_conversion (  )

triggers ADC start of single conversion

Definition at line 247 of file CN0398.cpp.