diff include/Utilities.h @ 7:ab396a08e962

Merge
author Victor Zappi <victor.zappi@qmul.ac.uk>
date Tue, 11 Nov 2014 15:31:01 +0000
parents 09f03ac40fcc
children 6adb088196a7
line wrap: on
line diff
--- a/include/Utilities.h	Tue Nov 11 15:25:37 2014 +0000
+++ b/include/Utilities.h	Tue Nov 11 15:31:01 2014 +0000
@@ -8,6 +8,13 @@
 #ifndef UTILITIES_H_
 #define UTILITIES_H_
 
+// Macros for accessing the matrix values: usable _only_ within render()
+
+// Read an analog input from input pin p at frame f
+#define analogRead(p, f) (matrixIn[(f)*8 + (p)])
+// Write an analog output frame at output pin p, frame f, to value v
+#define analogWrite(p, f, v) (matrixOut[(f)*8 + (p)] = (uint16_t)(v))
+
 float map(float x, float in_min, float in_max, float out_min, float out_max);
 float constrain(float x, float min_val, float max_val);