SRA Board Components
ESP-IDF component for SRA Board
Classes | Macros | Typedefs | Functions
adc.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include "esp_adc/adc_oneshot.h"
#include "esp_adc/adc_cali.h"
#include "esp_adc/adc_cali_scheme.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_log.h"
#include "esp_err.h"
#include "pin_defs.h"
Include dependency graph for adc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adc_obj_t
 Structure representing an ADC object. More...
 

Macros

#define ADC_ATTEN   ADC_ATTEN_DB_11
 
#define ADC_BITWIDTH_LEN   ADC_BITWIDTH_12
 

Typedefs

typedef adc_obj_tadc_handle_t
 

Functions

esp_err_t enable_adc1 (adc_obj_t **adc_obj)
 call function config_adc1() and characterize_adc1(). More...
 
int read_adc (adc_handle_t adc_handle, int gpio)
 Reads the adc value from the GPIO(channel) specified. More...
 

Macro Definition Documentation

◆ ADC_ATTEN

#define ADC_ATTEN   ADC_ATTEN_DB_11

◆ ADC_BITWIDTH_LEN

#define ADC_BITWIDTH_LEN   ADC_BITWIDTH_12

Typedef Documentation

◆ adc_handle_t

Function Documentation

◆ enable_adc1()

esp_err_t enable_adc1 ( adc_obj_t **  adc_obj)

call function config_adc1() and characterize_adc1().

Returns
esp_err_t - returns ESP_OK if Configuration and Characterization of adc1 is successful, else it returns ESP_ERR_INVALID_ARG.

◆ read_adc()

int read_adc ( adc_handle_t  adc_handle,
int  gpio 
)

Reads the adc value from the GPIO(channel) specified.

Parameters
adc_handle_tadc_handle - pointer to adc object.
intgpio - gpio pin number of the channel to be read.
Returns
int - returns the adc value read from the channel.