adc_interface.h 554 B

1234567891011121314151617181920212223242526
  1. #ifndef ADC_INTERFACE_H_
  2. #define ADC_INTERFACE_H_
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. #define ADC_VREF_MV (2048)
  6. typedef struct {
  7. uint8_t channel;
  8. uint8_t resolution;
  9. bool continuous;
  10. uint8_t gain;
  11. uint16_t factor;
  12. } ADC_Params;
  13. // 14.04: added pointer for ADC_Params
  14. typedef struct {
  15. bool (*configure)(uint8_t slot_id, ADC_Params *params);
  16. int16_t (*read_voltage)(uint8_t slot_id, ADC_Params *params);
  17. bool (*is_ready)(uint8_t slot_id, ADC_Params *params);
  18. } ADC_Interface;
  19. extern ADC_Interface adc_hal;
  20. #endif