adc12 2.0.0.0
ADC 12 Click Driver

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

Topics

 ADC 12 Commands List
 List of commands of ADC 12 Click driver.
 
 ADC 12 Registers Settings
 Settings for registers of ADC 12 Click driver.
 
 ADC 12 MikroBUS Map
 MikroBUS pin mapping of ADC 12 Click driver.
 

Functions

void adc12_cfg_setup (adc12_cfg_t *cfg)
 ADC 12 configuration object setup function.
 
err_t adc12_init (adc12_t *ctx, adc12_cfg_t *cfg)
 ADC 12 initialization function.
 
err_t adc12_send_cmd (adc12_t *ctx, uint8_t cmd_byte)
 ADC 12 send command function.
 
err_t adc12_read_data (adc12_t *ctx, uint16_t *data_out)
 ADC 12 read data function.
 
void adc12_set_sd_mode (adc12_t *ctx, uint8_t sd_mode)
 ADC 12 set the Single-Ended/Differential Inputs function.
 
uint8_t adc12_get_sd_mode (adc12_t *ctx)
 ADC 12 get the Single-Ended/Differential Inputs function.
 
void adc12_set_pd_mode (adc12_t *ctx, uint8_t pd_mode)
 ADC 12 set the Power-Down mode function.
 
uint8_t adc12_get_pd_mode (adc12_t *ctx)
 ADC 12 get the Power-Down mode function.
 
err_t adc12_read_raw_data (adc12_t *ctx, uint8_t ch, uint16_t *data_out)
 ADC 12 read raw ADC data function.
 
err_t adc12_read_voltage (adc12_t *ctx, uint8_t ch, uint16_t vref, float *data_out)
 ADC 12 read voltage function.
 

Detailed Description

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

◆ adc12_cfg_setup()

void adc12_cfg_setup ( adc12_cfg_t * cfg)

ADC 12 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ adc12_get_pd_mode()

uint8_t adc12_get_pd_mode ( adc12_t * ctx)

ADC 12 get the Power-Down mode function.

This function returns the currently set value for the power-down mode.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
Returns
Power-down mode value.
Note
None.

◆ adc12_get_sd_mode()

uint8_t adc12_get_sd_mode ( adc12_t * ctx)

ADC 12 get the Single-Ended/Differential Inputs function.

This function returns the currently set value for the input mode.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
Returns
Input mode value.
Note
None.

◆ adc12_init()

err_t adc12_init ( adc12_t * ctx,
adc12_cfg_t * cfg )

ADC 12 initialization function.

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

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

◆ adc12_read_data()

err_t adc12_read_data ( adc12_t * ctx,
uint16_t * data_out )

ADC 12 read data function.

This function reads two bytes of data from the click board via I2C serial interface.

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

◆ adc12_read_raw_data()

err_t adc12_read_raw_data ( adc12_t * ctx,
uint8_t ch,
uint16_t * data_out )

ADC 12 read raw ADC data function.

This function reads raw 12-bit ADC data from the desired channel.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
[in]ch: Value that defines the ADC channel.
[out]data_out: 12-bit RAW ADC data output.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc12_read_voltage()

err_t adc12_read_voltage ( adc12_t * ctx,
uint8_t ch,
uint16_t vref,
float * data_out )

ADC 12 read voltage function.

This function reads the voltage in milivolts from the desired channel.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
[in]ch: Value that defines the ADC channel.
[in]vref: Reference voltage value.
[out]data_out: ADC voltage in milivolts.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc12_send_cmd()

err_t adc12_send_cmd ( adc12_t * ctx,
uint8_t cmd_byte )

ADC 12 send command function.

This function sends a desired command byte to the click board via I2C serial interface.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
[in]cmd_byte: Command byte.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc12_set_pd_mode()

void adc12_set_pd_mode ( adc12_t * ctx,
uint8_t pd_mode )

ADC 12 set the Power-Down mode function.

This function sets the power-down mode.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
[in]pd_mode: Value that defines power-down mode.
Returns
None.
Note
None.

◆ adc12_set_sd_mode()

void adc12_set_sd_mode ( adc12_t * ctx,
uint8_t sd_mode )

ADC 12 set the Single-Ended/Differential Inputs function.

This function sets the input mode.

Parameters
[out]ctx: Click context object. See adc12_t object definition for detailed explanation.
[in]sd_mode: Value that defines input mode.
Returns
None.
Note
None.