jonny_ji7 1f53fabd19 Create gpio_adc component - outsource readAdc()
remove duplicate code:
function readAdc was used in multiple files, outsourced this to gpio
component
2022-09-12 11:19:47 +02:00

10 lines
344 B
C++

#pragma once
#include <stdio.h>
#include "driver/adc.h"
//function for multisampling an anlog input
//measures 30 times and returns average
//if invertion is used currently 11bit resolution is assumed (subtracts from 4095)
//TODO: rework this function to be more universal
int gpio_readAdc(adc1_channel_t adc_channel, bool inverted = false);