BeRTOS
Defines | Typedefs | Functions
Generic ADC driver
BeRTOS peripherals drivers

Analog to Digital Converter driver (ADC). More...

Defines

#define ADC_RANGECONV(data, y1, y2)   (((((int32_t)(data)) * ((y2) - (y1))) / ((1 << ADC_BITS) - 1)) + (y1))
 Macro used to convert data from adc range (0...(2 ^ADC_BITS - 1)) to y1 ...

Typedefs

typedef uint16_t adcread_t
 Type for ADC return value.
typedef uint8_t adc_ch_t
 Type for channel.

Functions

adcread_t adc_read (adc_ch_t ch)
 Read the ADC channel ch.
void adc_init (void)
 Initialize the ADC hardware.

Detailed Description

Analog to Digital Converter driver (ADC).

Configuration file: cfg_adc.h

Author:
Francesco Sacchi <batt@develer.com>

Define Documentation

#define ADC_RANGECONV (   data,
  y1,
  y2 
)    (((((int32_t)(data)) * ((y2) - (y1))) / ((1 << ADC_BITS) - 1)) + (y1))

Macro used to convert data from adc range (0...(2 ^ADC_BITS - 1)) to y1 ...

y2 range.

Note:
y1, y2 can be negative, and put in ascending or descending order as well.
data and y2 are evaluated only once, y1 twice.

Definition at line 73 of file adc.h.


Typedef Documentation

typedef uint16_t adcread_t

Type for ADC return value.

Definition at line 57 of file adc.h.