|
simulavr
1.1.0
|
Timer unit with 8Bit counter and 2 output compare unit. More...
#include <hwtimer.h>
Public Member Functions | |
| HWTimer8_2C (AvrDevice *core, PrescalerMultiplexer *p, int unit, IRQLine *tov, IRQLine *tcompA, const PinAtPort &outA, IRQLine *tcompB, const PinAtPort &outB) | |
| void | Reset (void) |
| Perform a reset of this unit. More... | |
Public Member Functions inherited from HWTimer8 | |
| HWTimer8 (AvrDevice *core, PrescalerMultiplexer *p, int unit, IRQLine *tov, IRQLine *tcompA, const PinAtPort &outA, IRQLine *tcompB, const PinAtPort &outB) | |
Public Member Functions inherited from BasicTimerUnit | |
| 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... | |
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 TraceValueRegister | |
| 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< HWTimer8_2C > | tccra_reg |
| control register A More... | |
| IOReg< HWTimer8_2C > | tccrb_reg |
| control register B More... | |
Public Attributes inherited from HWTimer8 | |
| IOReg< HWTimer8 > | tcnt_reg |
| counter register More... | |
| IOReg< HWTimer8 > | ocra_reg |
| output compare A register More... | |
| IOReg< HWTimer8 > | ocrb_reg |
| output compare B register More... | |
Protected Member Functions | |
| void | Set_TCCRA (unsigned char val) |
| Register access to set control register. More... | |
| unsigned char | Get_TCCRA () |
| Register access to read control register. More... | |
| void | Set_TCCRB (unsigned char val) |
| Register access to set control register. More... | |
| unsigned char | Get_TCCRB () |
| Register access to read control register. More... | |
Protected Member Functions inherited from HWTimer8 | |
| void | ChangeWGM (WGMtype mode) |
| Change WGM mode, set counter limits. More... | |
| void | SetCompareRegister (int idx, unsigned char val) |
| Setter method for compare register. More... | |
| unsigned char | GetCompareRegister (int idx) |
| Getter method for compare register. More... | |
| void | Set_TCNT (unsigned char val) |
| Register access to set counter register high byte. More... | |
| unsigned char | Get_TCNT () |
| Register access to read counter register high byte. More... | |
| void | Set_OCRA (unsigned char val) |
| Register access to set output compare register A. More... | |
| unsigned char | Get_OCRA () |
| Register access to read output compare register A. More... | |
| void | Set_OCRB (unsigned char val) |
| Register access to set output compare register B. More... | |
| unsigned char | Get_OCRB () |
| Register access to read output compare register B. More... | |
Protected Member Functions inherited from BasicTimerUnit | |
| 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... | |
Protected Member Functions inherited from TraceValueRegister | |
| 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 | tccra_val |
| register value TCCRA More... | |
| unsigned char | tccrb_val |
| register value TCCRB More... | |
Protected Attributes inherited from BasicTimerUnit | |
| 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... | |
Private Member Functions | |
| void | Set_WGM (int val) |
| Handle special WGM setting, translate wgm raw value to wgm value. More... | |
Private Attributes | |
| int | wgm_raw |
| this is the wgm raw value from register More... | |
Additional Inherited Members | |
Public Types inherited from BasicTimerUnit | |
| 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... | |
Protected Types inherited from BasicTimerUnit | |
| 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) |
Timer unit with 8Bit counter and 2 output compare unit.
This timer unit is used by following devices: ATMega48/88/168/328.
TCCRxA register contains the following configuration bits (x=#timer):
+------+------+------+------+---+---+-----+-----+ |COMxA1|COMxA0|COMxB1|COMxB0| - | - |WGMx1|WGMx0| +------+------+------+------+---+---+-----+-----+
TCCRxB register contains the following configuration bits (x=#timer):
+-----+-----+---+---+-----+----+----+----+ |FOCxA|FOCxB| - | - |WGMx2|CSx2|CSx1|CSx0| +-----+-----+---+---+-----+----+----+----+
| HWTimer8_2C::HWTimer8_2C | ( | AvrDevice * | core, |
| PrescalerMultiplexer * | p, | ||
| int | unit, | ||
| IRQLine * | tov, | ||
| IRQLine * | tcompA, | ||
| const PinAtPort & | outA, | ||
| IRQLine * | tcompB, | ||
| const PinAtPort & | outB | ||
| ) |
Definition at line 971 of file hwtimer.cpp.
|
inlineprotected |
|
inlineprotected |
|
virtual |
Perform a reset of this unit.
Reimplemented from HWTimer8.
Definition at line 1034 of file hwtimer.cpp.
References HWTimer8::Reset(), tccra_val, tccrb_val, and wgm_raw.
|
protected |
Register access to set control register.
Definition at line 1005 of file hwtimer.cpp.
References Set_WGM(), BasicTimerUnit::SetCompareOutputMode(), tccra_val, and wgm_raw.
|
protected |
Register access to set control register.
Definition at line 1016 of file hwtimer.cpp.
References Set_WGM(), BasicTimerUnit::SetClockMode(), BasicTimerUnit::SetCompareOutput(), tccrb_val, wgm_raw, and BasicTimerUnit::WGMisPWM().
|
private |
Handle special WGM setting, translate wgm raw value to wgm value.
Definition at line 985 of file hwtimer.cpp.
References HWTimer8::ChangeWGM(), BasicTimerUnit::WGM_CTC_OCRA, BasicTimerUnit::WGM_FASTPWM_8BIT, BasicTimerUnit::WGM_FASTPWM_OCRA, BasicTimerUnit::WGM_NORMAL, BasicTimerUnit::WGM_PCPWM_8BIT, BasicTimerUnit::WGM_PCPWM_OCRA, wgm_raw, and BasicTimerUnit::WGM_RESERVED.
Referenced by Set_TCCRA(), and Set_TCCRB().
| IOReg<HWTimer8_2C> HWTimer8_2C::tccra_reg |
control register A
Definition at line 439 of file hwtimer.h.
Referenced by AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
|
protected |
register value TCCRA
Definition at line 425 of file hwtimer.h.
Referenced by Reset(), and Set_TCCRA().
| IOReg<HWTimer8_2C> HWTimer8_2C::tccrb_reg |
control register B
Definition at line 440 of file hwtimer.h.
Referenced by AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
|
protected |
register value TCCRB
Definition at line 426 of file hwtimer.h.
Referenced by Reset(), and Set_TCCRB().
|
private |
this is the wgm raw value from register
Definition at line 419 of file hwtimer.h.
Referenced by Reset(), Set_TCCRA(), Set_TCCRB(), and Set_WGM().