adc21 2.1.0.0
adc21.h File Reference

This file contains API for ADC 21 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  adc21_t
 ADC 21 Click context object. More...
 
struct  adc21_cfg_t
 ADC 21 Click configuration object. More...
 

Macros

#define ADC21_CHANNEL_0   0
 ADC 21 channel selection setting.
 
#define ADC21_CHANNEL_1   1
 
#define ADC21_CHANNEL_2   2
 
#define ADC21_CHANNEL_3   3
 
#define ADC21_CHANNEL_4   4
 
#define ADC21_CHANNEL_5   5
 
#define ADC21_CHANNEL_6   6
 
#define ADC21_CHANNEL_7   7
 
#define ADC21_DATA_RESOLUTION   0x0FFF
 ADC 21 data setting.
 
#define ADC21_AVCC_3V3   3.3
 
#define ADC21_AVCC_5V   5.0
 
#define ADC21_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ADC21_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ADC21_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  adc21_return_value_t { ADC21_OK = 0 , ADC21_ERROR = -1 }
 ADC 21 Click return value data. More...
 

Functions

void adc21_cfg_setup (adc21_cfg_t *cfg)
 ADC 21 configuration object setup function.
 
err_t adc21_init (adc21_t *ctx, adc21_cfg_t *cfg)
 ADC 21 initialization function.
 
err_t adc21_read_raw_adc (adc21_t *ctx, uint8_t channel, uint16_t *raw_adc)
 ADC 21 read raw adc function.
 
err_t adc21_read_voltage (adc21_t *ctx, uint8_t channel, float avcc, float *voltage)
 ADC 21 read voltage function.
 

Detailed Description

This file contains API for ADC 21 Click Driver.

Enumeration Type Documentation

◆ adc21_return_value_t

ADC 21 Click return value data.

Predefined enum values for driver return values.

Enumerator
ADC21_OK 
ADC21_ERROR