STM32F10x library
Macros | Functions
adc.c File Reference

ADC routines. More...

#include <stm32f10x.h>
#include <stm32f10x_adc.h>

Macros

#define ADC_NCH   18
 

Functions

void adc_init (uint32_t ench, uint8_t navg)
 Init ADC. More...
 
void adc_startnext (void)
 Start next conversion. More...
 
void adc_startfree (void)
 Start free running ADC conversions. More...
 
void adc_stopfree (void)
 Stop free running ADC conversions.
 
uint16_t adc_get (const uint8_t ch)
 Get a channel's averaged ADC value. More...
 

Detailed Description

ADC routines.

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

Macro Definition Documentation

#define ADC_NCH   18

Max number of ADC channels

Function Documentation

uint16_t adc_get ( const uint8_t  ch)

Get a channel's averaged ADC value.

Parameters
[in]chChannel to get
Returns
Averaged ADC value for channel
void adc_init ( uint32_t  ench,
uint8_t  navg 
)

Init ADC.

Parameters
[in]enchBitmask of enabled channels (bits 0 to 17)
[in]navgNumber of samples to average (keep this a power of two, i.e. 1,2,4,8,16,...)
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.