Mercurial > hg > beaglert
view include/Utilities.h @ 13:6adb088196a7
Fixed ADC bug; added a simple passthrough test
author | andrewm |
---|---|
date | Fri, 23 Jan 2015 15:17:09 +0000 |
parents | 09f03ac40fcc |
children | 670be80463a3 |
line wrap: on
line source
/* * Utilities.h * * Created on: Oct 27, 2014 * Author: parallels */ #ifndef UTILITIES_H_ #define UTILITIES_H_ extern int gNumAudioChannels; // How many audio channels are present extern int gNumMatrixChannels; // How many matrix channels are present // 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)*gNumMatrixChannels + (p)]) // Write an analog output frame at output pin p, frame f, to value v #define analogWrite(p, f, v) (matrixOut[(f)*gNumMatrixChannels + (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_ */