comparison include/Utilities.h @ 23:182ae9367104 matrix_gpio

- persistency: the last frame of each digital and analogOut buffers is used to initialize all the frames in the next buffer. This means that once a value is set, the pin will hold the value until you change it - AnalogXyz macros have been renamed to analogXyz - the short option -P has been removed. The long option --pru-file has to be used instead
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 05 May 2015 17:28:00 +0100
parents c98863e63174
children 83baffda5786
comparison
equal deleted inserted replaced
22:fbfeb5895efd 23:182ae9367104
12 extern int gNumAnalogChannels; // How many analog channels are present 12 extern int gNumAnalogChannels; // How many analog channels are present
13 13
14 // Macros for accessing the analog values: usable _only_ within render() 14 // Macros for accessing the analog values: usable _only_ within render()
15 15
16 // Read an Analog input from input pin p at frame f 16 // Read an Analog input from input pin p at frame f
17 #define AnalogRead(p, f) (analogIn[(f)*gNumAnalogChannels + (p)]) 17 #define analogRead(p, f) (analogIn[(f)*gNumAnalogChannels + (p)])
18 // 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
19 #define AnalogWriteFrame(p, f, v) (analogOut[(f)*gNumAnalogChannels + (p)] = (v)) 19 #define analogWriteFrame(p, f, v) (analogOut[(f)*gNumAnalogChannels + (p)] = (v))
20 #define AnalogWrite(pin, frame, value) \ 20 #define analogWrite(pin, frame, value) \
21 (({do {\ 21 (({do {\
22 for (int _privateI=(frame); _privateI<numAnalogFrames; _privateI++){ \ 22 for (int _privateI=(frame); _privateI<numAnalogFrames; _privateI++){ \
23 AnalogWriteFrame(pin,_privateI,value); \ 23 analogWriteFrame(pin,_privateI,value); \
24 }\ 24 }\
25 } while (0);}),(void)0)\ 25 } while (0);}),(void)0)\
26 26
27 #define setBit(word,bit) ((word)|(1<<(bit))) 27 #define setBit(word,bit) ((word)|(1<<(bit)))
28 #define clearBit(word,bit) ((word)&~(1<<(bit))) 28 #define clearBit(word,bit) ((word)&~(1<<(bit)))