aboutsummaryrefslogtreecommitdiffstats
path: root/PICCode.X/bufferlib.c
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2021-04-04 18:01:11 -0500
committerMatt Strapp <strap012@umn.edu>2021-04-04 18:01:22 -0500
commitb94f1c42df60cc0b9f9df3331745808f1f42b1d7 (patch)
treecfdf469147eb60007ccdc32b9029c0d9c865eefe /PICCode.X/bufferlib.c
parentFigure out how to space things (diff)
downloadee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.tar
ee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.tar.gz
ee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.tar.bz2
ee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.tar.lz
ee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.tar.xz
ee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.tar.zst
ee3102-b94f1c42df60cc0b9f9df3331745808f1f42b1d7.zip
Add newest contributions to GitHub
Diffstat (limited to '')
-rw-r--r--PICCode.X/bufferlib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/PICCode.X/bufferlib.c b/PICCode.X/bufferlib.c
index 4768c95..e9816a8 100644
--- a/PICCode.X/bufferlib.c
+++ b/PICCode.X/bufferlib.c
@@ -3,10 +3,10 @@
#define BUFFERSIZE 32
volatile int write = 0, numE = 0;
-volatile unsigned int buffer[BUFFERSIZE];
+volatile unsigned int buffer[BUFFERSIZE]; // Basic circular buffer. Prime for buffer overflows, probably.
- void putVal(int newValue) { // add a new value to the buffer
- buffer[write++] = newValue;
+ void putVal(int Vo, int ref) { // add a new value to the buffer
+ buffer[write++] = ref - Vo; // This is backwards because reasons
write %= BUFFERSIZE;
if (numE < BUFFERSIZE) {
@@ -27,7 +27,7 @@ volatile unsigned int buffer[BUFFERSIZE];
return(avg);
}
- void initBuffer() { // set all buffer values to zero
+ void initBuffer() { // set all buffer values to zero, likely also prime for a buffer overflow
int i;
for(i = 0; i < BUFFERSIZE; i++) {
buffer[i] = 0;