aboutsummaryrefslogtreecommitdiffstats
path: root/PICCode.X/bufferlib.c
diff options
context:
space:
mode:
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;