Mercurial > hg > beaglert
diff include/Utilities.h @ 5:09f03ac40fcc
API improvements and cleanups. Now all common audio command-line options can be parsed automatically.
author | andrewm |
---|---|
date | Sat, 08 Nov 2014 16:16:55 +0100 |
parents | 8a575ba3ab52 |
children | 6adb088196a7 |
line wrap: on
line diff
--- a/include/Utilities.h Thu Nov 06 19:02:48 2014 +0000 +++ b/include/Utilities.h Sat Nov 08 16:16:55 2014 +0100 @@ -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);