BeRTOS
Defines | Functions
adc_at91.h File Reference

ADC hardware-specific definition. More...

#include <hw/hw_cpufreq.h>
#include "cfg/cfg_adc.h"
#include <cfg/compiler.h>

Go to the source code of this file.

Defines

#define ADC_MUX_MAXCH   8
 ADC config define.
#define ADC_COMPUTED_PRESCALER   (DIV_ROUNDUP(CPU_FREQ, 2 * CONFIG_ADC_CLOCK) - 1)
 Macro for computing correct value to write into ADC register.
#define ADC_INIT_PINS()
 Init pins macro for adc.

Functions

void adc_hw_select_ch (uint8_t ch)
 Select mux channel ch.
uint16_t adc_hw_read (void)
 Start an ADC convertion.
void adc_hw_init (void)
 Init ADC hardware.

Detailed Description

ADC hardware-specific definition.

Author:
Daniele Basile <asterix@develer.com>

Definition in file adc_at91.h.


Define Documentation

#define ADC_INIT_PINS ( )
Value:
do { \
    } while (0)

Init pins macro for adc.

Define PIO controller for enable ADC function. Init the ADC pins. Implement it if necessary.

Definition at line 87 of file adc_at91.h.


Function Documentation

uint16_t adc_hw_read ( void  )

Start an ADC convertion.

If a kernel is present, preempt until convertion is complete, otherwise a busy wait on ADC_DRDY bit is done.

If a kernel is present, preempt until convertion is complete, otherwise a busy wait on ADCS bit is done.

Definition at line 130 of file adc_at91.c.

void adc_hw_select_ch ( uint8_t  ch)

Select mux channel ch.

Generally the stm32 cpu family allow us to program the order of adc channel that we want to read. In this driver implementation we put as fist channel to read the select ones.

Definition at line 116 of file adc_at91.c.