adc23 2.1.0.0
adc23.h File Reference

This file contains API for ADC 23 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  adc23_t
 ADC 23 Click context object. More...
 
struct  adc23_cfg_t
 ADC 23 Click configuration object. More...
 

Macros

#define ADC_REG_DEV_ID   0x00
 ADC 23 description register.
 
#define ADC_REG_REV_ID   0x01
 
#define ADC_REG_STATUS   0x02
 
#define ADC_REG_CONTROL   0x03
 
#define ADC_REG_MUX   0x04
 
#define ADC_REG_CONFIG1   0x05
 
#define ADC_REG_CONFIG2   0x06
 
#define ADC_REG_CONFIG3   0x07
 
#define ADC_REG_CONFIG4   0x08
 
#define ADC_REG_OFFSET2   0x09
 
#define ADC_REG_OFFSET1   0x0A
 
#define ADC_REG_OFFSET0   0x0B
 
#define ADC_REG_GAIN2   0x0C
 
#define ADC_REG_GAIN1   0x0D
 
#define ADC_REG_GAIN0   0x0E
 
#define ADC_REG_CRC   0x0F
 
#define ADC_CMD_NO_OPERATION   0x00
 ADC 23 description commands.
 
#define ADC_CMD_READ_REG   0x40
 
#define ADC_CMD_WRITE_REG   0x80
 
#define ADC23_INT_VREF_2_5V   2.5f
 ADC 23 default value of the internal voltage reference.
 
#define ADC23_SET_CTRL_STOP   0x01
 ADC 23 description of CONTROL register data values.
 
#define ADC23_SET_CTRL_START   0x02
 
#define ADC23_SET_CTRL_SW_RESET   0x58
 
#define ADC23_MAX_REG_ADDR   0x0F
 
#define ADC23_CONV_V_TO_MV   1000.0f
 ADC 23 description of calculation data values.
 
#define ADC23_FULL_SCALE_OUT_DATA_RANGE   0x7FFFFFul
 ADC 23 description of the ADC data range.
 
#define ADC23_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ADC23_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ADC23_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  adc23_return_value_t { ADC23_OK = 0 , ADC23_ERROR = -1 }
 ADC 23 Click return value data. More...
 

Functions

void adc23_cfg_setup (adc23_cfg_t *cfg)
 ADC 23 configuration object setup function.
 
err_t adc23_init (adc23_t *ctx, adc23_cfg_t *cfg)
 ADC 23 initialization function.
 
err_t adc23_default_cfg (adc23_t *ctx)
 ADC 23 default configuration function.
 
err_t adc23_generic_write (adc23_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 ADC 23 data writing function.
 
err_t adc23_generic_read (adc23_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 ADC 23 data reading function.
 
err_t adc23_generic_transfer (adc23_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len)
 ADC 23 data transfer function.
 
err_t adc23_read_reg_cmd (adc23_t *ctx, uint8_t reg, uint16_t *data_out, uint8_t *reg_data_out)
 ADC 23 read register command function.
 
err_t adc23_read_reg_data (adc23_t *ctx, uint8_t reg, uint32_t *data_out, uint8_t *reg_data_out)
 ADC 23 read register data function.
 
err_t adc23_write_reg_cmd (adc23_t *ctx, uint8_t reg, uint8_t data_in, uint16_t *data_out)
 ADC 23 write register command function.
 
err_t adc23_write_reg_data (adc23_t *ctx, uint8_t reg, uint8_t data_in, uint32_t *data_out)
 ADC 23 write register data function.
 
err_t adc23_sw_reset (adc23_t *ctx)
 ADC 23 software reset function.
 
err_t adc23_start_conversion (adc23_t *ctx)
 ADC 23 start conversion function.
 
err_t adc23_stop_conversion (adc23_t *ctx)
 ADC 23 stop conversion function.
 
err_t adc23_read_conversion_data (adc23_t *ctx, int32_t *adc_data)
 ADC 23 read conversion data function.
 
err_t adc23_get_voltage (adc23_t *ctx, float *voltage)
 ADC 23 read get voltage level function.
 
void adc23_set_start (adc23_t *ctx)
 ADC 23 set start function.
 
void adc23_set_stop (adc23_t *ctx)
 ADC 23 set stop function.
 
void adc23_hw_reset (adc23_t *ctx)
 ADC 23 hardware reset function.
 
uint8_t adc23_get_data_ready (adc23_t *ctx)
 ADC 23 get data ready function.
 

Detailed Description

This file contains API for ADC 23 Click Driver.

Enumeration Type Documentation

◆ adc23_return_value_t

ADC 23 Click return value data.

Predefined enum values for driver return values.

Enumerator
ADC23_OK 
ADC23_ERROR