25 lines
408 B
C
25 lines
408 B
C
/*
|
|
* adc.c
|
|
*
|
|
* Created on: 08.02.2019
|
|
* Author: julian
|
|
*/
|
|
|
|
#include "adc.h"
|
|
#include "main.h"
|
|
|
|
#include <avr/io.h>
|
|
#include <avr/interrupt.h>
|
|
|
|
// global adc instance
|
|
adc_t adc;
|
|
|
|
/* adc driver */
|
|
void adc_init(uint8_t * channels) {
|
|
// adc.current_channel = 0;
|
|
// adc.channel_map = channels;
|
|
|
|
ADMUX = channels[0];
|
|
ADCSRA = /*(1<<ADATE) | */ (1<<ADEN) | 2; // enable adc, maximum prescaler value
|
|
}
|