FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Defines all API to manipulate AVR Timers. More...
Classes | |
struct | Calculator |
Defines a set of calculation methods for the given NTIMER_ The behavior of these methods is specific to each AVR Timer are there can be many important differences between 2 timers on AVR. More... | |
class | PulseTimer |
Special kind of timer::Timer , specialized in emitting pulses with accurate width, according to a slow frequency. More... | |
class | RTT |
API to handle a real-time timer. More... | |
class | RTTEventCallback |
Utility to generate events from an RTT instance at a given period. More... | |
class | RTTRawTime |
Utility class to avoid costly instantiation of time::RTTTime from an interrupt routine. More... | |
class | SquareWave |
Simple API to generate a square wave to an output pin. More... | |
class | Timer |
General API to handle an AVR timer. More... | |
Enumerations | |
enum class | TimerMode : uint8_t { NORMAL , CTC , FAST_PWM , PHASE_CORRECT_PWM } |
Defines the mode of operation of a timer. More... | |
enum class | TimerInterrupt : uint8_t { OVERFLOW = board_traits::TimerInterrupt::OVERFLOW , OUTPUT_COMPARE_A = board_traits::TimerInterrupt::OUTPUT_COMPARE_A , OUTPUT_COMPARE_B = board_traits::TimerInterrupt::OUTPUT_COMPARE_B , OUTPUT_COMPARE_C = board_traits::TimerInterrupt::OUTPUT_COMPARE_C , INPUT_CAPTURE = board_traits::TimerInterrupt::INPUT_CAPTURE } |
Defines the interrupts that can be handled by a timer. More... | |
enum class | TimerOutputMode : uint8_t { DISCONNECTED , TOGGLE , NON_INVERTING , INVERTING } |
Defines the "connection" between this timer and specific PWM output pins. More... | |
enum class | TimerInputCapture : uint8_t { RISING_EDGE , FALLING_EDGE } |
Defines the type of input capture we want for a timer. More... | |
Functions | |
constexpr TimerInterrupt | operator| (TimerInterrupt i1, TimerInterrupt i2) |
Combine 2 timer interrupts for use with Timer.set_interrupts() . More... | |
Defines all API to manipulate AVR Timers.
In order to properly use Timers, some concepts are important to understand:
These concepts are described in details in AVR datasheets.
|
strong |
Defines the mode of operation of a timer.
Enumerator | |
---|---|
NORMAL | Timer "Normal" mode: counter is incremented up to maximum value (0xFF for 8-bits Timer, 0xFFFF for 16-bits Timer), and then resets to 0. Timer Overflow may generate an interrupt. |
CTC | Timer "Clear Timer on Compare match" mode: counter is incremented until it reaches "TOP" (OCRxA register value), then it is reset to 0. Reaching TOP may trigger an interrupt. |
FAST_PWM | Timer "Fast Phase Width Modulation" mode: counter is incremented until it reaches MAX value (0xFF for 8-bits Timer, 0x3FF for 16-bits Timer). In this mode the timer can be linked to PWM output pins to be automatically set or cleared when:
|
PHASE_CORRECT_PWM | Timer "Phase Correct Pulse Width Modulation" mode: counter is incremented until MAX (0xFF for 8-bits Timer, 0x3FF for 16-bits Timer), then decremented until 0, and incremented again... In this mode the timer can be linked to PWM output pins to be automatically set or cleared when:
|
|
strong |
Defines the interrupts that can be handled by a timer.
|
strong |
Defines the "connection" between this timer and specific PWM output pins.
Enumerator | |
---|---|
DISCONNECTED | No connection for this pin: pin is unaffected by timer operation. |
TOGGLE | Pin is toggled on Compare Match. |
NON_INVERTING | Pin is cleared on Compare Match. For TimerMode::FAST_PWM and TimerMode::PHASE_CORRECT_PWM modes, pin will also be set when counter reaches BOTTOM (0). This is also known as "non-inverting" mode). |
INVERTING | Pin is set on Compare Match. For TimerMode::FAST_PWM and TimerMode::PHASE_CORRECT_PWM modes, pin will also be cleared when counter reaches BOTTOM (0). This is also known as "inverting" mode). |
|
strong |
|
constexpr |
Combine 2 timer interrupts for use with Timer.set_interrupts()
.