-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathosc.h
50 lines (40 loc) · 1.15 KB
/
osc.h
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
#ifndef __OSC_H__
#define __OSC_H__
//COSC, NOSC
typedef enum
{
//0 reserved, same as HFINT
osc_HFINTOSC2X = 1<<4,
osc_EXTOSC4X = 2<<4,
//3 reserved, same as HFINT
osc_SOSC = 4<<4,
osc_LFOSC = 5<<4,
osc_HFINTOSC = 6<<4,
osc_EXTOSC = 7<<4
}
osc_osc_t;
//NDIV, CDIV
typedef enum
{
osc_DIV1, osc_DIV2, osc_DIV4, osc_DIV8, osc_DIV16, osc_DIV32,
osc_DIV64, osc_DIV128, osc_DIV256, osc_DIV512
}
osc_div_t;
//HFFRQ
typedef enum
{
osc_HFFREQ1, osc_HFFREQ2, osc_HFFREQ4, osc_HFFREQ8,
osc_HFFREQ12, osc_HFFREQ16, osc_HFFREQ32
}
osc_hffreq_t;
uint32_t
osc_sysclk; //store current freq
uint32_t
osc_hfclk; //store current hf int osc freq
// NOTE -
// set _extfreq, _soscfreq in osc.c if these sosc or ext are used
bool
osc_set (osc_osc_t, osc_div_t);
void
osc_hffreq (osc_hffreq_t);
#endif //__OSC_H__