From 99be520563834d51eb3ddd32b757a3dcd2486632 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 2 Oct 2025 14:45:56 -0400 Subject: spi systest --- fw/tests/system/eeprom_systest.c | 31 +++++++++++++++++++++++++++---- fw/tests/system/spi_systest.c | 22 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 fw/tests/system/spi_systest.c (limited to 'fw/tests/system') diff --git a/fw/tests/system/eeprom_systest.c b/fw/tests/system/eeprom_systest.c index 9099345..81fa189 100644 --- a/fw/tests/system/eeprom_systest.c +++ b/fw/tests/system/eeprom_systest.c @@ -2,20 +2,43 @@ #include +#include "system.h" #include "types.h" -#include "init.h" #include "spi.h" #include "eeprom.h" -#include "config.h" +#include "usb.h" void main(void) { - clockInit(); - pinsInit(); + 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; + } +} diff --git a/fw/tests/system/spi_systest.c b/fw/tests/system/spi_systest.c new file mode 100644 index 0000000..1adc624 --- /dev/null +++ b/fw/tests/system/spi_systest.c @@ -0,0 +1,22 @@ +#include + +#include + +#include "system.h" +#include "types.h" +#include "spi.h" + +void +main(void) { + sysInit(); + spiInit(); + + for (;;) { + (void)spiTx(0x05); // 0b0000101 + } +} + +void +__interrupt() isr(void) { + +} -- cgit v1.2.3