simulavr
1.1.0
|
Extends BasicTimerUnit to provide common support to all types of 16Bit timer units. More...
#include <hwtimer.h>
Public Member Functions | |
HWTimer16 (AvrDevice *core, PrescalerMultiplexer *p, int unit, IRQLine *tov, IRQLine *tcompA, const PinAtPort &outA, IRQLine *tcompB, const PinAtPort &outB, IRQLine *tcompC, const PinAtPort &outC, IRQLine *ticap, ICaptureSource *icapsrc) | |
void | Reset (void) |
Perform a reset of this unit. More... | |
![]() | |
BasicTimerUnit (AvrDevice *core, PrescalerMultiplexer *p, int unit, IRQLine *tov, IRQLine *tcap, ICaptureSource *icapsrc, int countersize=8) | |
Create a basic Timer/Counter unit. More... | |
~BasicTimerUnit () | |
virtual unsigned int | CpuCycle () |
Process timer/counter unit operations by CPU cycle. More... | |
void | RegisterACompForICapture (HWAcomp *acomp) |
register analog comparator unit for input capture source More... | |
void | SetACIC (bool acic) |
reflect ACIC flag to input capture source More... | |
void | SetTimerEventListener (TimerEventListener *listener) |
Set event listener. More... | |
![]() | |
Hardware (AvrDevice *core) | |
virtual | ~Hardware () |
virtual void | ClearIrqFlag (unsigned int vector) |
virtual bool | IsLevelInterrupt (unsigned int vector) |
virtual bool | LevelInterruptPending (unsigned int vector) |
![]() | |
TraceValueRegister (TraceValueRegister *parent, const std::string &name) | |
Create a TraceValueRegister, with a scope prefix built on parent scope + name. More... | |
TraceValueRegister () | |
Create a TraceValueRegister, with a empty scope name, single device application. More... | |
virtual | ~TraceValueRegister () |
const std::string | GetTraceValuePrefix (void) |
Returns the scope prefix. More... | |
const std::string | GetScopeName (void) |
Returns the scope name. More... | |
void | RegisterTraceValue (TraceValue *t) |
Registers a TraceValue for this register. More... | |
void | UnregisterTraceValue (TraceValue *t) |
Unregisters a TraceValue, remove it from register. More... | |
TraceValueRegister * | GetScopeGroupByName (const std::string &name) |
Get a here registered TraceValueRegister by it's name. More... | |
virtual TraceValue * | GetTraceValueByName (const std::string &name) |
Get a here registered TraceValue by it's name. More... | |
TraceValueRegister * | FindScopeGroupByName (const std::string &name) |
Seek for a TraceValueRegister by it's name. More... | |
TraceValue * | FindTraceValueByName (const std::string &name) |
Seek for a TraceValue by it's name. More... | |
TraceSet * | GetAllTraceValues (void) |
Get all here registered TraceValue's only (not with descending values) More... | |
TraceSet * | GetAllTraceValuesRecursive (void) |
Get all here registered TraceValue's with descending values. More... | |
Public Attributes | |
IOReg< HWTimer16 > | tcnt_h_reg |
counter register, high byte More... | |
IOReg< HWTimer16 > | tcnt_l_reg |
counter register, low byte More... | |
IOReg< HWTimer16 > | ocra_h_reg |
output compare A register, high byte More... | |
IOReg< HWTimer16 > | ocra_l_reg |
output compare A register, low byte More... | |
IOReg< HWTimer16 > | ocrb_h_reg |
output compare B register, high byte More... | |
IOReg< HWTimer16 > | ocrb_l_reg |
output compare B register, low byte More... | |
IOReg< HWTimer16 > | ocrc_h_reg |
output compare C register, high byte More... | |
IOReg< HWTimer16 > | ocrc_l_reg |
output compare C register, low byte More... | |
IOReg< HWTimer16 > | icr_h_reg |
input capture register, high byte More... | |
IOReg< HWTimer16 > | icr_l_reg |
input capture register, low byte More... | |
Protected Member Functions | |
void | SetCompareRegister (int idx, bool high, unsigned char val) |
Setter method for compare register. More... | |
unsigned char | GetCompareRegister (int idx, bool high) |
Getter method for compare register. More... | |
void | SetComplexRegister (bool is_icr, bool high, unsigned char val) |
Setter method for TCNT and ICR register. More... | |
unsigned char | GetComplexRegister (bool is_icr, bool high) |
Getter method for TCNT and ICR register. More... | |
void | ChangeWGM (WGMtype mode) |
Change WGM mode, set counter limits. More... | |
void | Set_TCNTH (unsigned char val) |
Register access to set counter register high byte. More... | |
unsigned char | Get_TCNTH () |
Register access to read counter register high byte. More... | |
void | Set_TCNTL (unsigned char val) |
Register access to set counter register low byte. More... | |
unsigned char | Get_TCNTL () |
Register access to read counter register low byte. More... | |
void | Set_OCRAH (unsigned char val) |
Register access to set output compare register A high byte. More... | |
unsigned char | Get_OCRAH () |
Register access to read output compare register A high byte. More... | |
void | Set_OCRAL (unsigned char val) |
Register access to set output compare register A low byte. More... | |
unsigned char | Get_OCRAL () |
Register access to read output compare register A low byte. More... | |
void | Set_OCRBH (unsigned char val) |
Register access to set output compare register B high byte. More... | |
unsigned char | Get_OCRBH () |
Register access to read output compare register B high byte. More... | |
void | Set_OCRBL (unsigned char val) |
Register access to set output compare register B low byte. More... | |
unsigned char | Get_OCRBL () |
Register access to read output compare register B low byte. More... | |
void | Set_OCRCH (unsigned char val) |
Register access to set output compare register C high byte. More... | |
unsigned char | Get_OCRCH () |
Register access to read output compare register C high byte. More... | |
void | Set_OCRCL (unsigned char val) |
Register access to set output compare register C low byte. More... | |
unsigned char | Get_OCRCL () |
Register access to read output compare register C low byte. More... | |
void | Set_ICRH (unsigned char val) |
Register access to set input capture register high byte. More... | |
unsigned char | Get_ICRH () |
Register access to read input capture register high byte. More... | |
void | Set_ICRL (unsigned char val) |
Register access to set input capture register low byte. More... | |
unsigned char | Get_ICRL () |
Register access to read input capture register low byte. More... | |
![]() | |
void | CountTimer (void) |
Supports the count operation, emits count events to HandleEvent method. More... | |
virtual void | InputCapture (void) |
Supports the input capture function. More... | |
void | HandleEvent (CEtype event) |
Receives count events. More... | |
void | SetClockMode (int _cs) |
Set clock mode. More... | |
void | SetCounter (unsigned long val) |
Set the counter itself. More... | |
void | SetCompareOutputMode (int idx, COMtype mode) |
Set compare output mode. More... | |
void | SetCompareOutput (int idx) |
Set compare output pins in non pwm mode. More... | |
void | SetPWMCompareOutput (int idx, bool topOrDown) |
Set compare output pins in pwm mode. More... | |
bool | WGMisPWM (void) |
returns true, if WGM is in one of the PWM modes More... | |
bool | WGMuseICR (void) |
returns true, if WGM uses IC register for defining TOP counter value More... | |
void | WGMFunc_noop (CEtype event) |
WGM noop function. More... | |
void | WGMfunc_normal (CEtype event) |
WGM function for normal mode (unique for all different timers) More... | |
void | WGMfunc_ctc (CEtype event) |
WGM function for ctc mode (unique for all different timers) More... | |
void | WGMfunc_fastpwm (CEtype event) |
WGM function for fast pwm mode (unique for all different timers) More... | |
void | WGMfunc_pcpwm (CEtype event) |
WGM function for phase correct pwm mode (unique for all different timers) More... | |
void | WGMfunc_pfcpwm (CEtype event) |
WGM function for phase and frequency correct pwm mode (unique for all different timers) More... | |
![]() | |
virtual size_t | _tvr_getValuesCount (void) |
Get the count of all TraceValues, that are registered here and descending. More... | |
virtual void | _tvr_insertTraceValuesToSet (TraceSet &t) |
Insert all TraceValues into TraceSet, that registered here and descending. More... | |
Protected Attributes | |
unsigned char | accessTempRegister |
the high byte temporary register for read/write access to TCNT and ICR More... | |
![]() | |
AvrDevice * | core |
pointer to device core More... | |
PrescalerMultiplexer * | premx |
prescaler multiplexer More... | |
IRQLine * | timerOverflow |
irq line for overflow interrupt More... | |
IRQLine * | timerCapture |
irq line for capture interrupt More... | |
unsigned long | vtcnt |
THE timercounter. More... | |
unsigned long | vlast_tcnt |
timercounter BEFORE count operation More... | |
int | updown_counting |
count direction control flag, true, if up/down counting More... | |
bool | count_down |
counter counts down, used for precise pwm modes More... | |
unsigned long | limit_bottom |
BOTTOM value for up/down counting. More... | |
unsigned long | limit_top |
TOP value for counting. More... | |
unsigned long | limit_max |
MAX value for counting. More... | |
unsigned long | icapRegister |
Input capture register. More... | |
ICaptureSource * | icapSource |
Input capture source. More... | |
bool | icapRisingEdge |
Input capture on rising edge. More... | |
bool | icapNoiseCanceler |
Noise canceler for input capturing enabled. More... | |
WGMtype | wgm |
waveform generation mode More... | |
wgmfunc_t | wgmfunc [WGM_tablesize] |
waveform generator mode function table More... | |
unsigned long | compare [OCRIDX_maxUnits] |
compare values for output compare events More... | |
unsigned long | compare_dbl [OCRIDX_maxUnits] |
double buffer values for compare values More... | |
bool | compareEnable [OCRIDX_maxUnits] |
enables compare operation More... | |
COMtype | com [OCRIDX_maxUnits] |
compare match output mode More... | |
IRQLine * | timerCompare [OCRIDX_maxUnits] |
irq line for compare interrupt More... | |
PinAtPort | compare_output [OCRIDX_maxUnits] |
output pins for compare units More... | |
bool | compare_output_state [OCRIDX_maxUnits] |
status compare output pin More... | |
Additional Inherited Members | |
![]() | |
enum | CEtype { EVT_TOP_REACHED = 0, EVT_MAX_REACHED, EVT_BOTTOM_REACHED, EVT_COMPARE_1, EVT_COMPARE_2, EVT_COMPARE_3 } |
event types for timer/counter More... | |
![]() | |
enum | WGMtype { WGM_NORMAL = 0, WGM_PCPWM_8BIT, WGM_PCPWM_9BIT, WGM_PCPWM_10BIT, WGM_CTC_OCRA, WGM_FASTPWM_8BIT, WGM_FASTPWM_9BIT, WGM_FASTPWM_10BIT, WGM_PFCPWM_ICR, WGM_PFCPWM_OCRA, WGM_PCPWM_ICR, WGM_PCPWM_OCRA, WGM_CTC_ICR, WGM_RESERVED, WGM_FASTPWM_ICR, WGM_FASTPWM_OCRA, WGM_tablesize } |
types of waveform generation modes More... | |
enum | COMtype { COM_NOOP = 0, COM_TOGGLE, COM_CLEAR, COM_SET } |
types of compare match output modes More... | |
enum | OCRIDXtype { OCRIDX_A = 0, OCRIDX_B, OCRIDX_C, OCRIDX_maxUnits } |
indices for OC units More... | |
typedef void(BasicTimerUnit::* | wgmfunc_t) (CEtype) |
Extends BasicTimerUnit to provide common support to all types of 16Bit timer units.
HWTimer16::HWTimer16 | ( | AvrDevice * | core, |
PrescalerMultiplexer * | p, | ||
int | unit, | ||
IRQLine * | tov, | ||
IRQLine * | tcompA, | ||
const PinAtPort & | outA, | ||
IRQLine * | tcompB, | ||
const PinAtPort & | outB, | ||
IRQLine * | tcompC, | ||
const PinAtPort & | outC, | ||
IRQLine * | ticap, | ||
ICaptureSource * | icapsrc | ||
) |
Definition at line 683 of file hwtimer.cpp.
References BasicTimerUnit::compare_output, BasicTimerUnit::compareEnable, ocra_h_reg, ocra_l_reg, ocrb_h_reg, ocrb_l_reg, ocrc_h_reg, ocrc_l_reg, IOReg< P >::releaseTraceValue(), Reset(), BasicTimerUnit::timerCompare, BasicTimerUnit::WGM_CTC_ICR, BasicTimerUnit::WGM_CTC_OCRA, BasicTimerUnit::WGM_FASTPWM_10BIT, BasicTimerUnit::WGM_FASTPWM_8BIT, BasicTimerUnit::WGM_FASTPWM_9BIT, BasicTimerUnit::WGM_FASTPWM_ICR, BasicTimerUnit::WGM_FASTPWM_OCRA, BasicTimerUnit::WGM_NORMAL, BasicTimerUnit::WGM_PCPWM_10BIT, BasicTimerUnit::WGM_PCPWM_8BIT, BasicTimerUnit::WGM_PCPWM_9BIT, BasicTimerUnit::WGM_PCPWM_ICR, BasicTimerUnit::WGM_PCPWM_OCRA, BasicTimerUnit::WGM_PFCPWM_ICR, BasicTimerUnit::WGM_PFCPWM_OCRA, BasicTimerUnit::wgmfunc, BasicTimerUnit::WGMfunc_ctc(), BasicTimerUnit::WGMfunc_fastpwm(), BasicTimerUnit::WGMfunc_normal(), BasicTimerUnit::WGMfunc_pcpwm(), and BasicTimerUnit::WGMfunc_pfcpwm().
|
protected |
Change WGM mode, set counter limits.
Definition at line 834 of file hwtimer.cpp.
References BasicTimerUnit::compare, BasicTimerUnit::count_down, BasicTimerUnit::icapRegister, BasicTimerUnit::limit_max, BasicTimerUnit::limit_top, BasicTimerUnit::updown_counting, BasicTimerUnit::wgm, BasicTimerUnit::WGM_CTC_ICR, BasicTimerUnit::WGM_CTC_OCRA, BasicTimerUnit::WGM_FASTPWM_10BIT, BasicTimerUnit::WGM_FASTPWM_8BIT, BasicTimerUnit::WGM_FASTPWM_9BIT, BasicTimerUnit::WGM_FASTPWM_ICR, BasicTimerUnit::WGM_FASTPWM_OCRA, BasicTimerUnit::WGM_NORMAL, BasicTimerUnit::WGM_PCPWM_10BIT, BasicTimerUnit::WGM_PCPWM_8BIT, BasicTimerUnit::WGM_PCPWM_9BIT, BasicTimerUnit::WGM_PCPWM_ICR, BasicTimerUnit::WGM_PCPWM_OCRA, BasicTimerUnit::WGM_PFCPWM_ICR, BasicTimerUnit::WGM_PFCPWM_OCRA, BasicTimerUnit::WGM_RESERVED, and BasicTimerUnit::WGM_tablesize.
Referenced by HWTimer16_2C3::Set_TCCRA(), HWTimer16_3C::Set_TCCRA(), HWTimer16_2C3::Set_TCCRB(), HWTimer16_3C::Set_TCCRB(), HWTimer16_1C::Set_WGM(), and HWTimer16_2C2::Set_WGM().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
Getter method for compare register.
Definition at line 789 of file hwtimer.cpp.
References BasicTimerUnit::compare, BasicTimerUnit::compare_dbl, and BasicTimerUnit::WGMisPWM().
|
protected |
Getter method for TCNT and ICR register.
Definition at line 820 of file hwtimer.cpp.
References accessTempRegister, BasicTimerUnit::icapRegister, and BasicTimerUnit::vtcnt.
|
virtual |
Perform a reset of this unit.
Reimplemented from BasicTimerUnit.
Reimplemented in HWTimer16_3C, HWTimer16_2C3, HWTimer16_2C2, and HWTimer16_1C.
Definition at line 764 of file hwtimer.cpp.
References accessTempRegister, and BasicTimerUnit::Reset().
Referenced by HWTimer16(), HWTimer16_1C::Reset(), HWTimer16_2C2::Reset(), HWTimer16_2C3::Reset(), and HWTimer16_3C::Reset().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
Setter method for compare register.
Definition at line 770 of file hwtimer.cpp.
References accessTempRegister, BasicTimerUnit::compare, BasicTimerUnit::compare_dbl, BasicTimerUnit::limit_top, BasicTimerUnit::wgm, BasicTimerUnit::WGM_CTC_OCRA, and BasicTimerUnit::WGMisPWM().
|
protected |
Setter method for TCNT and ICR register.
Definition at line 801 of file hwtimer.cpp.
References accessTempRegister, avr_warning, BasicTimerUnit::icapRegister, BasicTimerUnit::limit_top, BasicTimerUnit::SetCounter(), BasicTimerUnit::wgm, BasicTimerUnit::WGM_FASTPWM_ICR, and BasicTimerUnit::WGMuseICR().
|
protected |
the high byte temporary register for read/write access to TCNT and ICR
Definition at line 250 of file hwtimer.h.
Referenced by GetComplexRegister(), Reset(), SetCompareRegister(), and SetComplexRegister().
input capture register, high byte
Definition at line 318 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), and AvrDevice_attiny2313::AvrDevice_attiny2313().
input capture register, low byte
Definition at line 319 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), and AvrDevice_attiny2313::AvrDevice_attiny2313().
output compare A register, high byte
Definition at line 312 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and HWTimer16().
output compare A register, low byte
Definition at line 313 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and HWTimer16().
output compare B register, high byte
Definition at line 314 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and HWTimer16().
output compare B register, low byte
Definition at line 315 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and HWTimer16().
output compare C register, high byte
Definition at line 316 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), and HWTimer16().
output compare C register, low byte
Definition at line 317 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), and HWTimer16().
counter register, high byte
Definition at line 310 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), and AvrDevice_attiny2313::AvrDevice_attiny2313().
counter register, low byte
Definition at line 311 of file hwtimer.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), and AvrDevice_attiny2313::AvrDevice_attiny2313().