adc15 2.0.0.0
ADC 15 Click Driver

API for configuring and manipulating ADC 15 Click driver. More...

Topics

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

Functions

void adc15_cfg_setup (adc15_cfg_t *cfg)
 ADC 15 configuration object setup function.
 
err_t adc15_init (adc15_t *ctx, adc15_cfg_t *cfg)
 ADC 15 initialization function.
 
err_t adc15_default_cfg (adc15_t *ctx)
 ADC 15 default configuration function.
 
err_t adc15_adc_write (adc15_t *ctx, uint8_t *data_in, uint8_t len)
 Data writing function.
 
err_t adc15_reg_write (adc15_t *ctx, uint8_t reg, uint16_t data_in)
 Register writing function.
 
err_t adc15_multiple_reg_write (adc15_t *ctx, uint8_t reg, uint16_t *data_in, uint8_t data_size)
 Multiple register writing function.
 
err_t adc15_adc_read (adc15_t *ctx, uint8_t *data_out, uint8_t len)
 Data reading function.
 
err_t adc15_reg_read (adc15_t *ctx, uint8_t reg, uint16_t *data_out)
 Register reading function.
 
err_t adc15_multiple_reg_read (adc15_t *ctx, uint8_t reg, uint16_t *data_out, uint8_t data_size)
 Multiple registern reading function.
 
err_t adc15_adc_transfer (adc15_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len)
 Data transfer function.
 
err_t adc15_ltc_write (adc15_t *ctx, uint8_t oct, uint16_t dac, uint8_t cfg)
 LTC writing function.
 
err_t adc15_set_frequency (adc15_t *ctx, uint32_t frequency)
 Set sampling frequency.
 
err_t adc15_read_adc_value (adc15_t *ctx, uint16_t *status, int32_t *ch1_out, int32_t *ch2_out)
 Get raw adc value.
 
err_t adc15_read_voltage (adc15_t *ctx, uint16_t *status, float *ch1_out, float *ch2_out)
 Get voltage value.
 
uint8_t adc15_data_ready (adc15_t *ctx)
 Get data ready state.
 
err_t adc15_set_gain (adc15_t *ctx, adc15_channel_t channel, adc15_gain_t gain)
 Set gain for channel.
 
err_t adc15_set_word_len (adc15_t *ctx, adc15_word_t word_len)
 Set word len.
 

Detailed Description

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

◆ adc15_adc_read()

err_t adc15_adc_read ( adc15_t * ctx,
uint8_t * data_out,
uint8_t len )

Data reading function.

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

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

◆ adc15_adc_transfer()

err_t adc15_adc_transfer ( adc15_t * ctx,
uint8_t * data_in,
uint8_t * data_out,
uint8_t len )

Data transfer function.

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

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
[in]data_in: Data to be written.
[out]data_out: Output read data.
[in]len: Transfer size.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ adc15_adc_write()

err_t adc15_adc_write ( adc15_t * ctx,
uint8_t * data_in,
uint8_t len )

Data writing function.

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

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
[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.

◆ adc15_cfg_setup()

void adc15_cfg_setup ( adc15_cfg_t * cfg)

ADC 15 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ adc15_data_ready()

uint8_t adc15_data_ready ( adc15_t * ctx)

Get data ready state.

This function reads drdy pin status.

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
Returns
State of data ready.
Note
Active low.

◆ adc15_default_cfg()

err_t adc15_default_cfg ( adc15_t * ctx)

ADC 15 default configuration function.

This function executes a default configuration of ADC 15 click board.

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

◆ adc15_init()

err_t adc15_init ( adc15_t * ctx,
adc15_cfg_t * cfg )

ADC 15 initialization function.

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

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

◆ adc15_ltc_write()

err_t adc15_ltc_write ( adc15_t * ctx,
uint8_t oct,
uint16_t dac,
uint8_t cfg )

LTC writing function.

This function writes a data to the LTC by using SPI serial interface.

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
[in]oct: Octet.
[in]dac: DAC.
[in]cfg: Configuration.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ adc15_multiple_reg_read()

err_t adc15_multiple_reg_read ( adc15_t * ctx,
uint8_t reg,
uint16_t * data_out,
uint8_t data_size )

Multiple registern reading function.

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

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

◆ adc15_multiple_reg_write()

err_t adc15_multiple_reg_write ( adc15_t * ctx,
uint8_t reg,
uint16_t * data_in,
uint8_t data_size )

Multiple register writing function.

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

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

◆ adc15_read_adc_value()

err_t adc15_read_adc_value ( adc15_t * ctx,
uint16_t * status,
int32_t * ch1_out,
int32_t * ch2_out )

Get raw adc value.

This function reads status and raw adc data from both channels.

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
[out]status: Output status.
[out]ch1_out: Channel 1 raw adc output.
[out]ch2_out: Channel 2 raw adc output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ adc15_read_voltage()

err_t adc15_read_voltage ( adc15_t * ctx,
uint16_t * status,
float * ch1_out,
float * ch2_out )

Get voltage value.

This function reads status and voltage level from both channels.

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
[out]status: Output status.
[out]ch1_out: Channel 1 voltage value.
[out]ch2_out: Channel 2 voltage value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Voltage values are in V unit.

◆ adc15_reg_read()

err_t adc15_reg_read ( adc15_t * ctx,
uint8_t reg,
uint16_t * data_out )

Register reading function.

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

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

◆ adc15_reg_write()

err_t adc15_reg_write ( adc15_t * ctx,
uint8_t reg,
uint16_t data_in )

Register writing function.

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

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

◆ adc15_set_frequency()

err_t adc15_set_frequency ( adc15_t * ctx,
uint32_t frequency )

Set sampling frequency.

This function sets output frequency of LTC that controls sample rate of ADS131M02.

Parameters
[in]ctx: Click context object. See adc15_t object definition for detailed explanation.
[in]frequency: Frequency to set.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ adc15_set_gain()

err_t adc15_set_gain ( adc15_t * ctx,
adc15_channel_t channel,
adc15_gain_t gain )

Set gain for channel.

This function sets gain for channel selected channel.

Parameters
[in,out]ctx: Click context object. See adc15_t object definition for detailed explanation.
[in]channel: Channel to change gain. See adc15_channel_t enum definition for detailed explanation.
[in]gain: Gain to set. See adc15_gain_t enum definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ adc15_set_word_len()

err_t adc15_set_word_len ( adc15_t * ctx,
adc15_word_t word_len )

Set word len.

This function sets communication word length.

Parameters
[in,out]ctx: Click context object. See adc15_t object definition for detailed explanation.
[in]word_len: Word len to set. See adc15_word_t enum definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.