adswio3 2.1.0.0
AD-SWIO 3 Click Driver

API for configuring and manipulating AD-SWIO 3 Click driver. More...

Topics

 AD-SWIO 3 Registers List
 List of registers of AD-SWIO 3 Click driver.
 
 AD-SWIO 3 Registers Settings
 Settings for registers of AD-SWIO 3 Click driver.
 
 AD-SWIO 3 MikroBUS Map
 MikroBUS pin mapping of AD-SWIO 3 Click driver.
 

Functions

void adswio3_cfg_setup (adswio3_cfg_t *cfg)
 AD-SWIO 3 configuration object setup function.
 
err_t adswio3_init (adswio3_t *ctx, adswio3_cfg_t *cfg)
 AD-SWIO 3 initialization function.
 
err_t adswio3_default_cfg (adswio3_t *ctx)
 AD-SWIO 3 default configuration function.
 
void adswio3_hw_reset (adswio3_t *ctx)
 AD-SWIO 3 HW reset function.
 
err_t adswio3_register_write (adswio3_t *ctx, uint8_t reg, uint16_t data_in)
 AD-SWIO 3 data writing function.
 
err_t adswio3_register_read (adswio3_t *ctx, uint8_t reg, uint16_t *data_out)
 AD-SWIO 3 data reading function.
 
err_t adswio3_function_setup (adswio3_t *ctx, uint8_t ch_fun)
 AD-SWIO 3 select the channel function.
 
err_t adswio3_adc_config (adswio3_t *ctx, adswio3_adc_cfg_t adc_config)
 AD-SWIO 3 select the ADC config function.
 
err_t adswio3_pwr_optim_config (adswio3_t *ctx, uint8_t buff_sel, uint8_t buff_mode)
 AD-SWIO 3 set power optimization function.
 
err_t adswio3_output_config (adswio3_t *ctx, adswio3_output_cfg_t out_cfg)
 AD-SWIO 3 configures the output settings function.
 
err_t adswio3_rtd_config (adswio3_t *ctx, uint8_t rtd_mode_sel, uint8_t rtd_exc_swap, uint8_t rtd_current)
 AD-SWIO 3 RTD configuration function.
 
err_t adswio3_set_dac_code (adswio3_t *ctx, uint16_t dac_code)
 AD-SWIO 3 sets the DAC code for the output function.
 
err_t adswio3_set_gpio_config (adswio3_t *ctx, uint8_t gpio_sel, uint8_t gpo_data, uint8_t gp_wk_pd_en, uint8_t out_mode)
 AD-SWIO 3 GPIO configuration function.
 
err_t adswio3_set_adc_cnv (adswio3_t *ctx, adswio3_adc_cnv_ctrl_t adc_cnv_ctrl)
 AD-SWIO 3 ADC conversion control function.
 
err_t adswio3_set_diag_assign (adswio3_t *ctx, uint8_t diag_0, uint8_t diag_1, uint8_t diag_2, uint8_t diag_3)
 AD-SWIO 3 assigns diagnostics function.
 
err_t adswio3_get_status (adswio3_t *ctx, adswio3_alert_status_t *alert_status, adswio3_live_status_t *live_status)
 AD-SWIO 3 get status function.
 
err_t adswio3_get_adc_res (adswio3_t *ctx, uint8_t adc_sel, uint16_t *adc_data)
 AD-SWIO 3 gets the ADC conversion result function.
 
err_t adswio3_get_voltage_input (adswio3_t *ctx, uint8_t adc_sel, float *voltage)
 AD-SWIO 3 gets the voltage input function.
 
err_t adswio3_get_diag_res (adswio3_t *ctx, uint8_t diag_sel, uint16_t *adc_diag_data)
 AD-SWIO 3 gets the diagnostic conversion results function.
 
err_t adswio3_get_diag_vtg (adswio3_t *ctx, uint8_t diag_sel, float *diag_vtg)
 AD-SWIO 3 gets the diagnostic conversion results function.
 
err_t adswio3_get_ntc_temp (adswio3_t *ctx, uint8_t diag_sel, float *ntc_temp)
 AD-SWIO 3 gets the NTC temperature function.
 
err_t adswio3_set_alert_mask (adswio3_t *ctx, uint16_t alert_mask)
 AD-SWIO 3 sets the alert mask function.
 
err_t adswio3_set_ppc_vtg (adswio3_t *ctx, float ppc_vtg)
 AD-SWIO 3 power control voltage configuration function.
 
uint8_t adswio3_get_ready (adswio3_t *ctx)
 AD-SWIO 3 gets the ready pin function.
 
uint8_t adswio3_get_alarm (adswio3_t *ctx)
 AD-SWIO 3 gets the alarm pin function.
 

Detailed Description

API for configuring and manipulating AD-SWIO 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ adswio3_adc_config()

err_t adswio3_adc_config ( adswio3_t * ctx,
adswio3_adc_cfg_t adc_config )

AD-SWIO 3 select the ADC config function.

This function selects the ADC configuration for the input and output channel of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]adc_config: ADC config object. See adswio3_adc_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_cfg_setup()

void adswio3_cfg_setup ( adswio3_cfg_t * cfg)

AD-SWIO 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See adswio3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ adswio3_default_cfg()

err_t adswio3_default_cfg ( adswio3_t * ctx)

AD-SWIO 3 default configuration function.

This function executes a default configuration of AD-SWIO 3 click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ adswio3_function_setup()

err_t adswio3_function_setup ( adswio3_t * ctx,
uint8_t ch_fun )

AD-SWIO 3 select the channel function.

This function sets the channel function of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]ch_fun: Sets the channel function [0x00-0x0C].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Values other than those listed as follows select the high impedance function.

◆ adswio3_get_adc_res()

err_t adswio3_get_adc_res ( adswio3_t * ctx,
uint8_t adc_sel,
uint16_t * adc_data )

AD-SWIO 3 gets the ADC conversion result function.

This function is used to read the result of the desired ADC conversion of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]adc_sel: ADC conversion result selection [0-1].
[out]adc_data: 16-bit ADC conversion result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_get_alarm()

uint8_t adswio3_get_alarm ( adswio3_t * ctx)

AD-SWIO 3 gets the alarm pin function.

This function gets states of the ALR [INT] pin of the ADP1034, 3-Channel Isolated Micropower Management Unit with Seven Digital Isolators and Programmable Power Control on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ adswio3_get_diag_res()

err_t adswio3_get_diag_res ( adswio3_t * ctx,
uint8_t diag_sel,
uint16_t * adc_diag_data )

AD-SWIO 3 gets the diagnostic conversion results function.

This function is used to read the desired diagnostic conversion results of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]diag_sel: Diagnostic conversion results selection [0-3].
[out]adc_diag_data: 16-bit diagnostic conversion results.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_get_diag_vtg()

err_t adswio3_get_diag_vtg ( adswio3_t * ctx,
uint8_t diag_sel,
float * diag_vtg )

AD-SWIO 3 gets the diagnostic conversion results function.

This function reads the diagnostic conversion results and converts them to a proportional voltage level by calculating the value of the measured quantity of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]diag_sel: Diagnostic conversion results selection [0-3].
[out]diag_vtg: The voltage level of the selected diagnostics.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Voltage level depends on the diagnostics assigned to the one of four available diagnostics inputs.

◆ adswio3_get_ntc_temp()

err_t adswio3_get_ntc_temp ( adswio3_t * ctx,
uint8_t diag_sel,
float * ntc_temp )

AD-SWIO 3 gets the NTC temperature function.

This function reads the diagnostic conversion results and converts them to an NTC thermistor temperature in degrees Celsius of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]diag_sel: Diagnostic conversion results selection [0-3].
[out]ntc_temp: NTC temperature (degrees Celsius).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_get_ready()

uint8_t adswio3_get_ready ( adswio3_t * ctx)

AD-SWIO 3 gets the ready pin function.

This function gets states of the RDY [PWM] pin of the ADP1034, 3-Channel Isolated Micropower Management Unit with Seven Digital Isolators and Programmable Power Control on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ adswio3_get_status()

err_t adswio3_get_status ( adswio3_t * ctx,
adswio3_alert_status_t * alert_status,
adswio3_live_status_t * live_status )

AD-SWIO 3 get status function.

This function is used to read alert status and live status of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]alert_status: Alert status object. See adswio3_alert_status_t object definition for detailed explanation.
[in]live_status: Live status object. See adswio3_live_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_get_voltage_input()

err_t adswio3_get_voltage_input ( adswio3_t * ctx,
uint8_t adc_sel,
float * voltage )

AD-SWIO 3 gets the voltage input function.

