rtd2  2.0.0.0
Functions
Public function

Functions

void rtd2_cfg_setup (rtd2_cfg_t *cfg)
 Config Object Initialization function. More...
 
err_t rtd2_init (rtd2_t *ctx, rtd2_cfg_t *cfg)
 Initialization function. More...
 
void rtd2_default_cfg (rtd2_t *ctx)
 Set default configuration function. More...
 
void rtd2_hw_reset (rtd2_t *ctx)
 Hardware reset function. More...
 
void rtd2_toggle_cs (rtd2_t *ctx, uint8_t cs_state)
 Toggle CS pin function. More...
 
void rtd2_enable_start (rtd2_t *ctx, uint8_t en_start)
 Enable conversion start function. More...
 
uint8_t rtd2_check_interupt (rtd2_t *ctx)
 Check interrupt status function. More...
 
void rtd2_send_cmd (rtd2_t *ctx, uint8_t cmd)
 Send command function. More...
 
void rtd2_set_wakeup (rtd2_t *ctx)
 Set wakeup function. More...
 
void rtd2_set_sleep (rtd2_t *ctx)
 Set to sleep function. More...
 
void rtd2_set_sync (rtd2_t *ctx)
 Set sync function. More...
 
void rtd2_set_reset (rtd2_t *ctx)
 Set reset function. More...
 
void rtd2_set_read_data_once (rtd2_t *ctx)
 Set read data once function. More...
 
void rtd2_set_read_data_continuous (rtd2_t *ctx)
 Set read data continuous function. More...
 
void rtd2_set_stop_data (rtd2_t *ctx)
 Set stop data function. More...
 
void rtd2_write_continuous (rtd2_t *ctx, uint8_t reg, uint8_t *p_tx_data, uint8_t n_bytes)
 Continuous write the data function. More...
 
void rtd2_read_continuous (rtd2_t *ctx, uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes)
 Continuous read the data function. More...
 
void rtd2_write_reg (rtd2_t *ctx, uint8_t reg, uint8_t tx_data)
 Write the register function. More...
 
uint8_t rtd2_read_reg (rtd2_t *ctx, uint8_t reg)
 Read the register function. More...
 
uint8_t rtd2_set_burn_out_source (rtd2_t *ctx, uint8_t burn_out)
 Set burn out source function. More...
 
void rtd2_set_mux_sel (rtd2_t *ctx, uint8_t adc_pos, uint8_t adc_neg)
 Set multiplexer selection function. More...
 
uint8_t rtd2_set_bias (rtd2_t *ctx, uint8_t bias)
 Set bias function. More...
 
uint8_t rtd2_set_int_ref (rtd2_t *ctx, uint8_t s_ref)
 Set int ref function. More...
 
void rtd2_set_system_monitor (rtd2_t *ctx, uint8_t sys_mon)
 Set system monitor function. More...
 
void rtd2_set_system_control (rtd2_t *ctx, uint8_t gain, uint8_t output_rate)
 Set system control function. More...
 
void rtd2_set_idac_current_mag (rtd2_t *ctx, uint8_t c_idac)
 Set IDAC current magnitude function. More...
 
void rtd2_set_idac_current_out (rtd2_t *ctx, uint8_t c_out_1, uint8_t c_out_2)
 Set IDAC current out function. More...
 
uint8_t rtd2_check_new_data_ready (rtd2_t *ctx)
 Check new data ready function. More...
 
int32_t rtd2_read_output_data (rtd2_t *ctx)
 Read output data function. More...
 
float rtd2_calc_temperature (int32_t adc_val)
 Calculate temperature function. More...
 
float rtd2_get_temperature (rtd2_t *ctx)
 Get temperature function. More...
 

Detailed Description

Function Documentation

◆ rtd2_calc_temperature()

float rtd2_calc_temperature ( int32_t  adc_val)

Calculate temperature function.

Parameters
ctxClick object.
adc_val24-bit ( signed ) ADC output data.
Returns
float temperature in degrees Celsius.

The function calculates the temperature of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_cfg_setup()

