Enumerations | Functions

adc.h File Reference

access to ADC and analog multiplexer More...

Go to the source code of this file.


enum  hl_adc_channel { adc_chan0, adc_ref }

decide which channel to sample



void hl_adc_init (void)
 prepare ADC for use
void hl_adc_off (void)
 switch off ADC
void hl_adc_select (hl_adc_channel chan)
 select channel to sample
void hl_adc_start (void)
 start ADC sampling process
uint8_t hl_adc_isready (void)
 check whether sampling process has finished
void hl_adc_StartNwait4conversion (void)
 Do a polled AD measurement.
uint16_t hl_adc_result (void)
 get result from ADC

Detailed Description

access to ADC and analog multiplexer

Enumeration Type Documentation

decide which channel to sample

available channels:


ADC0, connected to battery via 1 MOhm/1 MOhm voltage divider


1.1 V internal reference voltage

} hl_adc_channel;

Function Documentation

void hl_adc_init ( void   ) 

prepare ADC for use

hl_adc_init() powers up the ADC, defines PF0 as analog input, sets the ADC prescaler and selects left-adjustment for the result.

void hl_adc_off ( void   ) 

switch off ADC

hl_adc_off() powers down the ADC to conserve power between sampling.

void hl_adc_StartNwait4conversion ( void   ) 

Do a polled AD measurement.

The function is doing a measurement w/o interrupt support