adc24 2.1.0.0
adc24.h File Reference

This file contains API for ADC 24 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  adc24_t
 ADC 24 Click context object. More...
 
struct  adc24_cfg_t
 ADC 24 Click configuration object. More...
 
struct  adc24_ctrl_t
 ADC 24 Click control object. More...
 

Macros

#define ADC24_CTRL_SET_WRITE   0x0800u
 ADC 24 control register setting.
 
#define ADC24_CTRL_SET_SEQ   0x0400u
 
#define ADC24_CTRL_SET_CH_0   0x0000u
 
#define ADC24_CTRL_SET_CH_1   0x0040u
 
#define ADC24_CTRL_SET_CH_2   0x0080u
 
#define ADC24_CTRL_SET_CH_3   0x00C0u
 
#define ADC24_CTRL_SET_CH_4   0x0100u
 
#define ADC24_CTRL_SET_CH_5   0x0140u
 
#define ADC24_CTRL_SET_CH_6   0x0180u
 
#define ADC24_CTRL_SET_CH_7   0x01C0u
 
#define ADC24_CTRL_SET_CH_8   0x0200u
 
#define ADC24_CTRL_SET_CH_9   0x0240u
 
#define ADC24_CTRL_SET_CH_10   0x0280u
 
#define ADC24_CTRL_SET_CH_11   0x02C0u
 
#define ADC24_CTRL_SET_CH_12   0x0300u
 
#define ADC24_CTRL_SET_CH_13   0x0340u
 
#define ADC24_CTRL_SET_CH_14   0x0380u
 
#define ADC24_CTRL_SET_CH_15   0x03C0u
 
#define ADC24_CTRL_SET_PM_NORMAL   0x0030u
 
#define ADC24_CTRL_SET_PM_FULL_SHDN   0x0020u
 
#define ADC24_CTRL_SET_PM_AUTO_SHDN   0x0010u
 
#define ADC24_CTRL_SET_PM_STANDBY   0x0000u
 
#define ADC24_CTRL_SET_SHADOW   0x0008u
 
#define ADC24_CTRL_SET_WEAK   0x0004u
 
#define ADC24_CTRL_SET_RANGE_5V   0x0000u
 
#define ADC24_CTRL_SET_RANGE_2_5V   0x0002u
 
#define ADC24_CTRL_SET_CODING_2C   0x0000u
 
#define ADC24_CTRL_SET_CODING_BIN   0x0001u
 
#define ADC24_SEQ_SHADOW_AN_INPUT   0
 ADC 24 sequence selection setting.
 
#define ADC24_SEQ_SHADOW_PROGRAMMING   1
 
#define ADC24_SEQ_SHADOW_ALTERED   2
 
#define ADC24_SEQ_SHADOW_ADDR_CONJ   3
 
#define ADC24_CH_SEL_IN_0   0
 ADC 24 channel selection setting.
 
#define ADC24_CH_SEL_IN_1   1
 
#define ADC24_CH_SEL_IN_2   2
 
#define ADC24_CH_SEL_IN_3   3
 
#define ADC24_CH_SEL_IN_4   4
 
#define ADC24_CH_SEL_IN_5   5
 
#define ADC24_CH_SEL_IN_6   6
 
#define ADC24_CH_SEL_IN_7   7
 
#define ADC24_CH_SEL_IN_8   8
 
#define ADC24_CH_SEL_IN_9   9
 
#define ADC24_CH_SEL_IN_10   10
 
#define ADC24_CH_SEL_IN_11   11
 
#define ADC24_CH_SEL_IN_12   12
 
#define ADC24_CH_SEL_IN_13   13
 
#define ADC24_CH_SEL_IN_14   14
 
#define ADC24_CH_SEL_IN_15   15
 
#define ADC24_PM_STANDBY   0
 ADC 24 power management selection setting.
 
#define ADC24_PM_AUTO_SHDN   1
 
#define ADC24_PM_FULL_SHDN   2
 
#define ADC24_PM_NORMAL   3
 
#define ADC24_WEAK_DOUT_THREE_STATE   0
 ADC 24 serial transfer setting.
 
#define ADC24_WEAK_DOUT_WEAKLY_DRIVEN   1
 
#define ADC24_RANGE_VREF_5V   0
 ADC 24 analog input range selection setting.
 
#define ADC24_RANGE_VREF_2V5   1
 
#define ADC24_CODING_2C   0
 ADC 24 selection of type of output coding.
 
#define ADC24_CODING_BIN   1
 
#define ADC24_ADC_RESOLUTION   0x0FFF
 ADC 24 ADC resolution and voltage reference data value.
 
#define ADC24_VREF_2V5   2.5f
 
#define ADC24_VREF_5V   5.0f
 
#define ADC24_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ADC24_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ADC24_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  adc24_return_value_t { ADC24_OK = 0 , ADC24_ERROR = -1 }
 ADC 24 Click return value data. More...
 

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

This file contains API for ADC 24 Click Driver.

Enumeration Type Documentation

◆ adc24_return_value_t

ADC 24 Click return value data.

Predefined enum values for driver return values.

Enumerator
ADC24_OK 
ADC24_ERROR