adc3 2.0.0.0
adc3.h File Reference

This file contains API for ADC 3 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  adc3_t
 Click ctx object definition. More...
 
struct  adc3_cfg_t
 Click configuration structure definition. More...
 

Macros

#define ADC3_MAP_MIKROBUS(cfg, mikrobus)
 
#define ADC3_RETVAL   uint8_t
 
#define ADC3_OK   0x00
 
#define ADC3_INIT_ERROR   0xFF
 
#define ADC3_I2C_SLAVE_ADDR   0x68
 
#define ADC3_CFG_REG   0x00
 
#define ADC3_PGA_GAIN_X1   0x00
 
#define ADC3_PGA_GAIN_X2   0x01
 
#define ADC3_PGA_GAIN_X4   0x02
 
#define ADC3_PGA_GAIN_X8   0x03
 
#define ADC3_SAMPLE_RATE_12   0x00
 
#define ADC3_SAMPLE_RATE_14   0x04
 
#define ADC3_SAMPLE_RATE_16   0x08
 
#define ADC3_CONV_ONE_SHOT   0x00
 
#define ADC3_CONV_CONTINOUS   0x10
 
#define ADC3_SELECT_CHANNEL_1   0x00
 
#define ADC3_SELECT_CHANNEL_2   0x20
 
#define ADC3_SELECT_CHANNEL_3   0x40
 
#define ADC3_SELECT_CHANNEL_4   0x60
 
#define ADC3_DATA_START_VALUE   0
 
#define ADC3_DATA_RESOL_RATE_12   0x0F
 
#define ADC3_DATA_RESULT_RATE_12   0x07FF
 
#define ADC3_DATA_RESOL_RATE_14   0x3F
 
#define ADC3_DATA_RESULT_RATE_14   0x1FFF
 
#define ADC3_DATA_RESOL_RATE_16   0xFF
 
#define ADC3_DATA_RESULT_RATE_16   0x7FFF
 
#define ADC3_RDY_SET   0x80
 
#define ADC3_RDY_CLEAR   0x00
 
#define ADC3_GENERAL_CALL_RESET   0x06
 
#define ADC3_GENERAL_CALL_LATCH   0x04
 
#define ADC3_GENERAL_CALL_CONVERSION   0x08
 

Functions

void adc3_cfg_setup (adc3_cfg_t *cfg)
 Config Object Initialization function.
 
ADC3_RETVAL adc3_init (adc3_t *ctx, adc3_cfg_t *cfg)
 Initialization function.
 
void adc3_default_cfg (adc3_t *ctx)
 Click Default Configuration function.
 
void adc3_generic_write (adc3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void adc3_generic_read (adc3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void adc3_reset (adc3_t *ctx)
 General call reset function.
 
void adc3_latch (adc3_t *ctx)
 General call latch function.
 
void adc3_conversion (adc3_t *ctx)
 General call conversion function.
 
int16_t adc3_read_measurement (adc3_t *ctx, uint8_t channel, uint8_t resolution, uint8_t gain)
 ADC3 read measurement function.
 
float adc3_read_voltage (adc3_t *ctx, uint8_t channel, uint8_t resolution, uint8_t gain)
 Read voltage function.
 

Detailed Description

This file contains API for ADC 3 Click driver.

Macro Definition Documentation

◆ ADC3_CONV_CONTINOUS

#define ADC3_CONV_CONTINOUS   0x10

◆ ADC3_CONV_ONE_SHOT

#define ADC3_CONV_ONE_SHOT   0x00

◆ ADC3_DATA_RESOL_RATE_12

#define ADC3_DATA_RESOL_RATE_12   0x0F

◆ ADC3_DATA_RESOL_RATE_14

#define ADC3_DATA_RESOL_RATE_14   0x3F

◆ ADC3_DATA_RESOL_RATE_16

#define ADC3_DATA_RESOL_RATE_16   0xFF

◆ ADC3_DATA_RESULT_RATE_12

#define ADC3_DATA_RESULT_RATE_12   0x07FF

◆ ADC3_DATA_RESULT_RATE_14

#define ADC3_DATA_RESULT_RATE_14   0x1FFF

◆ ADC3_DATA_RESULT_RATE_16

#define ADC3_DATA_RESULT_RATE_16   0x7FFF

◆ ADC3_DATA_START_VALUE

#define ADC3_DATA_START_VALUE   0

◆ ADC3_GENERAL_CALL_CONVERSION

#define ADC3_GENERAL_CALL_CONVERSION   0x08

◆ ADC3_GENERAL_CALL_LATCH

#define ADC3_GENERAL_CALL_LATCH   0x04

◆ ADC3_GENERAL_CALL_RESET

#define ADC3_GENERAL_CALL_RESET   0x06

◆ ADC3_RDY_CLEAR

#define ADC3_RDY_CLEAR   0x00

◆ ADC3_RDY_SET

#define ADC3_RDY_SET   0x80

◆ ADC3_SELECT_CHANNEL_1

#define ADC3_SELECT_CHANNEL_1   0x00

◆ ADC3_SELECT_CHANNEL_2

#define ADC3_SELECT_CHANNEL_2   0x20

◆ ADC3_SELECT_CHANNEL_3

#define ADC3_SELECT_CHANNEL_3   0x40

◆ ADC3_SELECT_CHANNEL_4

#define ADC3_SELECT_CHANNEL_4   0x60