#ifndef __ADC_H
#define __ADC_H

#ifdef __cplusplus
extern "C" {
#endif

  
#define ADC_FILTER_LEN 20
  

typedef struct {
  float sum;
  uint8_t head;
  uint8_t count;
  float buf[ADC_FILTER_LEN];
} ADC_FILTER_t;

  
//
void adc_init(void);

//
float adc_get_bat_voltage(void);

//
float adc_average(ADC_FILTER_t *flt, float new_value);

//
void adc_task(void);


#ifdef __cplusplus
}
#endif
  
#endif