Lazuli
Loading...
Searching...
No Matches
timer_counter_0.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-only
3 * This file is part of Lazuli.
4 */
5
15#ifndef LAZULI_SYS_ARCH_AVR_TIMER_COUNTER_0_H
16#define LAZULI_SYS_ARCH_AVR_TIMER_COUNTER_0_H
17
18#include <stdint.h>
19
20#include <Lazuli/common.h>
21
23
24/*
25 * Timer 0 registers definitions.
26 * Ordered by address.
27 */
28
30#define TIFR0 DIRECT(0x35)
31
33#define TCCR0A DIRECT(0x44)
34
36#define TCCR0B DIRECT(0x45)
37
39#define TCNT0 DIRECT(0x46)
40
42#define OCR0A DIRECT(0x47)
43
45#define OCR0B DIRECT(0x48)
46
48#define TIMSK0 DIRECT(0x6e)
49
53typedef struct {
54 volatile uint8_t tccr0a;
55 volatile uint8_t tccr0b;
56 volatile uint8_t tcnt0;
57 volatile uint8_t ocr0a;
58 volatile uint8_t ocr0b;
60
64enum {
71};
72
76enum {
83};
84
88enum {
91
94
97};
98
102enum {
104 TIFR0_OCF0A = POSITION(1U),
106 TIFR0_OCF0B = POSITION(2U)
109
111
112#endif /* LAZULI_SYS_ARCH_AVR_TIMER_COUNTER_0_H */
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition stdint.h:89
Basic type definitions and useful macros.
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition common.h:39
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition common.h:44
#define POSITION(X)
Define a constant bit at position X, starting from index 0.
Definition common_asm.h:30
Describes the memory mapping for timer/counter 0.
volatile uint8_t ocr0b
Output Compare register B
volatile uint8_t tcnt0
Timer/Counter Register
volatile uint8_t tccr0b
Timer/Counter Control Register B
volatile uint8_t tccr0a
Timer/Counter Control Register A
volatile uint8_t ocr0a
Output Compare register A
@ TCCR0B_WGM02
Waveform Generation Mode.
@ TCCR0B_FOC0A
Force Output Compare A
@ TCCR0B_CS02
Clock Select
@ TCCR0B_CS01
Clock Select
@ TCCR0B_CS00
Clock Select
@ TCCR0B_FOC0B
Force Output Compare B
@ TIMSK0_OCIE0B
Timer/Counter 0 Output Compare Match B Interrupt Enable.
@ TIMSK0_TOIE0
Timer/Counter 0 Overflow Interrupt enable.
@ TIMSK0_OCIE0A
Timer/Counter 0 Output Compare Match A Interrupt Enable.
@ TIFR0_OCF0B
Timer/Counter 0 Output Compare B Match Flag
@ TIFR0_OCF0A
Timer/Counter 0 Output Compare A Match Flag
@ TIFR0_TOV0
Timer/Counter 0 Overflow Flag
@ TCCR0A_COM0B0
Compare Match Output B Mode.
@ TCCR0A_COM0A1
Compare Match Output A Mode.
@ TCCR0A_WGM01
Waveform Generation Mode
@ TCCR0A_COM0A0
Compare Match Output A Mode.
@ TCCR0A_WGM00
Waveform Generation Mode
@ TCCR0A_COM0B1
Compare Match Output B Mode.