adc16 2.0.0.0
ADC 16 Click Driver

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

Topics

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

Functions

void adc16_cfg_setup (adc16_cfg_t *cfg)
 ADC 16 configuration object setup function.
 
err_t adc16_init (adc16_t *ctx, adc16_cfg_t *cfg)
 ADC 16 initialization function.
 
err_t adc16_default_cfg (adc16_t *ctx)
 ADC 16 default configuration function.
 
err_t adc16_single_register_write (adc16_t *ctx, uint8_t reg, uint8_t data_in)
 ADC 16 single register write function.
 
err_t adc16_single_register_read (adc16_t *ctx, uint8_t reg, uint8_t *data_out)
 ADC 16 single register read function.
 
err_t adc16_set_register_bits (adc16_t *ctx, uint8_t reg, uint8_t bit_mask)
 ADC 16 set register bits function.
 
err_t adc16_clear_register_bits (adc16_t *ctx, uint8_t reg, uint8_t bit_mask)
 ADC 16 clear register bits function.
 
err_t adc16_continuous_register_write (adc16_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 ADC 16 continuous register write function.
 
err_t adc16_continuous_register_read (adc16_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 ADC 16 continuous register read function.
 
uint8_t adc16_get_rdy_pin (adc16_t *ctx)
 ADC 16 get rdy pin function.
 
uint8_t adc16_get_alr_pin (adc16_t *ctx)
 ADC 16 get alr pin function.
 
err_t adc16_get_voltage (adc16_t *ctx, float *ain0_voltage, float *ain1_voltage)
 ADC 16 get voltage function.
 

Detailed Description

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

◆ adc16_cfg_setup()

void adc16_cfg_setup ( adc16_cfg_t * cfg)

ADC 16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ adc16_clear_register_bits()

err_t adc16_clear_register_bits ( adc16_t * ctx,
uint8_t reg,
uint8_t bit_mask )

ADC 16 clear register bits function.

This function clears desired bits of the selected register. Bits with value as 1 in register data are cleared and bits with value as 0 in register data are not changed.

Parameters
[in]ctx: Click context object. See adc16_t object definition for detailed explanation.
[in]reg: Register address.
[in]bit_mask: Bit mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc16_continuous_register_read()

err_t adc16_continuous_register_read ( adc16_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

ADC 16 continuous register read function.

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

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

◆ adc16_continuous_register_write()

err_t adc16_continuous_register_write ( adc16_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

ADC 16 continuous register write function.

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

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

◆ adc16_default_cfg()

err_t adc16_default_cfg ( adc16_t * ctx)

ADC 16 default configuration function.

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

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

◆ adc16_get_alr_pin()

uint8_t adc16_get_alr_pin ( adc16_t * ctx)

ADC 16 get alr pin function.

This function returns the ALR pin logic state.

Parameters
[in]ctx: Click context object. See adc16_t object definition for detailed explanation.
Returns
Pin logic level.
Note
None.

◆ adc16_get_rdy_pin()

uint8_t adc16_get_rdy_pin ( adc16_t * ctx)

ADC 16 get rdy pin function.

This function returns the RDY pin logic state.

Parameters
[in]ctx: Click context object. See adc16_t object definition for detailed explanation.
Returns
Pin logic level.
Note
None.

◆ adc16_get_voltage()

err_t adc16_get_voltage ( adc16_t * ctx,
float * ain0_voltage,
float * ain1_voltage )

ADC 16 get voltage function.

This function reads the voltage from two analog input single-ended channels.

Parameters
[in]ctx: Click context object. See adc16_t object definition for detailed explanation.
[out]ain0_voltage: AIN0 voltage value [V].
[out]ain1_voltage: AIN1 voltage value [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc16_init()

err_t adc16_init ( adc16_t * ctx,
adc16_cfg_t * cfg )

ADC 16 initialization function.

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

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

◆ adc16_set_register_bits()

err_t adc16_set_register_bits ( adc16_t * ctx,
uint8_t reg,
uint8_t bit_mask )

ADC 16 set register bits function.

This function sets desired bits of the selected register. Bits with value as 1 in register data are set and bits with value as 0 in register data are not changed.

Parameters
[in]ctx: Click context object. See adc16_t object definition for detailed explanation.
[in]reg: Register address.
[in]bit_mask: Bit mask.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc16_single_register_read()

err_t adc16_single_register_read ( adc16_t * ctx,
uint8_t reg,
uint8_t * data_out )

ADC 16 single register read function.

This function reads a single data from the selected register.

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

◆ adc16_single_register_write()

err_t adc16_single_register_write ( adc16_t * ctx,
uint8_t reg,
uint8_t data_in )

ADC 16 single register write function.

This function writes a single data to the selected register.

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