-
Notifications
You must be signed in to change notification settings - Fork 1
/
Timer1.hpp
63 lines (43 loc) · 1.15 KB
/
Timer1.hpp
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
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
//Timer1 functions
#include <cstdint>
#include "Reg.hpp"
struct Timer1 : private Reg {
static auto
timer (uint16_t) -> void;
static auto
timer () -> uint16_t;
static auto
period (uint16_t) -> void;
static auto
period () -> uint16_t;
static auto
on (bool) -> void;
static auto
stop_idle (bool) -> void;
static auto
wr_async (bool) -> void;
static auto
wr_busy () -> bool;
enum
CLK : bool {
PBCLK = false, T1CK
};
//clock source - also sets TCS unless pbclk
static auto
clk_src (CLK) -> void;
static auto
tgate (bool) -> void;
enum
TCKPS : uint8_t { PS1, PS8, PS64, PS256 };
static auto
prescale (TCKPS) -> void;
static auto
tsync (bool) -> void;
//for Osc- so it can backup/restore T1CON if it needs
//timer1 to check ext osc speed
static auto
t1con () -> uint16_t;
static auto
t1con (uint16_t) -> void;
};