adc13 2.0.0.0
ADC 13 Click Driver

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

Topics

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

Functions

void adc13_cfg_setup (adc13_cfg_t *cfg)
 ADC 13 configuration object setup function.
 
err_t adc13_init (adc13_t *ctx, adc13_cfg_t *cfg)
 ADC 13 initialization function.
 
err_t adc13_default_cfg (adc13_t *ctx)
 ADC 13 default configuration function.
 
err_t adc13_generic_write (adc13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 ADC 13 data writing function.
 
err_t adc13_generic_read (adc13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 ADC 13 data reading function.
 
err_t adc13_send_command (adc13_t *ctx, uint8_t cmd)
 ADC 13 send command function.
 
void adc13_set_str_pin (adc13_t *ctx, uint8_t state)
 ADC 13 set STR pin function.
 
void adc13_set_rst_pin (adc13_t *ctx, uint8_t state)
 ADC 13 set RST pin function.
 
uint8_t adc13_get_dtr_pin (adc13_t *ctx)
 ADC 13 get DTR pin function.
 
void adc13_reset_by_pin (adc13_t *ctx)
 ADC 13 reset by pin function.
 
err_t adc13_reset_by_command (adc13_t *ctx)
 ADC 13 reset by command function.
 
void adc13_power_down (adc13_t *ctx)
 ADC 13 power down function.
 
void adc13_power_up (adc13_t *ctx)
 ADC 13 power up function.
 
err_t adc13_read_register (adc13_t *ctx, uint8_t reg, uint8_t *data_out)
 ADC 13 read register function.
 
err_t adc13_write_register (adc13_t *ctx, uint8_t reg, uint8_t data_in)
 ADC 13 write register function.
 
err_t adc13_read_registers (adc13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t count)
 ADC 13 read registers function.
 
err_t adc13_write_registers (adc13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t count)
 ADC 13 write registers function.
 
err_t adc13_set_register_bits (adc13_t *ctx, uint8_t reg, uint8_t bit_mask, uint8_t data_in)
 ADC 13 set register bits function.
 
err_t adc13_get_register_bits (adc13_t *ctx, uint8_t reg, uint8_t bit_mask, uint8_t *data_out)
 ADC 13 get register bits function.
 
err_t adc13_read_raw_data (adc13_t *ctx, int32_t *data_out)
 ADC 13 read raw data function.
 
err_t adc13_measure_voltage (adc13_t *ctx, float vref, float *voltage)
 ADC 13 measure voltage function.
 
err_t adc13_measure_temperature (adc13_t *ctx, float *temperature)
 ADC 13 measure temperature function.
 
err_t adc13_set_input_channel (adc13_t *ctx, uint8_t pos, uint8_t neg)
 ADC 13 set input channel function.
 
err_t adc13_set_voltage_reference (adc13_t *ctx, uint8_t pos, uint8_t neg)
 ADC 13 set voltage reference function.
 
err_t adc13_set_gain (adc13_t *ctx, uint8_t gain)
 ADC 13 set gain function.
 
err_t adc13_set_sample_rate (adc13_t *ctx, uint8_t s_rate)
 ADC 13 set sample rate function.
 

Detailed Description

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

◆ adc13_cfg_setup()

void adc13_cfg_setup ( adc13_cfg_t * cfg)

ADC 13 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ adc13_default_cfg()

err_t adc13_default_cfg ( adc13_t * ctx)

ADC 13 default configuration function.

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

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

◆ adc13_generic_read()

err_t adc13_generic_read ( adc13_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

ADC 13 data reading function.

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

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]reg: Start register address.
[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.
Note
None.

◆ adc13_generic_write()

err_t adc13_generic_write ( adc13_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

ADC 13 data writing function.

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

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]reg: Start register address.
[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.
Note
None.

◆ adc13_get_dtr_pin()

uint8_t adc13_get_dtr_pin ( adc13_t * ctx)

ADC 13 get DTR pin function.

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

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

◆ adc13_get_register_bits()

err_t adc13_get_register_bits ( adc13_t * ctx,
uint8_t reg,
uint8_t bit_mask,
uint8_t * data_out )

ADC 13 get register bits function.

This function reads a desired bits of input register using the appropriate bit mask.

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

◆ adc13_init()

err_t adc13_init ( adc13_t * ctx,
adc13_cfg_t * cfg )

ADC 13 initialization function.

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

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

◆ adc13_measure_temperature()

err_t adc13_measure_temperature ( adc13_t * ctx,
float * temperature )

ADC 13 measure temperature function.

This function measures the internal temperature in Celsius.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[out]temperature: Temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc13_measure_voltage()

err_t adc13_measure_voltage ( adc13_t * ctx,
float vref,
float * voltage )

ADC 13 measure voltage function.

This function starts ADC conversation, reads RAW ADC data then calculates the voltage using the input vref for calculations.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]vref: Voltage reference (either in volts or milivolts).
[out]data_out: RAW ADC data read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc13_power_down()

void adc13_power_down ( adc13_t * ctx)

ADC 13 power down function.

This function powers down the chip via the RST pin.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ adc13_power_up()

void adc13_power_up ( adc13_t * ctx)

ADC 13 power up function.

This function powers up the chip via the RST pin.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ adc13_read_raw_data()

err_t adc13_read_raw_data ( adc13_t * ctx,
int32_t * data_out )

ADC 13 read raw data function.

This function reads raw ADC data after the conversation is finished.

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

◆ adc13_read_register()

err_t adc13_read_register ( adc13_t * ctx,
uint8_t reg,
uint8_t * data_out )

ADC 13 read register function.

This function reads a data byte from a desider register by using SPI serial interface.

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

◆ adc13_read_registers()

err_t adc13_read_registers ( adc13_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t count )

ADC 13 read registers function.

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

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

◆ adc13_reset_by_command()

err_t adc13_reset_by_command ( adc13_t * ctx)

ADC 13 reset by command function.

This function resets the chip by issuing the RESET command.

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

◆ adc13_reset_by_pin()

void adc13_reset_by_pin ( adc13_t * ctx)

ADC 13 reset by pin function.

This function resets the chip by toggling the RST pin state.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ adc13_send_command()

err_t adc13_send_command ( adc13_t * ctx,
uint8_t cmd )

ADC 13 send command function.

This function writes a command byte to the module by using SPI serial interface.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]cmd: Command byte.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function toggles chip select, so it is used only when a command byte needs to be executed without following bytes.

◆ adc13_set_gain()

err_t adc13_set_gain ( adc13_t * ctx,
uint8_t gain )

ADC 13 set gain function.

This function sets the ADC gain.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]gain: Gain value [0-5].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc13_set_input_channel()

err_t adc13_set_input_channel ( adc13_t * ctx,
uint8_t pos,
uint8_t neg )

ADC 13 set input channel function.

This function sets the ADC input positive and negative channels.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]pos: Positive channel.
[in]neg: Negative channel.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc13_set_register_bits()

