/*
 * adc.h
 *
 *  Created on: 08.02.2019
 *      Author: julian
 */

#ifndef ADC_H_
#define ADC_H_

#include <stdint.h>

typedef uint16_t adc_sample_t;

#define ADC_BUFFER_SIZE 5

typedef struct {

} adc_buffer_t;

typedef struct adc {
	adc_sample_t buffer[ADC_BUFFER_SIZE];

	volatile uint8_t current_channel;
	uint8_t * channel_map;
} adc_t;

// the adc instance
extern adc_t adc;

void adc_init(uint8_t * channels);

#define adc_start() ADCSRA |= (1<<ADIE) | (1<<ADSC)
#define adc_stop()  ADCSRA &= ~(1<<ADIE)

#endif /* ADC_H_ */
