annotate 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
rev   line source
andrewm@0 1 /*
andrewm@0 2 * Utilities.h
andrewm@0 3 *
andrewm@0 4 * Created on: Oct 27, 2014
andrewm@0 5 * Author: parallels
andrewm@0 6 */
andrewm@0 7
andrewm@0 8 #ifndef UTILITIES_H_
andrewm@0 9 #define UTILITIES_H_
andrewm@0 10
andrewm@5 11 // Macros for accessing the matrix values: usable _only_ within render()
andrewm@5 12
andrewm@5 13 // Read an analog input from input pin p at frame f
andrewm@5 14 #define analogRead(p, f) (matrixIn[(f)*8 + (p)])
andrewm@5 15 // Write an analog output frame at output pin p, frame f, to value v
andrewm@5 16 #define analogWrite(p, f, v) (matrixOut[(f)*8 + (p)] = (uint16_t)(v))
andrewm@5 17
andrewm@0 18 float map(float x, float in_min, float in_max, float out_min, float out_max);
andrewm@0 19 float constrain(float x, float min_val, float max_val);
andrewm@0 20
andrewm@0 21 #endif /* UTILITIES_H_ */