You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
718 B

#ifndef _ADC_H_
#define _ADC_H_
#include "port.h"
#include "systick.h"
void ADCInit(uint8_t *port, uint8_t pin);
void get_adc_value(void);
void try_adc_gather(void);
void beg_average_value(uint16_t *adc_buff);
typedef struct {
bool abnormal_state;
bool past_count_reached_five;
bool first_detection_abnormal;
uint16_t adc_value_buff[5];
uint8_t adc_value_count;
uint16_t adc_just_now_gather_val;
uint8_t *port;
uint8_t pin;
} adc_t;
void record_adc_gather_value(uint16_t adc_value);
// typedef struct {
// uint16_t adc_value_buff[5];
// uint8_t adc_value_count;
// bool abnormal_state;
// bool past_count_reached_five; //Ïû¶¶Ê¹ÓÃ
// } adc_t;
#endif