adc8 2.0.0.0
adc8.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  adc8_t
 Click ctx object definition. More...
 
struct  adc8_cfg_t
 Click configuration structure definition. More...
 
struct  adc8_single_volt_t
 Single channel (volt) type. More...
 
struct  adc8_diff_volt_t
 Diff channel (volt) type. More...
 

Macros

#define ADC8_MAP_MIKROBUS(cfg, mikrobus)
 
#define ADC8_RETVAL   uint8_t
 
#define ADC8_OK   0x00
 
#define ADC8_INIT_ERROR   0xFF
 
#define ADC8_REG_CONFIGURATION   0x01
 
#define ADC8_REG_CONVERSION   0x00
 
#define ADC8_REG_THRESHOLD_LOW   0x02
 
#define ADC8_REG_THRESHOLD_HIGH   0x03
 
#define ADC8_CFG_CONVERSION_ENABLE   0x0000
 
#define ADC8_CFG_CONVERSION_DISABLE   0x8000
 
#define ADC8_CFG_MUX_AINP0_AINN1   0x0000
 
#define ADC8_CFG_MUX_AINP0_AINN3   0x1000
 
#define ADC8_CFG_MUX_AINP1_AINN3   0x2000
 
#define ADC8_CFG_MUX_AINP2_AINN3   0x3000
 
#define ADC8_CFG_MUX_AINP0_GND   0x4000
 
#define ADC8_CFG_MUX_AINP1_GND   0x5000
 
#define ADC8_CFG_MUX_AINP2_GND   0x6000
 
#define ADC8_CFG_MUX_AINP3_GND   0x7000
 
#define ADC8_CFG_GAIN_6144mV   0x0000
 
#define ADC8_CFG_GAIN_4096mV   0x0200
 
#define ADC8_CFG_GAIN_2048mV   0x0400
 
#define ADC8_CFG_GAIN_1024mV   0x0600
 
#define ADC8_CFG_GAIN_512mV   0x0800
 
#define ADC8_CFG_GAIN_256mV   0x0A00
 
#define ADC8_CFG_MODE_CONTINUOUS   0x0000
 
#define ADC8_CFG_MODE_SINGLE   0x0100
 
#define ADC8_CFG_SPS_8   0x0000
 
#define ADC8_CFG_SPS_16   0x0020
 
#define ADC8_CFG_SPS_32   0x0040
 
#define ADC8_CFG_SPS_64   0x0060
 
#define ADC8_CFG_SPS_128   0x0080
 
#define ADC8_CFG_SPS_250   0x00A0
 
#define ADC8_CFG_SPS_475   0x00C0
 
#define ADC8_CFG_SPS_860   0x00E0
 
#define ADC8_CFG_COMP_MODE_TRADITIONAL   0x0000
 
#define ADC8_CFG_COMP_MODE_WINDOW   0x0010
 
#define ADC8_CFG_COMP_POL_LOW   0x0000
 
#define ADC8_CFG_COMP_POL_HIGH   0x0008
 
#define ADC8_CFG_COMP_LAT_ENABLE   0x0000
 
#define ADC8_CFG_COMP_LAT_DISABLE   0x0004
 
#define ADC8_CFG_COMP_QUE_1_CONV   0x0000
 
#define ADC8_CFG_COMP_QUE_2_CONV   0x0001
 
#define ADC8_CFG_COMP_QUE_4_CONV   0x0002
 
#define ADC8_CFG_COMP_QUE_ALERT_CONV   0x0003
 
#define ADC8_DEVICE_SLAVE_ADDR_GND   0x48
 
#define ADC8_DEVICE_SLAVE_ADDR_VDD   0x49
 
#define ADC8_DEVICE_SLAVE_ADDR_SDA   0x4A
 
#define ADC8_DEVICE_SLAVE_ADDR_SCL   0x4B
 
#define ADC8_SINGLE_CHANNEL_0   0x00
 
#define ADC8_SINGLE_CHANNEL_1   0x01
 
#define ADC8_SINGLE_CHANNEL_2   0x02
 
#define ADC8_SINGLE_CHANNEL_3   0x03
 
#define ADC8_DIFF_CHANNEL_0_1   0x04
 
#define ADC8_DIFF_CHANNEL_0_3   0x05
 
#define ADC8_DIFF_CHANNEL_1_3   0x06
 
#define ADC8_DIFF_CHANNEL_2_3   0x07
 

Functions

void adc8_cfg_setup (adc8_cfg_t *cfg)
 Config Object Initialization function.
 
ADC8_RETVAL adc8_init (adc8_t *ctx, adc8_cfg_t *cfg)
 Initialization function.
 
void adc8_default_cfg (adc8_t *ctx)
 Click Default Configuration function.
 
void adc8_generic_write (adc8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void adc8_generic_read (adc8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void adc8_set_cfg_register (adc8_t *ctx, uint16_t cfg)
 Device configuration for measurement.
 
uint16_t adc8_get_adc_value (adc8_t *ctx, uint8_t channel)
 Get ADC value on the channel.
 
float adc8_get_voltage (adc8_t *ctx, uint8_t channel)
 Read Voltage in mV.
 
uint8_t adc8_get_interrupt_state (adc8_t *ctx)
 Get interrupt pin state.
 
void adc8_get_single_channel (adc8_t *ctx, adc8_single_volt_t *volt)
 Get [Package} Single channel voltage.
 
void adc8_get_diff_channel (adc8_t *ctx, adc8_diff_volt_t *volt)
 Get [Package] Diff channel voltage.
 

Detailed Description

This file contains API for ADC 8 Click driver.