/* * adc.h * * Created on: 08.02.2019 * Author: julian */ #ifndef ADC_H_ #define ADC_H_ #include typedef uint16_t adc_sample_t; typedef struct { adc_sample_t * ptr; uint8_t size; } adc_buffer_t; typedef struct adc { adc_buffer_t buffer; uint8_t current_channel; adc_sample_t * current_sample; uint8_t channel_mask; } adc_t; // the adc instance extern volatile adc_t adc; enum { ADC_CHANNEL_0 = 0x01, ADC_CHANNEL_1 = 0x02, ADC_CHANNEL_2 = 0x04, ADC_CHANNEL_3 = 0x08, ADC_CHANNEL_4 = 0x10, ADC_CHANNEL_5 = 0x20, ADC_CHANNEL_6 = 0x40, ADC_CHANNEL_7 = 0x80, ADC_CHANNEL_ALL = 0xFF, }; void adc_init(adc_buffer_t buffer, uint8_t channel_mask); void adc_start(); void adc_stop(); #endif /* ADC_H_ */