ATmega328p
Hardware definitions
Loading...
Searching...
No Matches
atmega328p::timer Namespace Reference

Timer/counter definitions. More...

Namespaces

namespace  timer0
 Timer0 hardware characteristics.
namespace  timer1
 Timer1 hardware characteristics.
namespace  timer2
 Timer2 hardware characteristics.

Enumerations

enum class  Id : uint8_t { Timer0 = 0 , Timer1 = 1 , Timer2 = 2 }
 Hardware timer identifiers. More...
enum class  Timer01ClockSelection : uint8_t {
  Stopped = 0 , NoPrescaling = 1 , Divide8 = 2 , Divide64 = 3 ,
  Divide256 = 4 , Divide1024 = 5 , ExternalFallingEdge = 6 , ExternalRisingEdge = 7
}
 Timer0/Timer1 clock-select encodings. More...
enum class  Timer01Prescaler : uint16_t {
  Divide1 = 1 , Divide8 = 8 , Divide64 = 64 , Divide256 = 256 ,
  Divide1024 = 1024
}
 Timer0 and Timer1 prescaler values. More...
enum class  Timer2Prescaler : uint16_t {
  Divide1 = 1 , Divide8 = 8 , Divide32 = 32 , Divide64 = 64 ,
  Divide128 = 128 , Divide256 = 256 , Divide1024 = 1024
}
 Timer2 prescaler selections. More...
enum class  Timer2ClockSelection : uint8_t {
  Stopped = 0 , NoPrescaling = 1 , Divide8 = 2 , Divide32 = 3 ,
  Divide64 = 4 , Divide128 = 5 , Divide256 = 6 , Divide1024 = 7
}
 Timer2 clock source and prescaler selections. More...
enum class  Timer0WaveformMode : uint8_t {
  Normal = 0 , PhaseCorrectPWM = 1 , ClearOnCompare = 2 , FastPWM = 3 ,
  Reserved4 = 4 , PhaseCorrectPWMTopOCR0A = 5 , Reserved6 = 6 , FastPWMTopOCR0A = 7
}
 Timer0 waveform modes. More...
enum class  Timer2WaveformMode : uint8_t {
  Normal = 0 , PhaseCorrectPWM = 1 , ClearOnCompare = 2 , FastPWM = 3 ,
  Reserved4 = 4 , PhaseCorrectPWMTopOCR2A = 5 , Reserved6 = 6 , FastPWMTopOCR2A = 7
}
 Timer2 waveform modes. More...
enum class  Timer1WaveformMode : uint8_t {
  Normal = 0 , PhaseCorrectPWM8Bit = 1 , PhaseCorrectPWM9Bit = 2 , PhaseCorrectPWM10Bit = 3 ,
  ClearOnCompareOCR1A = 4 , FastPWM8Bit = 5 , FastPWM9Bit = 6 , FastPWM10Bit = 7 ,
  PhaseAndFrequencyCorrectPWMWithICR1 = 8 , PhaseAndFrequencyCorrectPWMWithOCR1A = 9 , PhaseCorrectPWMWithICR1 = 10 , PhaseCorrectPWMWithOCR1A = 11 ,
  ClearOnCompareICR1 = 12 , Reserved13 = 13 , FastPWMWithICR1 = 14 , FastPWMWithOCR1A = 15
}
 Timer1 waveform modes. More...
enum  : uint8_t {
  timer_count = 3U , timer0_counter_bits = 8U , timer1_counter_bits = 16U , timer2_counter_bits = 8U ,
  timer0_compare_channel_count = 2U , timer1_compare_channel_count = 2U , timer2_compare_channel_count = 2U
}
enum  : uint16_t { timer01_prescaler_count = 5 , timer2_prescaler_count = 7 }
enum class  PinSignal : uint8_t { Timer0ExternalClock = 0x24 , Timer1ExternalClock = 0x25 , Timer1InputCapture = 0x00 }
 Timer input pin identifiers. More...

Detailed Description

Timer/counter definitions.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : uint8_t
Enumerator
timer_count 

Number of timer.

timer0_counter_bits 

Timer0 counter width (bits).

timer1_counter_bits 

Timer1 counter width (bits).

timer2_counter_bits 

Timer2 counter width (bits).

timer0_compare_channel_count 

Number of timer0 compare channel.

timer1_compare_channel_count 

Number of timer1 compare channel.

timer2_compare_channel_count 

Number of timer2 compare channel.

◆ anonymous enum

anonymous enum : uint16_t
Enumerator
timer01_prescaler_count 

Number of timer01 prescaler.

timer2_prescaler_count 

Number of timer2 prescaler.

◆ Id

enum class atmega328p::timer::Id : uint8_t
strong

Hardware timer identifiers.

Enumerator
Timer0 

0 - Hardware timer 0.

Timer1 

1 - Hardware timer 1.

Timer2 

2 - Hardware timer 2.

◆ PinSignal

enum class atmega328p::timer::PinSignal : uint8_t
strong

Timer input pin identifiers.

Enumerator
Timer0ExternalClock 

0x24 - T0 external clock on PD4.

Timer1ExternalClock 

0x25 - T1 external clock on PD5.

