2019-02-09 21:33:45 +01:00
|
|
|
/*
|
|
|
|
* adc.c
|
|
|
|
*
|
|
|
|
* Created on: 08.02.2019
|
|
|
|
* Author: julian
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "adc.h"
|
2019-02-10 19:12:40 +01:00
|
|
|
#include "main.h"
|
|
|
|
|
2019-02-09 21:33:45 +01:00
|
|
|
#include <avr/io.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
|
|
|
|
// global adc instance
|
2019-02-13 00:05:52 +01:00
|
|
|
adc_t adc;
|
2019-02-09 21:33:45 +01:00
|
|
|
|
|
|
|
/* adc driver */
|
2019-02-13 00:05:52 +01:00
|
|
|
void adc_init(uint8_t * channels) {
|
2019-02-13 15:18:38 +01:00
|
|
|
// adc.current_channel = 0;
|
|
|
|
// adc.channel_map = channels;
|
2019-02-09 21:33:45 +01:00
|
|
|
|
2019-02-13 00:05:52 +01:00
|
|
|
ADMUX = channels[0];
|
2019-02-13 18:31:11 +01:00
|
|
|
ADCSRA = /*(1<<ADATE) | */ (1<<ADEN) | 2; // enable adc, maximum prescaler value
|
2019-02-09 21:33:45 +01:00
|
|
|
}
|