AVRCpp::AnalogToDigital Namespace Reference

Analog to digital converter. More...


Classes

struct  ConversionCompleteInterrupt

Typedefs

typedef _ADC Result

Enumerations

enum  Reference {
  AREF = 0x00,
  AVCC = 0x40,
  InternalRef = 0x80 | 0x40
}
enum  Adjustment {
  AlignRight = 0x00,
  AlignLeft = 0x20
}
enum  InterruptEnableFlag {
  InterruptEnable = 0x8,
  InterruptDisable = 0x00
}
enum  EnableFlag {
  ADCEnable = 0x80,
  ADCDisable = 0x00
}
enum  ConversionStart {
  StartNow = 0x40,
  StartLater = 0x00
}
enum  FreeRunning {
  FreeRunMode = 0x20,
  FreeRunStopped = 0x00
}
enum  Prescaler {
  Div2 = 0x01,
  Div4 = 0x02,
  Div8 = 0x03,
  Div16 = 0x04,
  Div32 = 0x05,
  Div64 = 0x06,
  Div128 = 0x07
}
enum  AnalogChannel {
  ADC0 = 0x00,
  ADC1 = 0x01,
  ADC2 = 0x02,
  ADC3 = 0x03,
  ADC4 = 0x04,
  ADC5 = 0x05,
  ADC6 = 0x06,
  ADC7 = 0x07,
  Vbandgap = 0x0E,
  GND = 0x0F
}

Functions

bool IsConverting ()
void WaitWhileConverting ()
void EnsureChangeSafety ()
void SelectionSetUp (Reference reference, Adjustment adjustment, AnalogChannel channel)
void ControlSetUp (EnableFlag enableFlag, ConversionStart conversionStart, FreeRunning freeRunning, InterruptEnableFlag interruptEnableFlag, Prescaler prescaler)
void SetChannel (AnalogChannel channel)
void SelectPrescaler (Prescaler prescaler)
void Enable ()
void Disable ()
bool IsEnabled ()
void StartConversion ()
void EnableFreeRun ()
void DisableFreeRun ()
bool IsFreeRunEnabled ()
void StartFreeRun ()
void StopFreeRun ()


Detailed Description

Analog to digital converter.

Typedef Documentation

typedef _ADC AVRCpp::AnalogToDigital::Result

Definition at line 88 of file ADC.h.


Enumeration Type Documentation

enum AVRCpp::AnalogToDigital::Adjustment

Enumerator:
AlignRight 
AlignLeft 

Definition at line 114 of file ADC.h.

00115                 {
00116                         AlignRight      = 0x00,
00117                         AlignLeft       = _ADLAR
00118                         
00119                 }; // enum Adjustment

enum AVRCpp::AnalogToDigital::AnalogChannel

Enumerator:
ADC0 
ADC1 
ADC2 
ADC3 
ADC4 
ADC5 
ADC6 
ADC7 
Vbandgap 
GND 

Definition at line 189 of file ADC.h.

00190                 {
00191                         ADC0            = 0x00,
00192                         ADC1            = 0x01,
00193                         ADC2            = 0x02,
00194                         ADC3            = 0x03,
00195                         ADC4            = 0x04,
00196                         ADC5            = 0x05,
00197                         ADC6            = 0x06,
00198                         ADC7            = 0x07,
00199                         Vbandgap        = 0x0E,
00200                         GND                     = 0x0F
00201 
00202                 }; // enum AnalogChannel

enum AVRCpp::AnalogToDigital::ConversionStart

Enumerator:
StartNow 
StartLater 

Definition at line 135 of file ADC.h.

00136                 {
00137                         StartNow        = _ADSC,
00138                         StartLater      = 0x00
00139                         
00140                 }; // enum ConversionStart

enum AVRCpp::AnalogToDigital::EnableFlag

Enumerator:
ADCEnable 
ADCDisable 

Definition at line 128 of file ADC.h.

00129                 {
00130                         ADCEnable       = _ADEN,
00131                         ADCDisable      = 0x00
00132                         
00133                 }; // enum EnableFlag

enum AVRCpp::AnalogToDigital::FreeRunning

Enumerator:
FreeRunMode 
FreeRunStopped 

Definition at line 142 of file ADC.h.

00143                 {
00144                         FreeRunMode             = 0x20,
00145                         FreeRunStopped  = 0x00
00146                         
00147                 }; // enum FreeRunning

enum AVRCpp::AnalogToDigital::InterruptEnableFlag

Enumerator:
InterruptEnable 
InterruptDisable 

Definition at line 121 of file ADC.h.

00122                 {
00123                         InterruptEnable = _ADIE,
00124                         InterruptDisable = 0x00
00125                         
00126                 }; // enum InterruptEnableFlag

enum AVRCpp::AnalogToDigital::Prescaler

Enumerator:
Div2 
Div4 
Div8 
Div16 
Div32 
Div64 
Div128 

Definition at line 149 of file ADC.h.

