diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-10-02 14:45:56 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-10-02 14:45:56 -0400 |
| commit | 99be520563834d51eb3ddd32b757a3dcd2486632 (patch) | |
| tree | 7c31bcc262950d431a1676b62624b6ac82f30df3 /fw/system.c | |
| parent | c91e3d96c90cd1c9b3b6155bc5e37954011cf0af (diff) | |
| download | can-gauge-interface-99be520563834d51eb3ddd32b757a3dcd2486632.zip | |
spi systest
Diffstat (limited to 'fw/system.c')
| -rw-r--r-- | fw/system.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fw/system.c b/fw/system.c index f369673..720f456 100644 --- a/fw/system.c +++ b/fw/system.c @@ -1,3 +1,7 @@ +#include <xc.h> + +#include "system.h" + // CONFIG1 #pragma config FOSC = INTOSC // Oscillator Selection Bits (INTOSC oscillator: I/O function on CLKIN pin) #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) @@ -19,3 +23,14 @@ #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) #pragma config LPBOR = OFF // Low-Power Brown Out Reset (Low-Power BOR is disabled) #pragma config LVP = ON // Low-Voltage Programming Enable + +void +sysInit(void) { + OSCCON = 0xFC; // HFINTOSC @ 16MHz, 3x PLL, PLL enabled + ACTCON = 0x90; // active clock tuning enabled for USB + + // Disable all analog pin functions + ANSELA = 0; + ANSELB = 0; + ANSELC = 0; +} |