mixer-slider/firmware/slider/adc.h

40 lines
641 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 {
2019-02-13 15:18:38 +01:00
//adc_sample_t buffer[ADC_BUFFER_SIZE];
2019-02-09 21:33:45 +01:00
2019-02-13 15:18:38 +01:00
/*volatile uint8_t current_channel;
uint8_t * channel_map;
2019-02-13 15:18:38 +01:00
*/
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
2019-02-13 15:18:38 +01:00
#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
2019-02-09 21:33:45 +01:00
#endif /* ADC_H_ */