simulavr  1.1.0
HWPrescalerAsync Class Reference

Extends HWPrescaler with a external clock oszillator pin. More...

#include <timerprescaler.h>

Inheritance diagram for HWPrescalerAsync:

Public Member Functions

 HWPrescalerAsync (AvrDevice *core, const std::string &tracename, PinAtPort tosc_pin, IOSpecialReg *asyreg, int clockSelBit, IOSpecialReg *resreg, int resetBit)
 Creates HWPrescalerAsync instance with reset but without sync reset feature. More...
 
 HWPrescalerAsync (AvrDevice *core, const std::string &tracename, PinAtPort tosc_pin, IOSpecialReg *asyreg, int clockSelBit, IOSpecialReg *resreg, int resetBit, int resetSyncBit)
 Creates HWPrescalerAsync instance with reset and sync reset feature. More...
 
virtual unsigned int CpuCycle ()
 Count functionality for prescaler. More...
 
- Public Member Functions inherited from HWPrescaler
 HWPrescaler (AvrDevice *core, const std::string &tracename)
 Creates HWPrescaler instance without reset feature. More...
 
 HWPrescaler (AvrDevice *core, const std::string &tracename, IOSpecialReg *ioreg, int resetBit)
 Creates HWPrescaler instance with reset but without sync reset feature. More...
 
 HWPrescaler (AvrDevice *core, const std::string &tracename, IOSpecialReg *ioreg, int resetBit, int resetSyncBit)
 Creates HWPrescaler instance with reset and sync reset feature. More...
 
unsigned short GetValue ()
 Get method for current prescaler counter value. More...
 
void Reset ()
 Reset method, sets prescaler counter to 0. More...
 
- Public Member Functions inherited from Hardware
 Hardware (AvrDevice *core)
 
virtual ~Hardware ()
 
virtual void ClearIrqFlag (unsigned int vector)
 
virtual bool IsLevelInterrupt (unsigned int vector)
 
virtual bool LevelInterruptPending (unsigned int vector)
 
- Public Member Functions inherited from IOSpecialRegClient
virtual ~IOSpecialRegClient ()
 

Protected Member Functions

unsigned char set_from_reg (const IOSpecialReg *reg, unsigned char nv)
 IO register interface set method, see IOSpecialRegClient. More...
 
- Protected Member Functions inherited from HWPrescaler
unsigned char get_from_client (const IOSpecialReg *reg, unsigned char v)
 IO register interface get method, see IOSpecialRegClient. More...
 

Private Attributes

IOSpecialRegasyncRegister
 instance of IO register with assr bits More...
 
PinAtPort tosc_pin
 input pin for external timer oscillator More...
 
bool pinstate
 saved pin status of osc. pin More...
 
bool clockselect
 holds the clock select state, true is external clock More...
 
int clockSelectBit
 holds bit position of counter clock select More...
 

Additional Inherited Members

- Protected Attributes inherited from HWPrescaler
IOSpecialRegresetRegister
 instance of IO register with reset bits More...
 
unsigned short preScaleValue
 prescaler counter value More...
 
bool countEnable
 

Detailed Description

Extends HWPrescaler with a external clock oszillator pin.

Todo:
check external clock input and that TOSC1 and TOSC2 get back 0 if core read port input

Definition at line 83 of file timerprescaler.h.

Constructor & Destructor Documentation

◆ HWPrescalerAsync() [1/2]

HWPrescalerAsync::HWPrescalerAsync ( AvrDevice core,
const std::string &  tracename,
PinAtPort  tosc_pin,
IOSpecialReg asyreg,
int  clockSelBit,
IOSpecialReg resreg,
int  resetBit 
)

Creates HWPrescalerAsync instance with reset but without sync reset feature.

Definition at line 93 of file timerprescaler.cpp.

References asyncRegister, clockselect, IOSpecialReg::connectSRegClient(), PinAtPort::GetPin(), pinstate, and tosc_pin.

◆ HWPrescalerAsync() [2/2]

HWPrescalerAsync::HWPrescalerAsync ( AvrDevice core,
const std::string &  tracename,
PinAtPort  tosc_pin,
IOSpecialReg asyreg,
int  clockSelBit,
IOSpecialReg resreg,
int  resetBit,
int  resetSyncBit 
)

Creates HWPrescalerAsync instance with reset and sync reset feature.

Definition at line 110 of file timerprescaler.cpp.

References asyncRegister, clockselect, IOSpecialReg::connectSRegClient(), PinAtPort::GetPin(), pinstate, and tosc_pin.

Member Function Documentation

◆ CpuCycle()

unsigned int HWPrescalerAsync::CpuCycle ( void  )
virtual

Count functionality for prescaler.

Reimplemented from HWPrescaler.

Definition at line 128 of file timerprescaler.cpp.

References clockselect, HWPrescaler::countEnable, PinAtPort::GetPin(), pinstate, HWPrescaler::preScaleValue, and tosc_pin.

◆ set_from_reg()

unsigned char HWPrescalerAsync::set_from_reg ( const IOSpecialReg reg,
unsigned char  nv 
)
protectedvirtual

IO register interface set method, see IOSpecialRegClient.

Reimplemented from HWPrescaler.

Definition at line 142 of file timerprescaler.cpp.

References asyncRegister, clockselect, clockSelectBit, and HWPrescaler::set_from_reg().

Member Data Documentation

◆ asyncRegister

IOSpecialReg* HWPrescalerAsync::asyncRegister
private

instance of IO register with assr bits

Definition at line 111 of file timerprescaler.h.

Referenced by HWPrescalerAsync(), and set_from_reg().

◆ clockselect

bool HWPrescalerAsync::clockselect
private

holds the clock select state, true is external clock

Definition at line 114 of file timerprescaler.h.

Referenced by CpuCycle(), HWPrescalerAsync(), and set_from_reg().

◆ clockSelectBit

int HWPrescalerAsync::clockSelectBit
private

holds bit position of counter clock select

Definition at line 115 of file timerprescaler.h.

Referenced by set_from_reg().

◆ pinstate

bool HWPrescalerAsync::pinstate
private

saved pin status of osc. pin

Definition at line 113 of file timerprescaler.h.

Referenced by CpuCycle(), and HWPrescalerAsync().

◆ tosc_pin

PinAtPort HWPrescalerAsync::tosc_pin
private

input pin for external timer oscillator

Definition at line 112 of file timerprescaler.h.

Referenced by CpuCycle(), and HWPrescalerAsync().


The documentation for this class was generated from the following files: