HWAd Class Reference

#include <hwad.h>

Inheritance diagram for HWAd:
Inheritance graph
[legend]
Collaboration diagram for HWAd:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HWAd (AvrDevice *core, HWAdmux *m, HWIrqSystem *, Pin &aref, unsigned int irqVec)
unsigned int CpuCycle ()
unsigned char GetAdch ()
unsigned char GetAdcl ()
unsigned char GetAdcsr ()
void Reset ()
void SetAdcsr (unsigned char)
void ClearIrqFlag (unsigned int vec)

Public Attributes

IOReg< HWAdadch_reg
IOReg< HWAdadcl_reg
IOReg< HWAdadcsr_reg

Protected Types

enum  T_State { IDLE, INIT, RUNNING }

Protected Attributes

unsigned char adch
bool adchLocked
unsigned char adcl
int adSample
unsigned char adcsr
AvrDevicecore
HWAdmuxadmux
HWIrqSystemirqSystem
Pinaref
unsigned int irqVec
bool usedBefore
unsigned char prescaler
unsigned char clk
enum HWAd::T_State state

Detailed Description

Analog-digital converter (ADC)

Definition at line 64 of file hwad.h.


Member Enumeration Documentation

enum HWAd::T_State [protected]
Enumerator:
IDLE 
INIT 
RUNNING 

Definition at line 81 of file hwad.h.


Constructor & Destructor Documentation

HWAd::HWAd ( AvrDevice core,
HWAdmux m,
HWIrqSystem i,
Pin aref,
unsigned int  irqVec 
)

Definition at line 101 of file hwad.cpp.

References AvrDevice::AddToCycleList(), core, HWIrqSystem::DebugVerifyInterruptVector(), irqSystem, irqVec, and Reset().

Here is the call graph for this function:


Member Function Documentation

void HWAd::ClearIrqFlag ( unsigned int  vector  )  [virtual]

This signals the hardware that the given IRQ vector has been handled by the AVR core.

Reimplemented from Hardware.

Definition at line 148 of file hwad.cpp.

References adcsr, ADIF, HWIrqSystem::ClearIrqFlag(), irqSystem, and irqVec.

Here is the call graph for this function:

unsigned int HWAd::CpuCycle ( void   )  [virtual]

Called for each AVR cycle when this hardware has registered itself as a receiver for AVR clocks. Returns nonzero if instructions should not be executed (e.g. a Flash write is in progress).

Reimplemented from Hardware.

Definition at line 156 of file hwad.cpp.

References adch, adchLocked, adcl, adcsr, ADEN, ADFR, ADIE, ADIF, ADLAR, admux, ADPS0, ADPS1, ADPS2, adSample, ADSC, aref, clk, core, HWAdmux::GetAdmux(), Pin::GetAnalog(), HWAdmux::GetMuxOutput(), IDLE, INIT, irqSystem, irqVec, prescaler, RUNNING, HWIrqSystem::SetIrqFlag(), state, AvrDevice::trace_on, traceOut, and usedBefore.

Here is the call graph for this function:

unsigned char HWAd::GetAdch (  ) 

Definition at line 129 of file hwad.cpp.

References adch, and adchLocked.

unsigned char HWAd::GetAdcl (  ) 

Definition at line 130 of file hwad.cpp.

References adchLocked, and adcl.

unsigned char HWAd::GetAdcsr (  ) 

Definition at line 131 of file hwad.cpp.

References adcsr.

void HWAd::Reset ( void   )  [virtual]

Implement the hardware's reset functionality here. The default is no action on reset.

Reimplemented from Hardware.

Definition at line 120 of file hwad.cpp.

References adchLocked, adcsr, clk, IDLE, prescaler, state, and usedBefore.

Referenced by HWAd().

Here is the caller graph for this function:

void HWAd::SetAdcsr ( unsigned char  val  ) 

Definition at line 135 of file hwad.cpp.

References adcsr, ADIE, ADIF, ADSC, HWIrqSystem::ClearIrqFlag(), irqSystem, irqVec, and HWIrqSystem::SetIrqFlag().

Here is the call graph for this function:


Member Data Documentation

unsigned char HWAd::adch [protected]

Definition at line 66 of file hwad.h.

Referenced by CpuCycle(), and GetAdch().

bool HWAd::adchLocked [protected]

Definition at line 67 of file hwad.h.

Referenced by CpuCycle(), GetAdch(), GetAdcl(), and Reset().

unsigned char HWAd::adcl [protected]

Definition at line 68 of file hwad.h.

Referenced by CpuCycle(), and GetAdcl().

unsigned char HWAd::adcsr [protected]

Definition at line 70 of file hwad.h.

Referenced by ClearIrqFlag(), CpuCycle(), GetAdcsr(), Reset(), and SetAdcsr().

HWAdmux* HWAd::admux [protected]

Definition at line 72 of file hwad.h.

Referenced by CpuCycle().

int HWAd::adSample [protected]

Definition at line 69 of file hwad.h.

Referenced by CpuCycle().

Pin& HWAd::aref [protected]

Definition at line 74 of file hwad.h.

Referenced by CpuCycle().

unsigned char HWAd::clk [protected]

Definition at line 79 of file hwad.h.

Referenced by CpuCycle(), and Reset().

AvrDevice* HWAd::core [protected]

Definition at line 71 of file hwad.h.

Referenced by CpuCycle(), and HWAd().

Definition at line 73 of file hwad.h.

Referenced by ClearIrqFlag(), CpuCycle(), HWAd(), and SetAdcsr().

unsigned int HWAd::irqVec [protected]

Definition at line 75 of file hwad.h.

Referenced by ClearIrqFlag(), CpuCycle(), HWAd(), and SetAdcsr().

unsigned char HWAd::prescaler [protected]

Definition at line 78 of file hwad.h.

Referenced by CpuCycle(), and Reset().

enum HWAd::T_State HWAd::state [protected]

Referenced by CpuCycle(), and Reset().

bool HWAd::usedBefore [protected]

Definition at line 77 of file hwad.h.

Referenced by CpuCycle(), and Reset().


The documentation for this class was generated from the following files:
Generated on Sun Feb 12 16:51:29 2012 for Simulavr by  doxygen 1.6.3