gd32_adc.h 665 B

123456789101112131415161718192021222324
  1. #ifndef _GD32_ADC_H__
  2. #define _GD32_ADC_H__
  3. #include "gd32f3x0_libopt.h"
  4. #define ADC_CHAN_AUX_CURR ADC_CHANNEL_1
  5. #define ADC_CHAN_IMON ADC_CHANNEL_9
  6. #define ADC_CHAN_VMON ADC_CHANNEL_8
  7. #define ADC_CHAN_TEMPERATURE_1 ADC_CHANNEL_4
  8. #define ADC_CHAN_TEMPERATURE_2 ADC_CHANNEL_5
  9. #define ADC_CHAN_TEMPERATURE_3 ADC_CHANNEL_6
  10. #define ADC_CHAN_TEMPERATURE_4 ADC_CHANNEL_7 /* pcb temp */
  11. #define ADC_WORK_IDLE 0
  12. #define ADC_WORK_ING 1
  13. #define ADC_WORK_SAMPLE_COMPLTE 2
  14. #define ADC_WORK_FINISH 3
  15. #define ADC_WORK_INTERTUPED 4
  16. int adc_sample(int chan, int calibration);
  17. int adc_sample_avg(int chan, int times);
  18. void adc_init(void);
  19. #endif /* _GD32_ADC_H__ */