This function reads the raw ADC value and converts them to a proportional voltage level measured by the voltage between the I/OP and I/ON screw terminals of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]adc_sel: ADC conversion result selection [0-1].
[out]voltage: Input voltage level [0V-12V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_hw_reset()

void adswio3_hw_reset ( adswio3_t * ctx)

AD-SWIO 3 HW reset function.

This function performs a hardware reset of the ADP1034, 3-Channel Isolated Micropower Management Unit with Seven Digital Isolators and Programmable Power Control on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ adswio3_init()

err_t adswio3_init ( adswio3_t * ctx,
adswio3_cfg_t * cfg )

AD-SWIO 3 initialization function.

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

Parameters
[out]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See adswio3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_output_config()

err_t adswio3_output_config ( adswio3_t * ctx,
adswio3_output_cfg_t out_cfg )

AD-SWIO 3 configures the output settings function.

This function configures the output settings of the channel of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]out_cfg: Output settings of the channel object. See adswio3_output_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_pwr_optim_config()

err_t adswio3_pwr_optim_config ( adswio3_t * ctx,
uint8_t buff_sel,
uint8_t buff_mode )

AD-SWIO 3 set power optimization function.

This function settings to allow for power optimization of the channel of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]buff_sel: Buffer selection.
[in]buff_mode: Buffer mode (Enable/Disable).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_register_read()

err_t adswio3_register_read ( adswio3_t * ctx,
uint8_t reg,
uint16_t * data_out )

AD-SWIO 3 data reading function.

This function reads a desired data byte from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_register_write()

err_t adswio3_register_write ( adswio3_t * ctx,
uint8_t reg,
uint16_t data_in )

AD-SWIO 3 data writing function.

This function writes a desired data byte to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_rtd_config()

err_t adswio3_rtd_config ( adswio3_t * ctx,
uint8_t rtd_mode_sel,
uint8_t rtd_exc_swap,
uint8_t rtd_current )

AD-SWIO 3 RTD configuration function.

This function configures the 3-wire and 4-wire RTD measurements of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]rtd_mode_sel: 3-Wire or 4-Wire RTD Mode Select.
[in]rtd_exc_swap: 3-Wire RTD Excitation Swap.
[in]rtd_current: RTD Current.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_set_adc_cnv()

err_t adswio3_set_adc_cnv ( adswio3_t * ctx,
adswio3_adc_cnv_ctrl_t adc_cnv_ctrl )

AD-SWIO 3 ADC conversion control function.

This function is used to control the ADC conversions that must be performed of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]out_cfg: ADC conversion control object. See adswio3_adc_cnv_ctrl_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_set_alert_mask()

err_t adswio3_set_alert_mask ( adswio3_t * ctx,
uint16_t alert_mask )

AD-SWIO 3 sets the alert mask function.

This function is used to mask specific status bits from activating the ALERT pin of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]alert_mask: Alert bit mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_set_dac_code()

err_t adswio3_set_dac_code ( adswio3_t * ctx,
uint16_t dac_code )

AD-SWIO 3 sets the DAC code for the output function.

This function is used to set the DAC code for the output functions of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]dac_code: DAC Code Data for the Channel.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_set_diag_assign()

err_t adswio3_set_diag_assign ( adswio3_t * ctx,
uint8_t diag_0,
uint8_t diag_1,
uint8_t diag_2,
uint8_t diag_3 )

AD-SWIO 3 assigns diagnostics function.

This function is used to assign diagnostics to the four available diagnostics inputs of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]diag_0: Select the Diagnostic Assigned to Diagnostic 0.
[in]diag_1: Select the Diagnostic Assigned to Diagnostic 1.
[in]diag_2: Select the Diagnostic Assigned to Diagnostic 2.
[in]diag_3: Select the Diagnostic Assigned to Diagnostic 3.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_set_gpio_config()

err_t adswio3_set_gpio_config ( adswio3_t * ctx,
uint8_t gpio_sel,
uint8_t gpo_data,
uint8_t gp_wk_pd_en,
uint8_t out_mode )

AD-SWIO 3 GPIO configuration function.

This function is used to configure the four GPIO_x pins of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]gpio_sel: GPIO selection.
[in]gpo_data: GPIO drive a logic data.
[in]gp_wk_pd_en: Pad Weak Pull-Down Enable.
[in]out_mode: Select the General-Purpose Output Mode.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adswio3_set_ppc_vtg()

err_t adswio3_set_ppc_vtg ( adswio3_t * ctx,
float ppc_vtg )

AD-SWIO 3 power control voltage configuration function.

This function configures power control voltage level of the AD74115H, Single-Channel, Software Configurable Input and Output with HART Modem on the AD-SWIO 3 Click board.

Parameters
[in]ctx: Click context object. See adswio3_t object definition for detailed explanation.
[in]ppc_vtg: Alert bit mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
PPC voltage reset to the maximum power supply voltage that matches the ADP1034 configuration. Note that once these PPC voltages are updated, further writes are blocked until the transmission completes.