aboutsummaryrefslogtreecommitdiffstats
path: root/fw/tests/system/eeprom_systest.c
blob: 81fa1897c42d416dd7339ce2f05e158fabc225d2 (plain) (blame)
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
#include <xc.h>

#include <stdint.h>

#include "system.h"
#include "types.h"
#include "spi.h"
#include "eeprom.h"
#include "usb.h"

void
main(void) {
	sysInit();
	spiInit();
	eepromInit();
	usbInit();

	T1CON = 0;
	T1CONbits.TMR1CS = 0x0; // FOSC/4
	T1CONbits.T1CKPS = 0x3; // 1:8 prescaler
	T1CONbits.TMR1ON = 1;

	TMR1IE = 1;
	TMR1IF = 0;
	PEIE = 1;
	GIE = 1;

	for (;;) {

	}
}

void
__interrupt() isr(void) {
	static U8 ctr = 0u;

	if (TMR1IF) {
		if (ctr == 23u) { // 1s period

		}
		ctr = (ctr+1u) % 23u;
		TMR1IF = 0;
	}
}