| 1234567891011121314151617181920212223242526 |
- #ifndef ADC_INTERFACE_H_
- #define ADC_INTERFACE_H_
- #include <stdint.h>
- #include <stdbool.h>
- #define ADC_VREF_MV (2048)
- typedef struct {
- uint8_t channel;
- uint8_t resolution;
- bool continuous;
- uint8_t gain;
- uint16_t factor;
- } ADC_Params;
- // 14.04: added pointer for ADC_Params
- typedef struct {
- bool (*configure)(uint8_t slot_id, ADC_Params *params);
- int16_t (*read_voltage)(uint8_t slot_id, ADC_Params *params);
- bool (*is_ready)(uint8_t slot_id, ADC_Params *params);
- } ADC_Interface;
- extern ADC_Interface adc_hal;
- #endif
|