void rtd2_cfg_setup ( rtd2_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes Click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ rtd2_check_interupt()

uint8_t rtd2_check_interupt ( rtd2_t ctx)

Check interrupt status function.

Parameters
ctxClick object.
Returns
Interrupt state:
  • 0 : No active.
  • 1 : Active.

The function check interrupt state by return state of the INT pin of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_check_new_data_ready()

uint8_t rtd2_check_new_data_ready ( rtd2_t ctx)

Check new data ready function.

Parameters
ctxClick object.
Returns
  • 0x00 ( RTD2_NEW_DATA_IS_NOT_READY ) : New data is not ready.
  • 0x01 ( RTD2_NEW_DATA_IS_READY ) : New data is ready.

The function check new data ready of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_default_cfg()

void rtd2_default_cfg ( rtd2_t ctx)

Set default configuration function.

Parameters
ctxClick object.

The function set default configuration of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

Note
Default configuration [ reg ] : [ reg value ]
  • 0x00 ( RTD2_REG_MUX0 ) : RTD2_AINP1 | RTD2_AINN2.
  • 0x01 ( RTD2_REG_VBIAS ) : RTD2_VBIAS0.
  • 0x02 ( RTD2_REG_MUX1 ) : RTD2_INT_VREF_ON | RTD2_INT_REF0.
  • 0x03 ( RTD2_REG_SYS0 ) : RTD2_GAIN_4 | RTD2_DR_20.
  • 0x0A ( RTD2_REG_IDAC0 ) : RTD2_IDAC_ID | RTD2_IDAC_1000.
  • 0x0B ( RTD2_REG_IDAC1 ) : RTD2_IDAC1_A0 | RTD2_IDAC1_A03.

◆ rtd2_enable_start()

void rtd2_enable_start ( rtd2_t ctx,
uint8_t  en_start 
)

Enable conversion start function.

Parameters
ctxClick object.
en_start
  • 0x00 : Disable conversion.
  • 0x01 : Enable conversion.

The function enables ADC conversion of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_get_temperature()

float rtd2_get_temperature ( rtd2_t ctx)

Get temperature function.

Parameters
ctxClick object.
Returns
float temperature in degrees Celsius.

The function read output data and return ambient temperature from the PT100 3-wire temperature probe wired to the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_hw_reset()

void rtd2_hw_reset ( rtd2_t ctx)

Hardware reset function.

Parameters
ctxClick object.

The function hardware reset, resets the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

Note
Delay time of 1 ms after RESET rising edge.

◆ rtd2_init()

err_t rtd2_init ( rtd2_t ctx,
rtd2_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

This function initializes all necessary pins and peripherals used for this Click.

◆ rtd2_read_continuous()

void rtd2_read_continuous ( rtd2_t ctx,
uint8_t  reg,
uint8_t *  p_rx_data,
uint8_t  n_bytes 
)

Continuous read the data function.

Parameters
ctxClick object.
reg8-bit register address.
p_rx_datapointer to the memory location where data be stored.
n_bytesnumber of bytes to be read.

The function read a sequential data starting from the targeted register address of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_read_output_data()

int32_t rtd2_read_output_data ( rtd2_t ctx)

Read output data function.

Parameters
ctxClick object.
Returns
read 24-bit ( signed ) output data.

The function read output data of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_read_reg()

uint8_t rtd2_read_reg ( rtd2_t ctx,
uint8_t  reg 
)

Read the register function.

Parameters
ctxClick object.
reg8-bit register address.
Returns
8-bit read data.

The function read the data byte of the desired register address of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_send_cmd()

void rtd2_send_cmd ( rtd2_t ctx,
uint8_t  cmd 
)

Send command function.

Parameters
ctxClick object.
cmd8-bit SPI Commands.

The function sends the command to control the operation of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_bias()

uint8_t rtd2_set_bias ( rtd2_t ctx,
uint8_t  bias 
)

Set bias function.

Parameters
ctxClick object.
bias
  • 0x00 ( RTD2_VBIAS_OFF ) : Bias voltage is not enabled( default ).
  • 0x01 ( RTD2_VBIAS0 ) : VBIAS[0] Voltage Enable.
  • 0x02 ( RTD2_VBIAS1 ) : VBIAS[1] Voltage Enable.
  • 0x04 ( RTD2_VBIAS2 ) : VBIAS[2] Voltage Enable.
  • 0x08 ( RTD2_VBIAS3 ) : VBIAS[3] Voltage Enable.
Returns
status
  • 0x00 ( RTD2_ERROR ) : Error.
  • 0x01 ( RTD2_SUCESS ): Sucess.

The function set bias voltage of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_burn_out_source()

uint8_t rtd2_set_burn_out_source ( rtd2_t ctx,
uint8_t  burn_out 
)

Set burn out source function.

Parameters
ctxClick object.
burn_out
  • 0x00 ( RTD2_BCS_OFF ) : Burn-out current source off( default ).
  • 0x40 ( RTD2_BCS_500 ) : Burn-out current source on, 0.5 �A.
  • 0x80 ( RTD2_BCS_2 ) : Burn-out current source on, 2 �A.
  • 0xC0 ( RTD2_BCS_10 ) : Burn-out current source on, 10 �A.
Returns
status
  • 0x00 ( RTD2_ERROR ) : Error.
  • 0x01 ( RTD2_SUCESS ): Sucess.

The function set burn out source of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_idac_current_mag()

void rtd2_set_idac_current_mag ( rtd2_t ctx,
uint8_t  c_idac 
)

Set IDAC current magnitude function.

Parameters
ctxClick object.
c_idac
  • 0x00 ( RTD2_IDAC_OFF ) : Off( default ).
  • 0x01 ( RTD2_IDAC_50 ) : 50 �A.
  • 0x02 ( RTD2_IDAC_100 ) : 100 �A.
  • 0x03 ( RTD2_IDAC_250 ) : 250 �A.
  • 0x04 ( RTD2_IDAC_500 ) : 500 �A.
  • 0x05 ( RTD2_IDAC_750 ) : 750 �A.
  • 0x06 ( RTD2_IDAC_1000 ) : 1000 �A.
  • 0x07 ( RTD2_IDAC_1500 ) : 1500 �A.

The function set IDAC excitation current magnitude of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_idac_current_out()

void rtd2_set_idac_current_out ( rtd2_t ctx,
uint8_t  c_out_1,
uint8_t  c_out_2 
)

Set IDAC current out function.

Parameters
ctxClick object.
c_out_1
  • 0x00 ( RTD2_IDAC1_A0 ) : AIN0.
  • 0x08 ( RTD2_IDAC1_A1 ) : AIN1.
  • 0x10 ( RTD2_IDAC1_A2 ) : AIN2.
  • 0x18 ( RTD2_IDAC1_A3 ) : AIN3.
c_out_2
  • 0x00 ( RTD2_IDAC2_A0 ) : AIN0.
  • 0x01 ( RTD2_IDAC2_A1 ) : AIN1.
  • 0x02 ( RTD2_IDAC2_A2 ) : AIN2.
  • 0x04 ( RTD2_IDAC2_A3 ) : AIN3.

The function set IDAC excitation current output 1 and 2, of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_int_ref()

uint8_t rtd2_set_int_ref ( rtd2_t ctx,
uint8_t  s_ref 
)

Set int ref function.

Parameters
ctxClick object.
s_ref
  • 0x00 ( RTD2_INT_VREF_OFF ) : Internal reference is always off( default ).
  • 0x20 ( RTD2_INT_VREF_ON ) : Internal reference is always on.
  • 0x40 ( RTD2_INT_VREF_CONV ) : Internal reference is on when conversion on.
Returns
status
  • 0x00 ( RTD2_ERROR ) : Error.
  • 0x01 ( RTD2_SUCESS ): Sucess.

The function set internal reference control of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_mux_sel()

void rtd2_set_mux_sel ( rtd2_t ctx,
uint8_t  adc_pos,
uint8_t  adc_neg 
)

Set multiplexer selection function.

Parameters
ctxClick object.
adc_pos
  • 0x00 ( RTD2_AINP0 ) : AIN0( default ).
  • 0x08 ( RTD2_AINP1 ) : AIN1.
  • 0x10 ( RTD2_AINP2 ) : AIN2.
  • 0x18 ( RTD2_AINP3 ) : AIN3.
adc_neg
  • 0x00 ( RTD2_AINN0 ) : AIN0( default ).
  • 0x01 ( RTD2_AINN1 ) : AIN1.
  • 0x02 ( RTD2_AINN2 ) : AIN2.
  • 0x04 ( RTD2_AINN3 ) : AIN3.

The function set multiplexer selection,
set positive and negative input channel selection of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_read_data_continuous()

void rtd2_set_read_data_continuous ( rtd2_t ctx)

Set read data continuous function.

Parameters
ctxClick object.

The function set to read data continuous, enables read data continuous mode of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_read_data_once()

void rtd2_set_read_data_once ( rtd2_t ctx)

Set read data once function.

Parameters
ctxClick object.

The function set to read data once, loads the most recent conversion result into the output register of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_reset()

void rtd2_set_reset ( rtd2_t ctx)

Set reset function.

Parameters
ctxClick object.

The function set-reset, restores the registers to the respective default values of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_sleep()

void rtd2_set_sleep ( rtd2_t ctx)

Set to sleep function.

Parameters
ctxClick object.

The function set to sleep, places into power-down mode the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_stop_data()

void rtd2_set_stop_data ( rtd2_t ctx)

Set stop data function.

Parameters
ctxClick object.

The function set stop data continuous, terminates read data continuous mode of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_sync()

void rtd2_set_sync ( rtd2_t ctx)

Set sync function.

Parameters
ctxClick object.

The function set sync, resets the ADC digital filter and starts a new conversion of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_system_control()

void rtd2_set_system_control ( rtd2_t ctx,
uint8_t  gain,
uint8_t  output_rate 
)

Set system control function.

Parameters
ctxClick object.
gain
  • 0x00 ( RTD2_GAIN_1 ) : Gain of the PGA = 1( default ).
  • 0x10 ( RTD2_GAIN_2 ) : Gain of the PGA = 2.
  • 0x20 ( RTD2_GAIN_4 ) : Gain of the PGA = 4.
  • 0x30 ( RTD2_GAIN_8 ) : Gain of the PGA = 8.
  • 0x40 ( RTD2_GAIN_16 ) : Gain of the PGA = 16.
  • 0x50 ( RTD2_GAIN_32 ) : Gain of the PGA = 32.
  • 0x60 ( RTD2_GAIN_64 ) : Gain of the PGA = 64.
  • 0x70 ( RTD2_GAIN_128 ) : Gain of the PGA = 128.
output_rate
  • 0x00 ( RTD2_DR_5 ) : Data output rate of the ADC, DR = 5 SPS( default ).
  • 0x01 ( RTD2_DR_10 ) : Data output rate of the ADC, DR = 10 SPS.
  • 0x02 ( RTD2_DR_20 ) : Data output rate of the ADC, DR = 20 SPS.
  • 0x03 ( RTD2_DR_40 ) : Data output rate of the ADC, DR = 40 SPS.
  • 0x04 ( RTD2_DR_80 ) : Data output rate of the ADC, DR = 80 SPS.
  • 0x05 ( RTD2_DR_160 ) : Data output rate of the ADC, DR = 160 SPS.
  • 0x06 ( RTD2_DR_320 ) : Data output rate of the ADC, DR = 320 SPS.
  • 0x07 ( RTD2_DR_640 ) : Data output rate of the ADC, DR = 6400 SPS.
  • 0x08 ( RTD2_DR_1000 ) : Data output rate of the ADC, DR = 1000 SPS.
  • 0x09 ( RTD2_DR_2000 ) : Data output rate of the ADC, DR = 2000 SPS.

The function set system control of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_system_monitor()

void rtd2_set_system_monitor ( rtd2_t ctx,
uint8_t  sys_mon 
)

Set system monitor function.

Parameters
ctxClick object.
sys_mon
  • 0x00 ( RTD2_MEAS_NORM ) : Normal operation( default ).
  • 0x01 ( RTD2_MEAS_OFFSET ) : Offset calibration.
  • 0x02 ( RTD2_MEAS_GAIN ) : Gain calibration.
  • 0x03 ( RTD2_MEAS_TEMP ) : Temperature measuremen.
  • 0x05 ( RTD2_MEAS_REF0 ) : REF0 monitor.
  • 0x06 ( RTD2_MEAS_AVDD ) : Analog supply monitor.
  • 0x07 ( RTD2_MEAS_DVDD ) : Digital supply monitor.

The function set system monitor control of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_set_wakeup()

void rtd2_set_wakeup ( rtd2_t ctx)

Set wakeup function.

Parameters
ctxClick object.

The function set wakeup, after a sleep, power up the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_toggle_cs()

void rtd2_toggle_cs ( rtd2_t ctx,
uint8_t  cs_state 
)

Toggle CS pin function.

Parameters
ctxClick object.
cs_state
  • 0x00 : The pin condition is low.
  • 0x01 : The pin condition is high.

The function toggle CS pin, set CS pin condition of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_write_continuous()

void rtd2_write_continuous ( rtd2_t ctx,
uint8_t  reg,
uint8_t *  p_tx_data,
uint8_t  n_bytes 
)

Continuous write the data function.

Parameters
ctxClick object.
reg8-bit register address.
p_tx_datapointer to the data to be written.
n_bytesnumber of bytes to be written.

The function writes a sequential data starting from the targeted register address of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.

◆ rtd2_write_reg()

void rtd2_write_reg ( rtd2_t ctx,
uint8_t  reg,
uint8_t  tx_data 
)

Write the register function.

Parameters
ctxClick object.
reg8-bit register address.
tx_data8-bit write data.

The function write the data byte of the desired register address of the 4ADS1247 24-Bit, 2-kSPS, Analog-To-Digital Converters With Programmable Gain Amplifier (PGA) For Sensor Measurement on the RTD 2 Click board.