Safe Sprinkler
Master/slave irrigation system (ESP-NOW + LoRaWAN)
Loading...
Searching...
No Matches
adc.h
Go to the documentation of this file.
1#ifndef ADC_H
2#define ADC_H
3
4#include "esp_adc/adc_oneshot.h"
5
6#define TARGET_UNIT ADC_UNIT_1 // C6 dosnt have second unit
7#define TARGET_ATTEN ADC_ATTEN_DB_12
8#define TARGET_WIDTH ADC_BITWIDTH_DEFAULT
9#define TIME_BETWEEN_SHOT_MS 3
10
11typedef struct
12{
13 adc_channel_t channel;
14 uint8_t num_samples;
15
16 uint16_t voltage_mv;
17
18 adc_cali_handle_t _cali_handle;
19
21
32esp_err_t adc_sensor_init(adc_sensor* sensor);
33
43esp_err_t adc_sensor_read(adc_sensor* sensor);
44
45#endif
int adc_sensor_init(adc_sensor *sensor)
Initialize an ADC sensor for one-shot readings.
int adc_sensor_read(adc_sensor *sensor)
Read voltage from the ADC sensor.
Definition adc.h:12
int channel
Definition adc.h:13
uint16_t voltage_mv
Definition adc.h:16
void * _cali_handle
Definition adc.h:18
uint8_t num_samples
Definition adc.h:14