-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathccp1.c
45 lines (37 loc) · 1.13 KB
/
ccp1.c
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
#include <xc.h>
#include "ccp1.h"
#include "pmd.h"
// turn off ccp1 module via pmd
//=============================================================================
void
ccp1_deinit (void)
{
pmd_off( pmd_CCP1 );
}
// reset all ccp1 registers via pmd, set mode, turn on
//=============================================================================
void
ccp1_init (ccp1_mode_t mode)
{
pmd_reset( pmd_CCP1 );
CCP1CONbits.MODE = mode;
CCP1CONbits.EN = 1;
}
// set mode (set to 0 to stop/reset)
//=============================================================================
void
ccp1_mode (ccp1_mode_t mode)
{
CCP1CONbits.MODE = mode;
}
//=============================================================================
void
ccp1_on (bool tf)
{
CCP1CONbits.EN = tf;
}
//=============================================================================
void
ccp1_prset (uint16_t v){
CCPR1 = v;
}