err_t adc13_set_register_bits ( adc13_t * ctx,
uint8_t reg,
uint8_t bit_mask,
uint8_t data_in )

ADC 13 set register bits function.

This function sets a desired bits of input register using the appropriate bit mask, other bits remain unchanged.

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

◆ adc13_set_rst_pin()

void adc13_set_rst_pin ( adc13_t * ctx,
uint8_t state )

ADC 13 set RST pin function.

This function sets reset or power down by setting the RST pin logic state.

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

◆ adc13_set_sample_rate()

err_t adc13_set_sample_rate ( adc13_t * ctx,
uint8_t s_rate )

ADC 13 set sample rate function.

This function sets the ADC sample rate.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]s_rate: Sample rate value [0-15].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc13_set_str_pin()

void adc13_set_str_pin ( adc13_t * ctx,
uint8_t state )

ADC 13 set STR pin function.

This function sets start conversion control by setting the STR pin logic state.

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

◆ adc13_set_voltage_reference()

err_t adc13_set_voltage_reference ( adc13_t * ctx,
uint8_t pos,
uint8_t neg )

ADC 13 set voltage reference function.

This function sets the ADC inputs for positive and negative voltage reference.

Parameters
[in]ctx: Click context object. See adc13_t object definition for detailed explanation.
[in]pos: Positive reference.
[in]neg: Negative reference.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ adc13_write_register()

err_t adc13_write_register ( adc13_t * ctx,
uint8_t reg,
uint8_t data_in )

ADC 13 write register function.

This function writes a data byte to a desider register by using SPI serial interface.

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

◆ adc13_write_registers()

err_t adc13_write_registers ( adc13_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t count )

ADC 13 write registers function.

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

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