Class ArchAVR_Timer
Defined in File arch_avr_timer.h
Nested Relationships
Nested Types
Inheritance Relationships
Base Types
public Peripheral(Class Peripheral)public SignalHook(Class SignalHook)
Class Documentation
-
class ArchAVR_Timer : public Peripheral, public SignalHook
Timer/Counter model for AVR series.
Implementation of a 8bits/16bits Timer/Counter for AVR series
This timer is a flexible implementation aiming at covering most modes found in AVR timer/counter. It covers normal, CTC, PWM in both single and dual slopes. The behaviour is defined by a mode_config_t structure selected by the mode field. It has a number of Output Compare channels, each defined by a OC_config_t structure. Each OC channel behaviour is defined by a set of Compare Output Mode (COM) values.
Unsupported features:
Asynchronous operations
Public Types
-
enum SignalId
Values:
-
enumerator Signal_OVF
Raised on a overflow event, no data is carried.
-
enumerator Signal_CompMatch
Raised on a Compare Match event. The index indicates which channel (0=’A’, 1=’B’, …), no data is carried.
-
enumerator Signal_CompOutput
Raised with the Compare Output state. The index indicates which channel (0=’A’, 1=’B’, …) The data is the state (0 or 1) or invalid data if the channel is disabled.
-
enumerator Signal_Capt
Raised on a Input Capture event, no data is carried.
-
enumerator Signal_OVF
Public Functions
-
ArchAVR_Timer(int num, const ArchAVR_TimerConfig &config)
-
~ArchAVR_Timer()
-
virtual bool init(Device &device) override
Virtual method called when the device is initialised. This is where the peripheral can allocate its I/O registers, interrupts or connect signals.
- Returns:
boolean indicates the success of all allocations.
-
virtual void reset() override
Virtual method called when the device is reset. Note that resetting I/O registers is only necessary here if their reset value is not zero.
-
virtual bool ctlreq(ctlreq_id_t req, ctlreq_data_t *data) override
Virtual method called for a CTL request. The method must return true if the request has been processed.
-
virtual uint8_t ioreg_read_handler(reg_addr_t addr, uint8_t value) override
Virtual method called when the CPU is reading a I/O register allocated by this peripheral. The value has not been read yet so the module can modify it before the CPU gets it.
- Parameters:
addr – the register address in I/O space
value – current cached value of the register
- Returns:
actual value of the register
-
virtual uint8_t ioreg_peek_handler(reg_addr_t addr, uint8_t value) override
Virtual method called when a debug probe is peeking the value of a register. The value has not been read yet so the module can modify it before the CPU gets it. The difference between a peek and a read is that a peek should not modify the state of the peripheral. By default, ioreg_read_handler is called to obtain the value.
- Parameters:
addr – the register address in I/O space
value – current cached value of the register
- Returns:
actual value of the register
-
virtual void ioreg_write_handler(reg_addr_t addr, const ioreg_write_t &data) override
Virtual method called when the CPU is writing a I/O register allocated by this peripheral. The value has already been written.
- Parameters:
addr – the register address in I/O space
value – the new register content
-
virtual void raised(const signal_data_t &sigdata, int hooktag) override
Pure virtual callback called during signal raises.
- Parameters:
sigdata – Data structure passed on when raising a signal
hooktag – integer passed on when connecting a hook to a signal. For hooks connected to several signals, it provides a mean to identify the caller.
-
class CaptureHook : public SignalHook
Public Functions
-
inline CaptureHook(ArchAVR_Timer &timer)
-
inline virtual ~CaptureHook()
-
inline virtual void raised(const signal_data_t&, int) override
Pure virtual callback called during signal raises.
- Parameters:
sigdata – Data structure passed on when raising a signal
hooktag – integer passed on when connecting a hook to a signal. For hooks connected to several signals, it provides a mean to identify the caller.
-
inline CaptureHook(ArchAVR_Timer &timer)
-
struct OutputCompareChannel