Mercurial > hg > beaglert
view include/Utilities.h @ 12:a6beeba3a648
Initial support for higher matrix sample rates by reducing the number of channels. Input not tested yet, and not all examples updated to new format.
author | andrewm |
---|---|
date | Thu, 22 Jan 2015 19:00:22 +0000 |
parents | 09f03ac40fcc |
children | 6adb088196a7 |
line wrap: on
line source
/* * Utilities.h * * Created on: Oct 27, 2014 * Author: parallels */ #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); #endif /* UTILITIES_H_ */