mixer-slider/firmware/slider/adc.h

50 lines
745 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;
typedef struct {
2019-02-10 23:03:00 +01:00
adc_sample_t ** ptr;
2019-02-09 21:33:45 +01:00
uint8_t size;
} adc_buffer_t;
typedef struct adc {
adc_buffer_t buffer;
uint8_t current_channel;
2019-02-10 23:03:00 +01:00
adc_sample_t ** current_sample;
2019-02-09 21:33:45 +01:00
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_ */