AVR library
Macros | Functions
adc.c File Reference

ADC routines. More...

#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "swdefs.h"


#define ADC_AVG_SAMP   16


void adc_init (uint8_t nch)
 Init ADC. Channels 0 to nch-1 will be sampled. More...
void adc_startnext (void)
 Start next conversion. More...
void adc_startfree (void)
 Start free running ADC conversions. More...
uint16_t adc_get (const uint8_t ch)
 Get a channel's averaged ADC value. More...

Detailed Description

ADC routines.

Interrupt driven. ADC takes ADC_AVG_SAMP (swdefs.h) and returns their average.

Matej Kogovsek (matej.nosp@m.@ham.nosp@m.radio.nosp@m..si)
This file is part of mat-avr-lib

Macro Definition Documentation

#define ADC_AVG_SAMP   16

How many ADC samples to average

Function Documentation

uint16_t adc_get ( const uint8_t  ch)

Get a channel's averaged ADC value.

[in]chChannel to get
Averaged ADC value for channel
void adc_init ( uint8_t  nch)

Init ADC. Channels 0 to nch-1 will be sampled.

[in]nchNumber of channels
void adc_startfree ( void  )

Start free running ADC conversions.

After a conversion is finished, a new conversion is automatically started.

void adc_startnext ( void  )

Start next conversion.

Use if you want to control when conversions are started. Do not call if free running.