daq 2.0.0.0
DAQ Click Driver

API for configuring and manipulating DAQ Click driver. More...

Topics

 DAQ Registers List
 List of registers of DAQ Click driver.
 
 DAQ Registers Settings
 Settings for registers of DAQ Click driver.
 
 DAQ MikroBUS Map
 MikroBUS pin mapping of DAQ Click driver.
 

Functions

void daq_cfg_setup (daq_cfg_t *cfg)
 DAQ configuration object setup function.
 
err_t daq_init (daq_t *ctx, daq_cfg_t *cfg)
 DAQ initialization function.
 
err_t daq_default_cfg (daq_t *ctx)
 DAQ default configuration function.
 
err_t daq_generic_write (daq_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 DAQ data writing function.
 
err_t daq_byte_write (daq_t *ctx, uint8_t reg, uint8_t data_in)
 DAQ byte writing function.
 
err_t daq_mask_write (daq_t *ctx, uint8_t reg, uint8_t mask, uint8_t data_in)
 DAQ byte writing function with mask.
 
err_t daq_generic_read (daq_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 DAQ data reading function.
 
err_t daq_byte_read (daq_t *ctx, uint8_t reg, uint8_t *data_out)
 DAQ byte reading function.
 
err_t daq_mask_read (daq_t *ctx, uint8_t reg, uint8_t mask, uint8_t *data_out)
 DAQ byte reading function with mask.
 
err_t daq_raw_read (daq_t *ctx, uint8_t *data_out, uint8_t len)
 DAQ reading function.
 
void daq_reset (daq_t *ctx)
 Reset function.
 
uint8_t daq_data_ready (daq_t *ctx)
 Get data ready pin.
 
void daq_set_io3 (daq_t *ctx, uint8_t state)
 Set io3 pin.
 
uint8_t daq_get_iot3 (daq_t *ctx)
 Get io3 pin.
 
err_t daq_set_gain (daq_t *ctx, daq_gain gain)
 Set gain range.
 
err_t daq_read_data (daq_t *ctx, int32_t *adc_data)
 Reading adc data.
 
void daq_calculate_voltage (daq_t *ctx, int32_t adc_data, float *voltage)
 Convert data from raw ADC to voltage.
 

Detailed Description

API for configuring and manipulating DAQ 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

◆ daq_byte_read()

err_t daq_byte_read ( daq_t * ctx,
uint8_t reg,
uint8_t * data_out )

DAQ byte reading function.

This function reads a byte from the selected register.

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

◆ daq_byte_write()

err_t daq_byte_write ( daq_t * ctx,
uint8_t reg,
uint8_t data_in )

DAQ byte writing function.

This function writes a byte to the selected register.

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

◆ daq_calculate_voltage()

void daq_calculate_voltage ( daq_t * ctx,
int32_t adc_data,
float * voltage )

Convert data from raw ADC to voltage.

This function calculates voltage data from raw adc_data and gain value from ctx object.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[in]adc_data: ADC data from device.
[out]voltage: Calculated data in V.
Returns
Nothing.

◆ daq_cfg_setup()

void daq_cfg_setup ( daq_cfg_t * cfg)

DAQ configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ daq_data_ready()

uint8_t daq_data_ready ( daq_t * ctx)

Get data ready pin.

This function reads data ready pin state.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
Returns
Pin state.

◆ daq_default_cfg()

err_t daq_default_cfg ( daq_t * ctx)

DAQ default configuration function.

This function executes a default configuration of DAQ click board.

Parameters
[in]ctx: Click context object. See daq_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.

◆ daq_generic_read()

err_t daq_generic_read ( daq_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

DAQ data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ daq_generic_write()

err_t daq_generic_write ( daq_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

DAQ data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

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

◆ daq_get_iot3()

uint8_t daq_get_iot3 ( daq_t * ctx)

Get io3 pin.

This function reads io3 pin state.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
Returns
Pin state.

◆ daq_init()

err_t daq_init ( daq_t * ctx,
daq_cfg_t * cfg )

DAQ initialization function.

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

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

◆ daq_mask_read()

err_t daq_mask_read ( daq_t * ctx,
uint8_t reg,
uint8_t mask,
uint8_t * data_out )

DAQ byte reading function with mask.

This function reads a byte from the selected register by using mask.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[in]reg: Register address.
[in]mask: Mask.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ daq_mask_write()

err_t daq_mask_write ( daq_t * ctx,
uint8_t reg,
uint8_t mask,
uint8_t data_in )

DAQ byte writing function with mask.

This function writes a byte to the selected register by using mask.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[in]reg: Register address.
[in]mask: Mask.
[in]data_in: Register data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ daq_raw_read()

err_t daq_raw_read ( daq_t * ctx,
uint8_t * data_out,
uint8_t len )

DAQ reading function.

This function reads a desired number of data bytes by using SPI serial interface.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ daq_read_data()

err_t daq_read_data ( daq_t * ctx,
int32_t * adc_data )

Reading adc data.

This function reads a ADC_DATA register using it with DAQ_CONV_ONE_SHOT conversion.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[out]adc_data: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ daq_reset()

void daq_reset ( daq_t * ctx)

Reset function.

This function resets device by toggling rst pin.

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

◆ daq_set_gain()

err_t daq_set_gain ( daq_t * ctx,
daq_gain gain )

Set gain range.

This function sets gain pins and with that sets ADC range.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[in]gain: Gain range. See daq_gain enum definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ daq_set_io3()

void daq_set_io3 ( daq_t * ctx,
uint8_t state )

Set io3 pin.

This function sets io3 pin state.

Parameters
[in]ctx: Click context object. See daq_t object definition for detailed explanation.
[in]state: Pin state to set.
Returns
Nothing.