mixer-slider/firmware/adc.h

40 lines
641 B
C

/*
* 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() do { ADCSRA |= (1<<ADSC); } while(0)
#define adc_finished() (ADCSRA & (1<<ADIF))
#define adc_set_channel(channel) do { ADMUX = channel; } while(0)
#define adc_value() ADC
#endif /* ADC_H_ */