mixer-slider/firmware/slider/adc.h

37 lines
535 B
C
Raw Normal View History

2019-02-09 21:33:45 +01:00
/*
* 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
2019-02-09 21:33:45 +01:00
typedef struct {
2019-02-09 21:33:45 +01:00
} adc_buffer_t;
typedef struct adc {
adc_sample_t buffer[ADC_BUFFER_SIZE];
2019-02-09 21:33:45 +01:00
volatile uint8_t current_channel;
uint8_t * channel_map;
2019-02-09 21:33:45 +01:00
} adc_t;
// the adc instance
extern adc_t adc;
2019-02-09 21:33:45 +01:00
void adc_init(uint8_t * channels);
2019-02-09 21:33:45 +01:00
#define adc_start() ADCSRA |= (1<<ADIE) | (1<<ADSC)
#define adc_stop() ADCSRA &= ~(1<<ADIE)
2019-02-09 21:33:45 +01:00
#endif /* ADC_H_ */