ESP32AnalogRead
Public Member Functions | Private Attributes
ESP32AnalogRead Class Reference

#include <ESP32AnalogRead.h>

Public Member Functions

 ESP32AnalogRead (int pin=-1)
 
 ~ESP32AnalogRead ()
 
void attach (int pin)
 
float readVoltage ()
 
uint32_t readMiliVolts ()
 

Private Attributes

int myPin =0
 
esp_adc_cal_characteristics_t characteristics
 
adc_channel_t channel
 
boolean attached =false
 

Detailed Description

Definition at line 7 of file ESP32AnalogRead.h.

Constructor & Destructor Documentation

◆ ESP32AnalogRead()

ESP32AnalogRead::ESP32AnalogRead ( int  pin = -1)

Definition at line 11 of file ESP32AnalogRead.cpp.

References attach().

Here is the call graph for this function:

◆ ~ESP32AnalogRead()

ESP32AnalogRead::~ESP32AnalogRead ( )
inline

Definition at line 15 of file ESP32AnalogRead.h.

References attach(), readMiliVolts(), and readVoltage().

Here is the call graph for this function:

Member Function Documentation

◆ attach()

void ESP32AnalogRead::attach ( int  pin)

Definition at line 16 of file ESP32AnalogRead.cpp.

References attached, channel, and myPin.

Referenced by ESP32AnalogRead(), setup(), and ~ESP32AnalogRead().

◆ readMiliVolts()

uint32_t ESP32AnalogRead::readMiliVolts ( )

typedef enum { ADC1_CHANNEL_0 = 0, !< ADC1 channel 0 is GPIO36 ADC1_CHANNEL_1, !< ADC1 channel 1 is GPIO37 ADC1_CHANNEL_2, !< ADC1 channel 2 is GPIO38 ADC1_CHANNEL_3, !< ADC1 channel 3 is GPIO39 ADC1_CHANNEL_4, !< ADC1 channel 4 is GPIO32 ADC1_CHANNEL_5, !< ADC1 channel 5 is GPIO33 ADC1_CHANNEL_6, !< ADC1 channel 6 is GPIO34 ADC1_CHANNEL_7, !< ADC1 channel 7 is GPIO35 ADC1_CHANNEL_MAX, } adc1_channel_t;

typedef enum { ADC2_CHANNEL_0 = 0, !< ADC2 channel 0 is GPIO4 ADC2_CHANNEL_1, !< ADC2 channel 1 is GPIO0 ADC2_CHANNEL_2, !< ADC2 channel 2 is GPIO2 ADC2_CHANNEL_3, !< ADC2 channel 3 is GPIO15 ADC2_CHANNEL_4, !< ADC2 channel 4 is GPIO13 ADC2_CHANNEL_5, !< ADC2 channel 5 is GPIO12 ADC2_CHANNEL_6, !< ADC2 channel 6 is GPIO14 ADC2_CHANNEL_7, !< ADC2 channel 7 is GPIO27 ADC2_CHANNEL_8, !< ADC2 channel 8 is GPIO25 ADC2_CHANNEL_9, !< ADC2 channel 9 is GPIO26 ADC2_CHANNEL_MAX, } adc2_channel_t;

Definition at line 54 of file ESP32AnalogRead.cpp.

References attached, channel, characteristics, myPin, and V_REF.

Referenced by readVoltage(), and ~ESP32AnalogRead().

◆ readVoltage()

float ESP32AnalogRead::readVoltage ( )

Definition at line 22 of file ESP32AnalogRead.cpp.

References readMiliVolts().

Referenced by loop(), and ~ESP32AnalogRead().

Here is the call graph for this function:

Field Documentation

◆ attached

boolean ESP32AnalogRead::attached =false
private

Definition at line 12 of file ESP32AnalogRead.h.

Referenced by attach(), and readMiliVolts().

◆ channel

adc_channel_t ESP32AnalogRead::channel
private

Definition at line 11 of file ESP32AnalogRead.h.

Referenced by attach(), and readMiliVolts().

◆ characteristics

esp_adc_cal_characteristics_t ESP32AnalogRead::characteristics
private

Definition at line 10 of file ESP32AnalogRead.h.

Referenced by readMiliVolts().

◆ myPin

int ESP32AnalogRead::myPin =0
private

Definition at line 9 of file ESP32AnalogRead.h.

Referenced by attach(), and readMiliVolts().


The documentation for this class was generated from the following files: