Add analogSetAttenuation and analogSetPinAttenuation

This commit is contained in:
me-no-dev
2016-12-14 02:29:51 +02:00
parent 7defc6ebf3
commit e92634a92b
2 changed files with 46 additions and 7 deletions

View File

@ -26,13 +26,22 @@ extern "C" {
#include "esp32-hal.h"
typedef enum {
ADC_0db,
ADC_2_5db,
ADC_6db,
ADC_11db
} adc_attenuation_t;
/*
* Get ADC value for pin
* */
uint16_t analogRead(uint8_t pin);
/*
* Sets the sample bits (9 - 12)
* Sets the sample bits
* Default is 12bit (0 - 4095)
* Range is 9 - 12
* */
void analogSetWidth(uint8_t bits);
@ -61,6 +70,18 @@ void analogSetSamples(uint8_t samples);
* */
void analogSetClockDiv(uint8_t clockDiv);
/*
* Set the attenuation for all channels
* Default is 11db
* */
void analogSetAttenuation(adc_attenuation_t attenuation);
/*
* Set the attenuation for particular pin
* Default is 11db
* */
void analogSetPinAttenuation(uint8_t pin, adc_attenuation_t attenuation);
/*
* Get value for HALL sensor (without LNA)
* connected to pins 36(SVP) and 39(SVN)