-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cvref.cpp
38 lines (33 loc) · 1.05 KB
/
Cvref.cpp
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
#include "Cvref.hpp"
enum {
DAC1CON = 0xBF802380,
ON = 15,
DACOE = 8,
REFSEL_SHIFT = 0, REFSEL_CLR = 3
};
//=============================================================================
auto Cvref::
on (bool tf) -> void
{
setbit(DAC1CON, 1<<ON, tf);
}
//=============================================================================
auto Cvref::
out (bool tf) -> void
{
setbit(DAC1CON, 1<<DACOE, tf);
}
//=============================================================================
auto Cvref::
refsel (REFSEL e) -> void
{
clrbit(DAC1CON, REFSEL_CLR<<REFSEL_SHIFT);
setbit(DAC1CON, e<<REFSEL_SHIFT);
}
//dac level 0-31
//=============================================================================
auto Cvref::
dacdat (uint8_t v) -> void
{
val(DAC1CON + 2, v);
}