Timer1InputCapture 

0x00 - ICP1 input on PB0.

◆ Timer01ClockSelection

enum class atmega328p::timer::Timer01ClockSelection : uint8_t
strong

Timer0/Timer1 clock-select encodings.

Enumerator
Stopped 

0 - Stop the counter.

NoPrescaling 

1 - Use clock without prescaling.

Divide8 

2 - Divide timer clock by 8.

Divide64 

3 - Divide timer clock by 64.

Divide256 

4 - Divide timer clock by 256.

Divide1024 

5 - Divide timer clock by 1024.

ExternalFallingEdge 

6 - Count falling edges on external clock pin.

ExternalRisingEdge 

7 - Count rising edges on external clock pin.

◆ Timer01Prescaler

enum class atmega328p::timer::Timer01Prescaler : uint16_t
strong

Timer0 and Timer1 prescaler values.

Enumerator
Divide1 

1 - Divide timer clock by 1.

Divide8 

8 - Divide timer clock by 8.

Divide64 

64 - Divide timer clock by 64.

Divide256 

256 - Divide timer clock by 256.

Divide1024 

1024 - Divide timer clock by 1024.

◆ Timer0WaveformMode

enum class atmega328p::timer::Timer0WaveformMode : uint8_t
strong

Timer0 waveform modes.

Enumerator
Normal 

0 - Normal counter mode.

PhaseCorrectPWM 

1 - Dual-slope phase-correct PWM.

ClearOnCompare 

2 - Clear timer on compare match (CTC).

FastPWM 

3 - Fast PWM.

Reserved4 

4 - Reserved; do not select.

PhaseCorrectPWMTopOCR0A 

5 - Phase-correct PWM with OCR0A as TOP.

Reserved6 

6 - Reserved; do not select.

FastPWMTopOCR0A 

7 - Fast PWM with OCRnA as TOP.

◆ Timer1WaveformMode

enum class atmega328p::timer::Timer1WaveformMode : uint8_t
strong

Timer1 waveform modes.

Enumerator
Normal 

0 - Normal counter mode.

PhaseCorrectPWM8Bit 

1 - Phase correct pwm8 bit.

PhaseCorrectPWM9Bit 

2 - Phase correct pwm9 bit.

PhaseCorrectPWM10Bit 

3 - Phase correct pwm10 bit.

ClearOnCompareOCR1A 

4 - CTC with OCR1A as TOP.

FastPWM8Bit 

5 - Fast PWM (8-bit).

FastPWM9Bit 

6 - Fast PWM (9-bit).

FastPWM10Bit 

7 - Fast PWM (0-bit).

PhaseAndFrequencyCorrectPWMWithICR1 

8 - Phase and frequency correct pwm with icr1.

PhaseAndFrequencyCorrectPWMWithOCR1A 

9 - Phase and frequency correct pwm with ocr1 a.

PhaseCorrectPWMWithICR1 

10 - Phase correct pwm with icr1.

PhaseCorrectPWMWithOCR1A 

11 - Phase correct pwm with ocr1 a.

ClearOnCompareICR1 

12 - CTC with ICR1 as TOP.

Reserved13 

13 - Reserved; do not select.

FastPWMWithICR1 

14 - Fast PWM with ICR1 as TOP.

FastPWMWithOCR1A 

15 - Fast PWM with OCRnA as TOP.

◆ Timer2ClockSelection

enum class atmega328p::timer::Timer2ClockSelection : uint8_t
strong

Timer2 clock source and prescaler selections.

Enumerator
Stopped 

0 - Stop the counter.

NoPrescaling 

1 - Use clock without prescaling.

Divide8 

2 - Divide timer clock by 8.

Divide32 

3 - Divide timer clock by 32.

Divide64 

4 - Divide timer clock by 64.

Divide128 

5 - Divide timer clock by 128.

Divide256 

6 - Divide timer clock by 256.

Divide1024 

7 - Divide timer clock by 1024.

◆ Timer2Prescaler

enum class atmega328p::timer::Timer2Prescaler : uint16_t
strong

Timer2 prescaler selections.

Enumerator
Divide1 

1 - Divide timer clock by 1.

Divide8 

8 - Divide timer clock by 8.

Divide32 

32 - Divide timer clock by 32.

Divide64 

64 - Divide timer clock by 64.

Divide128 

128 - Divide timer clock by 128.

Divide256 

256 - Divide timer clock by 256.

Divide1024 

1024 - Divide timer clock by 1024.

◆ Timer2WaveformMode

enum class atmega328p::timer::Timer2WaveformMode : uint8_t
strong

Timer2 waveform modes.

Enumerator
Normal 

0 - Normal counter mode.

PhaseCorrectPWM 

1 - Dual-slope phase-correct PWM.

ClearOnCompare 

2 - Clear timer on compare match (CTC).

FastPWM 

3 - Fast PWM.

Reserved4 

4 - Reserved; do not select.

PhaseCorrectPWMTopOCR2A 

5 - Phase-correct PWM with OCR2A as TOP.

Reserved6 

6 - Reserved; do not select.

FastPWMTopOCR2A 

7 - Fast PWM with OCRnA as TOP.