aboutsummaryrefslogtreecommitdiffstats
path: root/sw/eeprom.h
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-08-16 12:19:09 -0230
committerSam Anthony <sam@samanthony.xyz>2025-08-16 12:19:09 -0230
commit4a99ede565fa61005f2a6202669adaa87a8ce0ee (patch)
tree472d4e45858d50b4f719591dc3666b5fdc129549 /sw/eeprom.h
parent31f8d3b1edbe9dd965dba663e40c62c336fe7ca9 (diff)
downloadcan-gauge-interface-4a99ede565fa61005f2a6202669adaa87a8ce0ee.zip
spi and eeprom modules
Diffstat (limited to 'sw/eeprom.h')
-rw-r--r--sw/eeprom.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sw/eeprom.h b/sw/eeprom.h
new file mode 100644
index 0000000..4e4dfe2
--- /dev/null
+++ b/sw/eeprom.h
@@ -0,0 +1,20 @@
+/* Microchip 25LC160C 2KiB EEPROM
+ *
+ * Usage:
+ *
+ * #include <xc.h>
+ * #include <stdint.h>
+ * #include "types.h"
+ * #include "spi.h"
+ * #include "eeprom.h"
+ */
+
+// Pin mapping
+#define EEPROM_CS_TRIS TRISAbits.TRISA5
+#define EEPROM_CS LATAbits.LATA5
+
+void eepromInit(void);
+void eepromWriteEnable(void);
+void eepromWriteDisable(void);
+void eepromWrite(U16 addr, U8 data[], U8 size);
+void eepromRead(U16 addr, U8 data[], U8 size);