comparison 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
comparison
equal deleted inserted replaced
12:a6beeba3a648 13:6adb088196a7
6 */ 6 */
7 7
8 #ifndef UTILITIES_H_ 8 #ifndef UTILITIES_H_
9 #define UTILITIES_H_ 9 #define UTILITIES_H_
10 10
11 extern int gNumAudioChannels; // How many audio channels are present
12 extern int gNumMatrixChannels; // How many matrix channels are present
13
11 // Macros for accessing the matrix values: usable _only_ within render() 14 // Macros for accessing the matrix values: usable _only_ within render()
12 15
13 // Read an analog input from input pin p at frame f 16 // Read an analog input from input pin p at frame f
14 #define analogRead(p, f) (matrixIn[(f)*8 + (p)]) 17 #define analogRead(p, f) (matrixIn[(f)*gNumMatrixChannels + (p)])
15 // Write an analog output frame at output pin p, frame f, to value v 18 // Write an analog output frame at output pin p, frame f, to value v
16 #define analogWrite(p, f, v) (matrixOut[(f)*8 + (p)] = (uint16_t)(v)) 19 #define analogWrite(p, f, v) (matrixOut[(f)*gNumMatrixChannels + (p)] = (uint16_t)(v))
17 20
18 float map(float x, float in_min, float in_max, float out_min, float out_max); 21 float map(float x, float in_min, float in_max, float out_min, float out_max);
19 float constrain(float x, float min_val, float max_val); 22 float constrain(float x, float min_val, float max_val);
20 23
21 #endif /* UTILITIES_H_ */ 24 #endif /* UTILITIES_H_ */