ATmega328p
Hardware definitions
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1
5
6#ifndef ATMEGA328P_DEFINITIONS_TIMER_H
7#define ATMEGA328P_DEFINITIONS_TIMER_H
8
9#include <stdint.h>
10#include "Config.h"
11#include "Pin.h"
12
14namespace atmega328p
15{
17 namespace timer
18 {
20 enum class Id : uint8_t
21 {
22 Timer0 = 0,
23 Timer1 = 1,
24 Timer2 = 2,
25 };
26
39
41 enum class Timer01Prescaler : uint16_t
42 {
43 Divide1 = 1,
44 Divide8 = 8,
45 Divide64 = 64,
46 Divide256 = 256,
47 Divide1024 = 1024,
48 };
49
51 enum class Timer2Prescaler : uint16_t
52 {
53 Divide1 = 1,
54 Divide8 = 8,
55 Divide32 = 32,
56 Divide64 = 64,
57 Divide128 = 128,
58 Divide256 = 256,
59 Divide1024 = 1024,
60 };
61
63 enum class Timer2ClockSelection : uint8_t
64 {
65 Stopped = 0,
67 Divide8 = 2,
73 };
74
87
100
121
123 namespace timer0
124 {
125 enum : uint8_t
126 {
132 };
133 }
134
149
164
165 enum : uint8_t
166 {
174 };
175
176 enum : uint16_t
177 {
180 };
181
183 enum class PinSignal : uint8_t
184 {
188 };
189 }
190}
191
192#endif
Selects the ATmega328P package and operating grade.
Logical GPIO pin and port identifiers.
Timer0 hardware characteristics.
Definition Timer.h:124
@ shares_prescaler_with_timer1
Shares prescaler with timer1.
Definition Timer.h:131
@ compare_channel_count
Number of compare channel.
Definition Timer.h:128
@ has_input_capture
Input capture available.
Definition Timer.h:129
@ supports_async_clock
Async clock supported.
Definition Timer.h:130
@ counter_bits
Counter width (bits).
Definition Timer.h:127
Timer1 hardware characteristics.
Definition Timer.h:137
@ shares_prescaler_with_timer0
Shares prescaler with timer0.
Definition Timer.h:144
@ compare_channel_count
Number of compare channel.
Definition Timer.h:141
@ supports_async_clock
Async clock supported.
Definition Timer.h:143
@ counter_bits
Counter width (bits).
Definition Timer.h:140
@ has_selectable_capture_edge
Selectable capture edge available.
Definition Timer.h:146
@ has_input_capture
Input capture available.
Definition Timer.h:142
@ has_input_capture_noise_canceler
Input capture noise canceler available.
Definition Timer.h:145
Timer2 hardware characteristics.
Definition Timer.h:152
@ counter_bits
Counter width (bits).
Definition Timer.h:155
@ supports_async_clock
Async clock supported.
Definition Timer.h:158
@ async_requires_internal_rc_clock
Async requires internal RC clock.
Definition Timer.h:159
@ compare_channel_count
Number of compare channel.
Definition Timer.h:156
@ has_input_capture
Input capture available.
Definition Timer.h:157
@ async_requires_cpu_clock_above_4x_tosc
Async requires CPU clock above 4x TOSC.
Definition Timer.h:160
@ supports_external_clock_on_tosc1
External clock on tosc1 supported.
Definition Timer.h:161
Timer/counter definitions.
Definition Timer.h:18
@ timer01_prescaler_count
Number of timer01 prescaler.
Definition Timer.h:178
@ timer2_prescaler_count
Number of timer2 prescaler.
Definition Timer.h:179
Timer01ClockSelection
Timer0/Timer1 clock-select encodings.
Definition Timer.h:29
@ NoPrescaling
1 - Use clock without prescaling.
Definition Timer.h:31
@ ExternalFallingEdge
6 - Count falling edges on external clock pin.
Definition Timer.h:36
@ Divide1024
5 - Divide timer clock by 1024.
Definition Timer.h:35
@ Divide64
3 - Divide timer clock by 64.
Definition Timer.h:33
@ Divide8
2 - Divide timer clock by 8.
Definition Timer.h:32
@ ExternalRisingEdge
7 - Count rising edges on external clock pin.
Definition Timer.h:37
@ Stopped
0 - Stop the counter.
Definition Timer.h:30
@ Divide256
4 - Divide timer clock by 256.
Definition Timer.h:34
Timer1WaveformMode
Timer1 waveform modes.
Definition Timer.h:103
@ PhaseCorrectPWMWithOCR1A
11 - Phase correct pwm with ocr1 a.
Definition Timer.h:115
@ PhaseCorrectPWM9Bit
2 - Phase correct pwm9 bit.
Definition Timer.h:106
@ FastPWMWithICR1
14 - Fast PWM with ICR1 as TOP.
Definition Timer.h:118
@ PhaseAndFrequencyCorrectPWMWithOCR1A
9 - Phase and frequency correct pwm with ocr1 a.
Definition Timer.h:113
@ PhaseCorrectPWMWithICR1
10 - Phase correct pwm with icr1.
Definition Timer.h:114
@ ClearOnCompareICR1
12 - CTC with ICR1 as TOP.
Definition Timer.h:116
@ PhaseCorrectPWM8Bit
1 - Phase correct pwm8 bit.
Definition Timer.h:105
@ PhaseAndFrequencyCorrectPWMWithICR1
8 - Phase and frequency correct pwm with icr1.
Definition Timer.h:112
@ FastPWM10Bit
7 - Fast PWM (0-bit).
Definition Timer.h:111
@ FastPWM8Bit
5 - Fast PWM (8-bit).
Definition Timer.h:109
@ PhaseCorrectPWM10Bit
3 - Phase correct pwm10 bit.
Definition Timer.h:107
@ FastPWM9Bit
6 - Fast PWM (9-bit).
Definition Timer.h:110
@ FastPWMWithOCR1A
15 - Fast PWM with OCRnA as TOP.
Definition Timer.h:119
@ ClearOnCompareOCR1A
4 - CTC with OCR1A as TOP.
Definition Timer.h:108
@ Reserved13
13 - Reserved; do not select.
Definition Timer.h:117
Timer2ClockSelection
Timer2 clock source and prescaler selections.
Definition Timer.h:64
Timer0WaveformMode
Timer0 waveform modes.
Definition Timer.h:77
@ PhaseCorrectPWM
1 - Dual-slope phase-correct PWM.
Definition Timer.h:79
@ Reserved4
4 - Reserved; do not select.
Definition Timer.h:82
@ FastPWM
3 - Fast PWM.
Definition Timer.h:81
@ Normal
0 - Normal counter mode.
Definition Timer.h:78
@ FastPWMTopOCR0A
7 - Fast PWM with OCRnA as TOP.
Definition Timer.h:85
@ PhaseCorrectPWMTopOCR0A
5 - Phase-correct PWM with OCR0A as TOP.
Definition Timer.h:83
@ Reserved6
6 - Reserved; do not select.
Definition Timer.h:84
@ ClearOnCompare
2 - Clear timer on compare match (CTC).
Definition Timer.h:80
PinSignal
Timer input pin identifiers.
Definition Timer.h:184
@ Timer0ExternalClock
0x24 - T0 external clock on PD4.
Definition Timer.h:185
@ Timer1ExternalClock
0x25 - T1 external clock on PD5.
Definition Timer.h:186
@ Timer1InputCapture
0x00 - ICP1 input on PB0.
Definition Timer.h:187
Timer2WaveformMode
Timer2 waveform modes.
Definition Timer.h:90
@ FastPWMTopOCR2A
7 - Fast PWM with OCRnA as TOP.
Definition Timer.h:98
@ PhaseCorrectPWMTopOCR2A
5 - Phase-correct PWM with OCR2A as TOP.
Definition Timer.h:96
Timer01Prescaler
Timer0 and Timer1 prescaler values.
Definition Timer.h:42
@ Divide1
1 - Divide timer clock by 1.
Definition Timer.h:43
Id
Hardware timer identifiers.
Definition Timer.h:21
@ Timer1
1 - Hardware timer 1.
Definition Timer.h:23
@ Timer2
2 - Hardware timer 2.
Definition Timer.h:24
@ Timer0
0 - Hardware timer 0.
Definition Timer.h:22
Timer2Prescaler
Timer2 prescaler selections.
Definition Timer.h:52
@ Divide128
128 - Divide timer clock by 128.
Definition Timer.h:57
@ Divide32
32 - Divide timer clock by 32.
Definition Timer.h:55
@ timer1_compare_channel_count
Number of timer1 compare channel.
Definition Timer.h:172
@ timer1_counter_bits
Timer1 counter width (bits).
Definition Timer.h:169
@ timer0_counter_bits
Timer0 counter width (bits).
Definition Timer.h:168
@ timer2_counter_bits
Timer2 counter width (bits).
Definition Timer.h:170
@ timer2_compare_channel_count
Number of timer2 compare channel.
Definition Timer.h:173
@ timer_count
Number of timer.
Definition Timer.h:167
@ timer0_compare_channel_count
Number of timer0 compare channel.
Definition Timer.h:171
Device-specific definitions for the ATmega328P.
Definition ADC.h:14