adc24 2.1.0.0
ADC 24 Click Driver

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

Topics

 ADC 24 Control Register Settings
 Settings for control register of ADC 24 Click driver.
 
 ADC 24 MikroBUS Map
 MikroBUS pin mapping of ADC 24 Click driver.
 

Functions

void adc24_cfg_setup (adc24_cfg_t *cfg)
 ADC 24 configuration object setup function.
 
err_t adc24_init (adc24_t *ctx, adc24_cfg_t *cfg)
 ADC 24 initialization function.
 
err_t adc24_generic_write (adc24_t *ctx, uint16_t control)
 ADC 24 data writing function.
 
err_t adc24_generic_read (adc24_t *ctx, uint16_t *data_out)
 ADC 24 data reading function.
 
err_t adc24_get_adc_data (adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, uint16_t *adc_data)
 ADC 24 get ADC data function.
 
err_t adc24_get_voltage (adc24_t *ctx, adc24_ctrl_t ctrl, uint8_t *in_pos, float *voltage)
 ADC 24 get voltage level function.
 

Detailed Description

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

◆ adc24_cfg_setup()

void adc24_cfg_setup ( adc24_cfg_t * cfg)

ADC 24 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ adc24_generic_read()

err_t adc24_generic_read ( adc24_t * ctx,
uint16_t * data_out )

ADC 24 data reading function.

This function reads a output data by using the SPI serial interface.

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

◆ adc24_generic_write()

err_t adc24_generic_write ( adc24_t * ctx,
uint16_t control )

ADC 24 data writing function.

This function writes a desired control data by using the SPI serial interface.

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

◆ adc24_get_adc_data()

err_t adc24_get_adc_data ( adc24_t * ctx,
adc24_ctrl_t ctrl,
uint8_t * in_pos,
uint16_t * adc_data )

ADC 24 get ADC data function.

This function reads a conversion result and selected channel by using the SPI serial interface.

Parameters
[in]ctx: Click context object. See adc24_t object definition for detailed explanation.
[in]ctrl: Control register object. See adc24_ctrl_t object definition for detailed explanation.
[out]in_pos: Voltage input channel position [0-15].
[out]adc_data: 12-bit ADC raw data value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc24_get_voltage()

err_t adc24_get_voltage ( adc24_t * ctx,
adc24_ctrl_t ctrl,
uint8_t * in_pos,
float * voltage )

ADC 24 get voltage level function.

This function reads the results of 12-bit ADC raw data and converts them to proportional voltage levels by using the SPI serial interface.

Parameters
[in]ctx: Click context object. See adc24_t object definition for detailed explanation.
[in]ctrl: Control register object. See adc24_ctrl_t object definition for detailed explanation.
[out]in_pos: Voltage input channel position [0-15].
[out]voltage: Output voltage level [0-2.5] or [0-5.0].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc24_init()

err_t adc24_init ( adc24_t * ctx,
adc24_cfg_t * cfg )

ADC 24 initialization function.

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

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