summaryrefslogtreecommitdiff
path: root/timer/stm32_timer.h
blob: f55b09c5e12cfcb8efeffb276b8aa40763991b10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <mmio/mmio.h>

struct STM32_TIMER_reg_v1_t {
	volatile uint32_t CR1;
	volatile uint32_t CR2;
	volatile uint32_t SMCR;
	volatile uint32_t DIER;
	volatile uint32_t SR;
	volatile uint32_t EGR;
	volatile uint32_t CCMR1;
	volatile uint32_t CCMR2;
	volatile uint32_t CCER;
	volatile uint32_t CNT;
	volatile uint32_t PSC;
	volatile uint32_t ARR;
	volatile uint32_t RCR;
	volatile uint32_t CCR1;
	volatile uint32_t CCR2;
	volatile uint32_t CCR3;
	volatile uint32_t CCR4;
	volatile uint32_t BDTR;
	volatile uint32_t DCR;
	volatile uint32_t DMAR;
	// Many of the following are only on "new" parts like G/U/W
	volatile uint32_t OR1;
	volatile uint32_t _reserved1[4];
	volatile uint32_t AF1;
	volatile uint32_t _reserved2;
	volatile uint32_t TISEL;
};

struct STM32_TIMER_reg_lpv1_t {
	volatile uint32_t ISR;
	volatile uint32_t ICR;
	volatile uint32_t IER;
	volatile uint32_t CFGR;
	volatile uint32_t CR;
	volatile uint32_t CMP;
	volatile uint32_t ARR;
	volatile uint32_t CNT;
	volatile uint32_t OR;
};

template <typename T>
class STM32_TIMER_t : public mmio_ptr<T> {
    public:
        using mmio_ptr<T>::ptr;
};