adswio2 2.0.0.0
Public function

Functions

void adswio2_cfg_setup (adswio2_cfg_t *cfg)
 Config Object Initialization function.
 
ADSWIO2_RETVAL adswio2_init (adswio2_t *ctx, adswio2_cfg_t *cfg)
 Initialization function.
 
void adswio2_default_cfg (adswio2_t *ctx)
 Click Default Configuration function.
 
void adswio2_generic_transfer (adswio2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void adswio2_reset (adswio2_t *ctx)
 Click Reset function.
 
uint8_t adswio2_status_pin_ready (adswio2_t *ctx)
 Ready Pin Status Check function.
 
uint8_t adswio2_status_pin_alert (adswio2_t *ctx)
 Alert Pin Status Check function.
 
void adswio2_set_handler (adswio2_t *ctx, adswio2_handler_t handler)
 Error Handler Setup function.
 
void adswio2_clear_handler (adswio2_t *ctx)
 Error Handler Clear function.
 
adswio2_err_t adswio2_generic_write (adswio2_t *ctx, uint8_t reg_addr, uint16_t data_in)
 Generic Write function.
 
adswio2_err_t adswio2_generic_read (adswio2_t *ctx, uint8_t reg_addr, uint16_t *data_out, uint8_t *rd_status)
 Generic Read function.
 
adswio2_err_t adswio2_generic_multi_read (adswio2_t *ctx, adswio2_read_t *rd)
 Generic Multi Read function.
 
adswio2_err_t adswio2_exe_command (adswio2_t *ctx, uint16_t cmd_key)
 Command Execute function.
 
void adswio2_mask_alert_set (adswio2_t *ctx, uint16_t alert_mask)
 Alert Mask function.
 
adswio2_err_t adswio2_status_live (adswio2_t *ctx, uint16_t *status, uint16_t status_mask)
 Live Status function.
 
adswio2_err_t adswio2_status_data_ready (adswio2_t *ctx, uint8_t *drdy, uint16_t *conv_target)
 Data Ready Status function.
 
adswio2_err_t adswio2_status_alert (adswio2_t *ctx, uint16_t *status, uint16_t status_mask)
 Alert Status function.
 
adswio2_err_t adswio2_set_conv_mode (adswio2_t *ctx, uint8_t mode)
 Conversion Mode Setup function.
 
adswio2_err_t adswio2_enable_ch (adswio2_t *ctx, uint8_t channel)
 Channel Enable function.
 
adswio2_err_t adswio2_enable_diag (adswio2_t *ctx, uint8_t diagnostic)
 Diagnostic Enable function.
 
adswio2_err_t adswio2_set_ch_func (adswio2_t *ctx, uint8_t channel, uint8_t ch_func)
 Channel Function Setup function.
 
adswio2_err_t adswio2_assign_diag (adswio2_t *ctx, uint8_t diagnostic, uint8_t duty)
 Diagnostic Assign function.
 
adswio2_err_t adswio2_get_conv_results (adswio2_t *ctx, uint8_t channel, uint16_t *data_out)
 Channel Results Get function.
 
adswio2_err_t adswio2_get_diag_results (adswio2_t *ctx, uint8_t diagnostic, uint16_t *data_out)
 Diagnostic Results Get function.
 

Detailed Description

Function Documentation

◆ adswio2_assign_diag()

adswio2_err_t adswio2_assign_diag ( adswio2_t * ctx,
uint8_t diagnostic,
uint8_t duty )

Diagnostic Assign function.

Parameters
ctxClick object.
diagnosticSelects diagnostic to be assigned.
dutySelects new duty to be assigned.
Returns
         0  - Ok,
         3  - Readback status error,
         8  - Invalid diagnostic selection,
         9  - CRC error,
         13 - Diagnostic assign error.

@description This function allows user to assign the new duty for the selected diagnostic.

◆ adswio2_cfg_setup()

void adswio2_cfg_setup ( adswio2_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ adswio2_clear_handler()

void adswio2_clear_handler ( adswio2_t * ctx)

Error Handler Clear function.

Parameters
ctxClick object.

@description This function will set the error handler to NULL (unused).

◆ adswio2_default_cfg()

void adswio2_default_cfg ( adswio2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for AD SWIO 2 click.

◆ adswio2_enable_ch()

adswio2_err_t adswio2_enable_ch ( adswio2_t * ctx,
uint8_t channel )

Channel Enable function.

Parameters
ctxClick object.
channelSelects channel/s to be enabled.
Returns
         0 - Ok,
         3 - Readback status error,
         7 - Invalid channel selection,
         9 - CRC error.

@description This function allows user to enable the desired channel/channels.

◆ adswio2_enable_diag()

adswio2_err_t adswio2_enable_diag ( adswio2_t * ctx,
uint8_t diagnostic )

Diagnostic Enable function.

Parameters
ctxClick object.
diagnosticSelects diagnostic/s to be enabled.
Returns
         0 - Ok,
         3 - Readback status error,
         8 - Invalid diagnostic selection,
         9 - CRC error.

@description This function allows user to enable the desired diagnostic/diagnostics.

◆ adswio2_exe_command()

adswio2_err_t adswio2_exe_command ( adswio2_t * ctx,
uint16_t cmd_key )

Command Execute function.

Parameters
ctxClick object.
cmd_keyCommand key to be executed.
Returns
0 - Ok, 6 - Invalid command key.

@description This function executes an entered command key.

◆ adswio2_generic_multi_read()

adswio2_err_t adswio2_generic_multi_read ( adswio2_t * ctx,
adswio2_read_t * rd )

Generic Multi Read function.

Parameters
ctxClick object.
reg_addrAddress which from data reading be started.
data_outMemory where read data be stored.
rd_mode0 - Auto read disable; 2 - Auto read enable.
n_wordsSelects number of data words to be read. The range is from 1 to 4.
Returns
         0  - Ok,
         3  - Readback status error,
         4  - Auto read setup error,
         5  - Number of words is out of range,
         9  - CRC error,
         10 - Invalid register address.

@description This function reads the desired number of 16-bit data words starting from the selected register.

Note
The auto read mode setup allows user to read the same register a couple of times, or to read registers consecutively.

◆ adswio2_generic_read()

adswio2_err_t adswio2_generic_read ( adswio2_t * ctx,
uint8_t reg_addr,
uint16_t * data_out,
uint8_t * rd_status )

Generic Read function.

Parameters
ctxClick object.
reg_addrAddress which from data be read.
data_outMemory where read data be stored.
rd_statusReadback status.
Returns
         0  - Ok,
         3  - Readback status error,
         9  - CRC error,
         10 - Invalid register address.

@description This function reads 16-bit data from the selected register and also shows the readback status.

◆ adswio2_generic_transfer()

void adswio2_generic_transfer ( adswio2_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

@description Generic SPI transfer, for sending and receiving packages

◆ adswio2_generic_write()

adswio2_err_t adswio2_generic_write ( adswio2_t * ctx,
uint8_t reg_addr,
uint16_t data_in )

Generic Write function.

Parameters
ctxClick object.
reg_addrAddress where data be written.
data_inData to be written.
Returns
0 - Ok; 10 - Invalid register address.

@description This function writes 16-bit data to the selected register.

◆ adswio2_get_conv_results()

adswio2_err_t adswio2_get_conv_results ( adswio2_t * ctx,
uint8_t channel,
uint16_t * data_out )

Channel Results Get function.

Parameters
ctxClick object.
channelChoose channel results.
data_outResults of channel conversion.
Returns
         0 - Ok,
         3 - Readback status error,
         7 - Invalid channel selection,
         9 - CRC error.

@description This function allows user to get the converted results of the selected channel.

◆ adswio2_get_diag_results()

adswio2_err_t adswio2_get_diag_results ( adswio2_t * ctx,
uint8_t diagnostic,
uint16_t * data_out )

Diagnostic Results Get function.

Parameters
ctxClick object.
diagnosticChoose diagnostic results.
data_outResults of target diagnostic.
Returns
  
         0 - Ok,
         3 - Readback status error,
         8 - Invalid diagnostic selection,
         9 - CRC error.

@description This function allows user to get the results of the selected diagnostic.

◆ adswio2_init()

ADSWIO2_RETVAL adswio2_init ( adswio2_t * ctx,
adswio2_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ adswio2_mask_alert_set()

void adswio2_mask_alert_set ( adswio2_t * ctx,
uint16_t alert_mask )

Alert Mask function.

Parameters
ctxClick object.
alert_maskSelects alerts to be masked.

@description This function allows user to mask the irrelevant alerts.

◆ adswio2_reset()

void adswio2_reset ( adswio2_t * ctx)

Click Reset function.

@description This function executes a hardware reset of the click board.

◆ adswio2_set_ch_func()

adswio2_err_t adswio2_set_ch_func ( adswio2_t * ctx,
uint8_t channel,
uint8_t ch_func )

Channel Function Setup function.

Parameters
ctxClick object.
channelSelects channel to be modified.
ch_funcSelects new channel function.
Returns
0 - Ok; 7 - Invalid channel selection; 12 - Invalid channel function.

@description This function allows user to modify the functionality of the selected channel.

◆ adswio2_set_conv_mode()

adswio2_err_t adswio2_set_conv_mode ( adswio2_t * ctx,
uint8_t mode )

Conversion Mode Setup function.

Parameters
ctxClick object.
modeMode to be set.
Returns
         0  - Ok,
         3  - Readback status error,
         9  - CRC error,
         11 - Invalid conversion mode.

@description This function sets the conversion mode and performs power control of the click.

◆ adswio2_set_handler()

void adswio2_set_handler ( adswio2_t * ctx,
adswio2_handler_t handler )

Error Handler Setup function.

Parameters
ctxClick object.
handlerFunction to be executed.

@description This function executes an error handler setup.

◆ adswio2_status_alert()

adswio2_err_t adswio2_status_alert ( adswio2_t * ctx,
uint16_t * status,
uint16_t status_mask )

Alert Status function.

Parameters
ctxClick object.
statusAlert status of the click.
status_maskIrrelevant status flags to be masked.
Returns
0 - Ok; 3 - Readback status error; 9 - CRC error.

@description This function allows user to check the alert status, masking the irrelevant status flags.

Note
If any of the alert status flags has been asserted, it will be deasserted automatically by using this function.

◆ adswio2_status_data_ready()

adswio2_err_t adswio2_status_data_ready ( adswio2_t * ctx,
uint8_t * drdy,
uint16_t * conv_target )

Data Ready Status function.

Parameters
ctxClick object.
drdyData ready status; 0 - not ready, 1 - ready.
conv_targetCurrent executed ADC measurement.
Returns
0 - Ok; 3 - Readback status error; 9 - CRC error.

@description This function allows user to check the data ready status and gives an information about current executed AD conversion.

Note
If data ready flag has been asserted, it will be deasserted automatically by using this function.

◆ adswio2_status_live()

adswio2_err_t adswio2_status_live ( adswio2_t * ctx,
uint16_t * status,
uint16_t status_mask )

Live Status function.

Parameters
ctxClick object.
statusLive status of the click.
status_maskIrrelevant status flags to be masked.
Returns
0 - Ok; 3 - Readback status error; 9 - CRC error.

@description This function allows user to check the live status of the click, masking the irrelevant status flags.

◆ adswio2_status_pin_alert()

uint8_t adswio2_status_pin_alert ( adswio2_t * ctx)

Alert Pin Status Check function.

Parameters
ctxClick object.
Returns
State of the alert pin, 0 or 1.

@description This function checks the status of the alert pin.

◆ adswio2_status_pin_ready()

uint8_t adswio2_status_pin_ready ( adswio2_t * ctx)

Ready Pin Status Check function.

Parameters
ctxClick object.
Returns
State of the ready pin, 0 or 1.

@description This function checks the status of the ready pin.