Add set_GPIO, handle GPIO 36/39 bug

This commit is contained in:
philippe44
2020-02-01 01:53:50 -08:00
parent e1e3b820f3
commit dfebb8ceb6
7 changed files with 44 additions and 16 deletions

View File

@@ -17,6 +17,13 @@
#include "driver/adc.h"
#include "battery.h"
/*
There is a bug in esp32 which causes a spurious interrupt on gpio 36/39 when
using ADC, AMP and HALL sensor. Rather than making battery aware, we just ignore
if as the interrupt lasts 80ns and should be debounced (and the ADC read does not
happen very often)
*/
#define BATTERY_TIMER (10*1000)
static const char *TAG = "battery";
@@ -27,6 +34,13 @@ static struct {
TimerHandle_t timer;
} battery;
/****************************************************************************************
*
*/
int battery_value_svc(void) {
return battery.avg;
}
/****************************************************************************************
*
*/