00150                 {
00151                         Div2    = 0x01,
00152                         Div4    = 0x02,
00153                         Div8    = 0x03,
00154                         Div16   = 0x04,
00155                         Div32   = 0x05,
00156                         Div64   = 0x06,
00157                         Div128  = 0x07
00158                         
00159                 }; // enum Prescaler

enum AVRCpp::AnalogToDigital::Reference

Enumerator:
AREF 
AVCC 
InternalRef 

Definition at line 103 of file ADC.h.

00104                 {
00105                         AREF            = 0x00,
00106                         AVCC            = _REFS0,
00107                         InternalRef     = _REFS1 | _REFS0
00108                         
00109                 }; // enum Reference


Function Documentation

void AVRCpp::AnalogToDigital::ControlSetUp ( EnableFlag  enableFlag,
ConversionStart  conversionStart,
FreeRunning  freeRunning,
InterruptEnableFlag  interruptEnableFlag,
Prescaler  prescaler 
) [inline]

Definition at line 248 of file ADC.h.

00254                 {
00255                         ADCSRA = enableFlag
00256                                         | conversionStart
00257                                         | freeRunning
00258                                         | interruptEnableFlag
00259                                         | prescaler;
00260                         
00261                 } // ControlSetUp

void AVRCpp::AnalogToDigital::Disable (  )  [inline]

Definition at line 280 of file ADC.h.

00280 { ClearBits<_ADCSRA>(_ADEN); }

void AVRCpp::AnalogToDigital::DisableFreeRun (  )  [inline]

Definition at line 330 of file ADC.h.

00330 { ClearBits<_ADCSRA>(_ADFR); }

void AVRCpp::AnalogToDigital::Enable (  )  [inline]

Definition at line 279 of file ADC.h.

00279 { SetBits<_ADCSRA>(_ADEN); }

void AVRCpp::AnalogToDigital::EnableFreeRun (  )  [inline]

Definition at line 329 of file ADC.h.

00329 { SetBits<_ADCSRA>(_ADFR); }

void AVRCpp::AnalogToDigital::EnsureChangeSafety (  )  [inline]

Definition at line 229 of file ADC.h.

00230                 {
00231                         if (IsConverting() )
00232                                 Assembler::NOP();
00233                         
00234                 } // EnsureChangeSafety

bool AVRCpp::AnalogToDigital::IsConverting (  )  [inline]

Definition at line 226 of file ADC.h.

00226 { return IsBitsSet<_ADCSRA>(_ADSC); }

bool AVRCpp::AnalogToDigital::IsEnabled (  )  [inline]

Definition at line 281 of file ADC.h.

00281 { return IsBitsSet<_ADCSRA>(_ADEN); }

bool AVRCpp::AnalogToDigital::IsFreeRunEnabled (  )  [inline]

Definition at line 331 of file ADC.h.

00331 { return IsBitsSet<_ADCSRA>(_ADFR); }

void AVRCpp::AnalogToDigital::SelectionSetUp ( Reference  reference,
Adjustment  adjustment,
AnalogChannel  channel 
) [inline]

Definition at line 237 of file ADC.h.

00241                 {
00242                         EnsureChangeSafety();
00243                         ADMUX = reference | adjustment | channel;
00244                         
00245                 } // SelectionSetUp

void AVRCpp::AnalogToDigital::SelectPrescaler ( Prescaler  prescaler  )  [inline]

Definition at line 272 of file ADC.h.

00273                 {
00274                         ChangeBits<_ADCSRA>(_ADPS0 | _ADPS1 | _ADPS2, prescaler);
00275                         
00276                 } // SelectPrescaler

void AVRCpp::AnalogToDigital::SetChannel ( AnalogChannel  channel  )  [inline]

Definition at line 264 of file ADC.h.

00265                 {
00266                         EnsureChangeSafety();
00267                         ChangeBits<_ADMUX>(_MUX0 | _MUX1 | _MUX2 | _MUX3, channel);
00268                         
00269                 } // SetChannel

void AVRCpp::AnalogToDigital::StartConversion (  )  [inline]

Definition at line 283 of file ADC.h.

00283 { SetBits<_ADCSRA>(_ADSC); }            

void AVRCpp::AnalogToDigital::StartFreeRun (  )  [inline]

Definition at line 333 of file ADC.h.

00333 { SetBits<_ADCSRA>(_ADSC | _ADFR); }

void AVRCpp::AnalogToDigital::StopFreeRun (  )  [inline]

Definition at line 334 of file ADC.h.

00334 { DisableFreeRun(); }

void AVRCpp::AnalogToDigital::WaitWhileConverting (  )  [inline]

Definition at line 227 of file ADC.h.

00227 { while (IsConverting() ); }


Generated on Sat Sep 15 23:41:31 2007 for AVR C++ Lib for ATmega8 by  doxygen 1.5.2
SourceForge.net Logo MTÜ TTÜ Robotiklubi