adc26  2.1.0.0
Modules | Functions
ADC 26 Click Driver

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

Modules

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

Functions

void adc26_cfg_setup (adc26_cfg_t *cfg)
 ADC 26 configuration object setup function. More...
 
err_t adc26_init (adc26_t *ctx, adc26_cfg_t *cfg)
 ADC 26 initialization function. More...
 
err_t adc26_default_cfg (adc26_t *ctx)
 ADC 26 default configuration function. More...
 
err_t adc26_write_reg (adc26_t *ctx, uint8_t reg, uint16_t data_in)
 ADC 26 write reg function. More...
 
err_t adc26_read_reg (adc26_t *ctx, uint8_t reg, uint16_t *data_out)
 ADC 26 read reg function. More...
 
uint8_t adc26_get_alert_pin (adc26_t *ctx)
 ADC 26 get alert pin function. More...
 
err_t adc26_start_conversion (adc26_t *ctx, uint8_t mux, uint8_t pga)
 ADC 26 start conversion function. More...
 
err_t adc26_write_threshold (adc26_t *ctx, int16_t lo_thresh, int16_t hi_thresh)
 ADC 26 write threshold function. More...
 
err_t adc26_read_adc (adc26_t *ctx, int16_t *data_out)
 ADC 26 read ADC function. More...
 
err_t adc26_read_voltage (adc26_t *ctx, float *voltage)
 ADC 26 read voltage function. More...
 

Detailed Description

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

◆ adc26_cfg_setup()

void adc26_cfg_setup ( adc26_cfg_t cfg)

ADC 26 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ adc26_default_cfg()

err_t adc26_default_cfg ( adc26_t ctx)

ADC 26 default configuration function.

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

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

◆ adc26_get_alert_pin()

uint8_t adc26_get_alert_pin ( adc26_t ctx)

ADC 26 get alert pin function.

This function returns the ALERT (data ready) pin logic state.

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

◆ adc26_init()

err_t adc26_init ( adc26_t ctx,
adc26_cfg_t cfg 
)

ADC 26 initialization function.

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

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

◆ adc26_read_adc()

err_t adc26_read_adc ( adc26_t ctx,
int16_t *  data_out 
)

ADC 26 read ADC function.

This function reads the RAW ADC measurement.

Parameters
[in]ctx: Click context object. See adc26_t object definition for detailed explanation.
[out]data_out: RAW ADC data measurement [-2048,2047].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc26_read_reg()

err_t adc26_read_reg ( adc26_t ctx,
uint8_t  reg,
uint16_t *  data_out 
)

ADC 26 read reg function.

This function reads a desired data word from the selected register by using I2C serial interface.

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

◆ adc26_read_voltage()

err_t adc26_read_voltage ( adc26_t ctx,
float *  voltage 
)

ADC 26 read voltage function.

This function reads the RAW ADC measurement and converts it to a voltage level.

Parameters
[in]ctx: Click context object. See adc26_t object definition for detailed explanation.
[out]voltage: Voltage level output which is dependent on a PGA setting.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc26_start_conversion()

err_t adc26_start_conversion ( adc26_t ctx,
uint8_t  mux,
uint8_t  pga 
)

ADC 26 start conversion function.

This function starts a single-shot conversion for the selected MUX channel and gain level (full-scale range).

Parameters
[in]ctx: Click context object. See adc26_t object definition for detailed explanation.
[in]mux: MUX channel selection, see ADC26_MUX_x macros definition.
[in]pga: Gain level or full-scale range selection, see ADC26_PGA_x macros definition.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc26_write_reg()

err_t adc26_write_reg ( adc26_t ctx,
uint8_t  reg,
uint16_t  data_in 
)

ADC 26 write reg function.

This function writes a desired data word to the selected register by using I2C serial interface.

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

◆ adc26_write_threshold()

err_t adc26_write_threshold ( adc26_t ctx,
int16_t  lo_thresh,
int16_t  hi_thresh 
)

ADC 26 write threshold function.

This function writes the comparator upper and lower threshold ADC values.

Parameters
[in]ctx: Click context object. See adc26_t object definition for detailed explanation.
[in]lo_thresh: Lower threshold ADC value [-2048,2047].
[in]hi_thresh: Upper threshold ADC value [-2048,2047].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.