Initial import of v2 goggles that use ws2812 rings from adafruit
[goggles] / user.c
1 /******************************************************************************/
2 /* Files to Include                                                           */
3 /******************************************************************************/
4
5
6 #include <stdint.h>         /* For uint8_t definition */
7 #include <stdbool.h>        /* For true/false definition */
8
9 #include "user.h"
10
11 /******************************************************************************/
12 /* User Functions                                                             */
13 /******************************************************************************/
14
15 /* <Initialize variables in user.h and insert code for user algorithms.> */
16
17 void InitApp(void)
18 {
19     // set oscillator to 32MHz
20     OSCCONbits.SCS = 0b00;
21     OSCCONbits.IRCF = 0b1110;
22     OSCCONbits.SPLLEN = 1;
23
24     // Turn watchdog on at 16 seconds
25     WDTCONbits.WDTPS = 0b01110;
26
27     // Button on RA2
28     OPTION_REGbits.nWPUEN = 0;
29     TRISAbits.TRISA1 = 1;
30     ANSELAbits.ANSA1 = 0;
31     WPUAbits.WPUA1 = 1;
32     
33 }
34
35