btnut/btnode/include/dev/adc2.h File Reference


Detailed Description

adc driver to sample multiple channels by different components

Date:
16.05.2006
Author:
bosterm


Typedefs

typedef enum adc2_channel_type adc2_channel_t
typedef enum adc2_interrupt_type adc2_interrupt_t
typedef enum adc2_mode_type adc2_mode_t
typedef enum adc2_prescaler_type adc2_prescaler_t
typedef enum adc2_ref_type adc2_ref_t

Enumerations

enum  adc2_channel_type {
  ADC2_CHANNEL_0 = 0, ADC2_CHANNEL_1 = 1, ADC2_CHANNEL_2 = 2, ADC2_CHANNEL_3 = 3,
  ADC2_CHANNEL_4 = 4, ADC2_CHANNEL_5 = 5, ADC2_CHANNEL_6 = 6, ADC2_CHANNEL_7 = 7
}
enum  adc2_interrupt_type { ADC2_INTERRUPT_DISABLE = 0, ADC2_INTERRUPT_ENABLE = 1 << 3 }
enum  adc2_mode_type { ADC2_MODE_SINGLE_CONVERSION = 0, ADC2_MODE_FREE_RUNNING = 1 << 5 }
enum  adc2_prescaler_type {
  ADC2_PRESCALE_DIV2 = 0x00, ADC2_PRESCALE_DIV4 = 0x02, ADC2_PRESCALE_DIV8 = 0x03, ADC2_PRESCALE_DIV16 = 0x04,
  ADC2_PRESCALE_DIV32 = 0x05, ADC2_PRESCALE_DIV64 = 0x06, ADC2_PRESCALE_DIV128 = 0x07
}
enum  adc2_ref_type { ADC2_REF_AREF = 0, ADC2_REF_AVCC = 1 << 6, ADC2_REF_INTERNAL_256 = 3 << 6 }

Functions

u_short adc2_init (adc2_mode_t mode, adc2_interrupt_t use_interrupt, adc2_prescaler_t prescaler, adc2_channel_t channel, adc2_ref_t reference)
u_short adc2_read (u_short handle)


Enumeration Type Documentation

enum adc2_prescaler_type

Enumerator:
ADC2_PRESCALE_DIV2  0x01,0x00 -> CPU clk/2
ADC2_PRESCALE_DIV4  0x02 -> CPU clk/4
ADC2_PRESCALE_DIV8  0x03 -> CPU clk/8
ADC2_PRESCALE_DIV16  0x04 -> CPU clk/16
ADC2_PRESCALE_DIV32  0x05 -> CPU clk/32
ADC2_PRESCALE_DIV64  0x06 -> CPU clk/64
ADC2_PRESCALE_DIV128  0x07 -> CPU clk/128


Function Documentation

u_short adc2_init ( adc2_mode_t  mode,
adc2_interrupt_t  use_interrupt,
adc2_prescaler_t  prescaler,
adc2_channel_t  channel,
adc2_ref_t  reference 
)

Initializes the ADC.

Note:
The returned handle has to be kept in order to be used by adc2_read().
Returns:
a handle

u_short adc2_read ( u_short  handle  ) 

Samples a value.

Note:
the handle assures that the adc is properly configure. this allows to access the adc concurrently with different configurations.
Parameters:
the handle retrieved by adc2_init
Returns:
a handle


Generated on Wed Apr 29 11:12:29 2009 for BTnut System Software by doxygen 1.5.1