comparison include/Utilities.h @ 301:e4392164b458 prerelease

RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 14:34:41 +0100
parents d7148d21aaa5
children 421a69d42943
comparison
equal deleted inserted replaced
300:dbeed520b014 301:e4392164b458
11 */ 11 */
12 12
13 #ifndef UTILITIES_H_ 13 #ifndef UTILITIES_H_
14 #define UTILITIES_H_ 14 #define UTILITIES_H_
15 15
16 #include "BeagleRT.h" 16 #include "Bela.h"
17 17
18 /** 18 /**
19 * \defgroup iofunctions I/O functions and constants 19 * \defgroup iofunctions I/O functions and constants
20 * 20 *
21 * These functions and macros are used for audio, analog and digital I/O. All the 21 * These functions and macros are used for audio, analog and digital I/O. All the
22 * I/O functions require the BeagleRTContext data structure from render() to be passed 22 * I/O functions require the BelaContext data structure from render() to be passed
23 * in. This means that these functions are, by design, \b only usable from within 23 * in. This means that these functions are, by design, \b only usable from within
24 * the rendering thread. 24 * the rendering thread.
25 * 25 *
26 * The naming conventions are loosely derived from the Arduino environment, and the 26 * The naming conventions are loosely derived from the Arduino environment, and the
27 * syntax is similar. Unlike Arduino, the I/O functions require the frame number at which 27 * syntax is similar. Unlike Arduino, the I/O functions require the frame number at which
76 * \brief Read an audio input, specifying the frame number (when to read) and the channel. 76 * \brief Read an audio input, specifying the frame number (when to read) and the channel.
77 * 77 *
78 * This function returns the value of an audio input, at the time indicated by \c frame. 78 * This function returns the value of an audio input, at the time indicated by \c frame.
79 * The returned value ranges from -1 to 1. 79 * The returned value ranges from -1 to 1.
80 * 80 *
81 * \param context The I/O data structure which is passed by BeagleRT to render(). 81 * \param context The I/O data structure which is passed by Bela to render().
82 * \param frame Which frame (i.e. what time) to read the audio input. Valid values range 82 * \param frame Which frame (i.e. what time) to read the audio input. Valid values range
83 * from 0 to (context->audioFrames - 1). 83 * from 0 to (context->audioFrames - 1).
84 * \param channel Which audio input to read. Valid values are between 0 and 84 * \param channel Which audio input to read. Valid values are between 0 and
85 * (context->audioChannels - 1), typically 0 to 1 by default. 85 * (context->audioChannels - 1), typically 0 to 1 by default.
86 * \return Value of the analog input, range to 1. 86 * \return Value of the analog input, range to 1.
87 */ 87 */
88 static inline float audioReadFrame(BeagleRTContext *context, int frame, int channel); 88 static inline float audioReadFrame(BelaContext *context, int frame, int channel);
89 89
90 /** 90 /**
91 * \brief Write an audio output, specifying the frame number (when to write) and the channel. 91 * \brief Write an audio output, specifying the frame number (when to write) and the channel.
92 * 92 *
93 * This function sets the value of an audio output, at the time indicated by \c frame. Valid 93 * This function sets the value of an audio output, at the time indicated by \c frame. Valid
94 * values are between -1 and 1. 94 * values are between -1 and 1.
95 * 95 *
96 * \param context The I/O data structure which is passed by BeagleRT to render(). 96 * \param context The I/O data structure which is passed by Bela to render().
97 * \param frame Which frame (i.e. what time) to write the audio output. Valid values range 97 * \param frame Which frame (i.e. what time) to write the audio output. Valid values range
98 * from 0 to (context->audioFrames - 1). 98 * from 0 to (context->audioFrames - 1).
99 * \param channel Which analog output to write. Valid values are between 0 and 99 * \param channel Which analog output to write. Valid values are between 0 and
100 * (context->audioChannels - 1), typically 0 to 1 by default. 100 * (context->audioChannels - 1), typically 0 to 1 by default.
101 * \param value Value to write to the output, range -1 to 1. 101 * \param value Value to write to the output, range -1 to 1.
102 */ 102 */
103 static inline void audioWriteFrame(BeagleRTContext *context, int frame, int channel, float value); 103 static inline void audioWriteFrame(BelaContext *context, int frame, int channel, float value);
104 104
105 /** 105 /**
106 * \brief Read an analog input, specifying the frame number (when to read) and the channel. 106 * \brief Read an analog input, specifying the frame number (when to read) and the channel.
107 * 107 *
108 * This function returns the value of an analog input, at the time indicated by \c frame. 108 * This function returns the value of an analog input, at the time indicated by \c frame.
109 * The returned value ranges from 0 to 1, corresponding to a voltage range of 0 to 4.096V. 109 * The returned value ranges from 0 to 1, corresponding to a voltage range of 0 to 4.096V.
110 * 110 *
111 * \param context The I/O data structure which is passed by BeagleRT to render(). 111 * \param context The I/O data structure which is passed by Bela to render().
112 * \param frame Which frame (i.e. what time) to read the analog input. Valid values range 112 * \param frame Which frame (i.e. what time) to read the analog input. Valid values range
113 * from 0 to (context->analogFrames - 1). 113 * from 0 to (context->analogFrames - 1).
114 * \param channel Which analog input to read. Valid values are between 0 and 114 * \param channel Which analog input to read. Valid values are between 0 and
115 * (context->analogChannels - 1), typically 0 to 7 by default. 115 * (context->analogChannels - 1), typically 0 to 7 by default.
116 * \return Value of the analog input, range 0 to 1. 116 * \return Value of the analog input, range 0 to 1.
117 */ 117 */
118 static inline float analogReadFrame(BeagleRTContext *context, int frame, int channel); 118 static inline float analogReadFrame(BelaContext *context, int frame, int channel);
119 119
120 /** 120 /**
121 * \brief Write an analog output, specifying the frame number (when to write) and the channel. 121 * \brief Write an analog output, specifying the frame number (when to write) and the channel.
122 * 122 *
123 * This function sets the value of an analog output, at the time indicated by \c frame. Valid 123 * This function sets the value of an analog output, at the time indicated by \c frame. Valid
124 * values are between 0 and 1, corresponding to the range 0 to 5V. 124 * values are between 0 and 1, corresponding to the range 0 to 5V.
125 * 125 *
126 * The value written will persist for all future frames if BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST 126 * The value written will persist for all future frames if BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST
127 * is set in context->flags. This is the default behaviour. 127 * is set in context->flags. This is the default behaviour.
128 * 128 *
129 * \param context The I/O data structure which is passed by BeagleRT to render(). 129 * \param context The I/O data structure which is passed by Bela to render().
130 * \param frame Which frame (i.e. what time) to write the analog output. Valid values range 130 * \param frame Which frame (i.e. what time) to write the analog output. Valid values range
131 * from 0 to (context->analogFrames - 1). 131 * from 0 to (context->analogFrames - 1).
132 * \param channel Which analog output to write. Valid values are between 0 and 132 * \param channel Which analog output to write. Valid values are between 0 and
133 * (context->analogChannels - 1), typically 0 to 7 by default. 133 * (context->analogChannels - 1), typically 0 to 7 by default.
134 * \param value Value to write to the output, range 0 to 1. 134 * \param value Value to write to the output, range 0 to 1.
135 */ 135 */
136 static inline void analogWriteFrame(BeagleRTContext *context, int frame, int channel, float value); 136 static inline void analogWriteFrame(BelaContext *context, int frame, int channel, float value);
137 137
138 /** 138 /**
139 * \brief Write an analog output, specifying the frame number (when to write) and the channel. 139 * \brief Write an analog output, specifying the frame number (when to write) and the channel.
140 * 140 *
141 * This function sets the value of an analog output, at the time indicated by \c frame. Valid 141 * This function sets the value of an analog output, at the time indicated by \c frame. Valid
145 * future values unchanged. This is faster than analogWriteFrame() so is better suited 145 * future values unchanged. This is faster than analogWriteFrame() so is better suited
146 * to applications where every frame will be written to a different value. If 146 * to applications where every frame will be written to a different value. If
147 * BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST is not set within context->flags, then 147 * BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST is not set within context->flags, then
148 * analogWriteFrameOnce() and analogWriteFrame() are equivalent. 148 * analogWriteFrameOnce() and analogWriteFrame() are equivalent.
149 * 149 *
150 * \param context The I/O data structure which is passed by BeagleRT to render(). 150 * \param context The I/O data structure which is passed by Bela to render().
151 * \param frame Which frame (i.e. what time) to write the analog output. Valid values range 151 * \param frame Which frame (i.e. what time) to write the analog output. Valid values range
152 * from 0 to (context->analogFrames - 1). 152 * from 0 to (context->analogFrames - 1).
153 * \param channel Which analog output to write. Valid values are between 0 and 153 * \param channel Which analog output to write. Valid values are between 0 and
154 * (context->analogChannels - 1), typically 0 to 7 by default. 154 * (context->analogChannels - 1), typically 0 to 7 by default.
155 * \param value Value to write to the output, range 0 to 1. 155 * \param value Value to write to the output, range 0 to 1.
156 */ 156 */
157 static inline void analogWriteFrameOnce(BeagleRTContext *context, int frame, int channel, float value); 157 static inline void analogWriteFrameOnce(BelaContext *context, int frame, int channel, float value);
158 158
159 /** 159 /**
160 * \brief Read a digital input, specifying the frame number (when to read) and the pin. 160 * \brief Read a digital input, specifying the frame number (when to read) and the pin.
161 * 161 *
162 * This function returns the value of a digital input, at the time indicated by \c frame. 162 * This function returns the value of a digital input, at the time indicated by \c frame.
163 * The value is 0 if the pin is low, and nonzero if the pin is high (3.3V). 163 * The value is 0 if the pin is low, and nonzero if the pin is high (3.3V).
164 * 164 *
165 * \param context The I/O data structure which is passed by BeagleRT to render(). 165 * \param context The I/O data structure which is passed by Bela to render().
166 * \param frame Which frame (i.e. what time) to read the digital input. Valid values range 166 * \param frame Which frame (i.e. what time) to read the digital input. Valid values range
167 * from 0 to (context->digitalFrames - 1). 167 * from 0 to (context->digitalFrames - 1).
168 * \param channel Which digital pin to read. 16 pins across the P8 and P9 headers of the 168 * \param channel Which digital pin to read. 16 pins across the P8 and P9 headers of the
169 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in 169 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in
170 * digital_gpio_mapping.h. 170 * digital_gpio_mapping.h.
171 * \return Value of the digital input. 171 * \return Value of the digital input.
172 */ 172 */
173 static inline int digitalReadFrame(BeagleRTContext *context, int frame, int channel); 173 static inline int digitalReadFrame(BelaContext *context, int frame, int channel);
174 174
175 /** 175 /**
176 * \brief Write a digital output, specifying the frame number (when to write) and the pin. 176 * \brief Write a digital output, specifying the frame number (when to write) and the pin.
177 * 177 *
178 * This function sets the value of a digital output, at the time indicated by \c frame. 178 * This function sets the value of a digital output, at the time indicated by \c frame.
179 * A value of 0 sets the pin low; any other value sets the pin high (3.3V). 179 * A value of 0 sets the pin low; any other value sets the pin high (3.3V).
180 * 180 *
181 * The value written will persist for all future frames. 181 * The value written will persist for all future frames.
182 * 182 *
183 * \param context The I/O data structure which is passed by BeagleRT to render(). 183 * \param context The I/O data structure which is passed by Bela to render().
184 * \param frame Which frame (i.e. what time) to write the digital output. Valid values range 184 * \param frame Which frame (i.e. what time) to write the digital output. Valid values range
185 * from 0 to (context->digitalFrames - 1). 185 * from 0 to (context->digitalFrames - 1).
186 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the 186 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
187 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in 187 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in
188 * digital_gpio_mapping.h. 188 * digital_gpio_mapping.h.
189 * \param value Value to write to the output. 189 * \param value Value to write to the output.
190 */ 190 */
191 static inline void digitalWriteFrame(BeagleRTContext *context, int frame, int channel, int value); 191 static inline void digitalWriteFrame(BelaContext *context, int frame, int channel, int value);
192 192
193 /** 193 /**
194 * \brief Write a digital output, specifying the frame number (when to write) and the pin. 194 * \brief Write a digital output, specifying the frame number (when to write) and the pin.
195 * 195 *
196 * This function sets the value of a digital output, at the time indicated by \c frame. 196 * This function sets the value of a digital output, at the time indicated by \c frame.
198 * 198 *
199 * Unlike digitalWriteFrame(), the value written will affect \b only the frame specified, with 199 * Unlike digitalWriteFrame(), the value written will affect \b only the frame specified, with
200 * future values unchanged. This is faster than digitalWriteFrame() so is better suited 200 * future values unchanged. This is faster than digitalWriteFrame() so is better suited
201 * to applications where every frame will be written to a different value. 201 * to applications where every frame will be written to a different value.
202 * 202 *
203 * \param context The I/O data structure which is passed by BeagleRT to render(). 203 * \param context The I/O data structure which is passed by Bela to render().
204 * \param frame Which frame (i.e. what time) to write the digital output. Valid values range 204 * \param frame Which frame (i.e. what time) to write the digital output. Valid values range
205 * from 0 to (context->digitalFrames - 1). 205 * from 0 to (context->digitalFrames - 1).
206 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the 206 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
207 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in 207 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in
208 * digital_gpio_mapping.h. 208 * digital_gpio_mapping.h.
209 * \param value Value to write to the output. 209 * \param value Value to write to the output.
210 */ 210 */
211 static inline void digitalWriteFrameOnce(BeagleRTContext *context, int frame, int channel, int value); 211 static inline void digitalWriteFrameOnce(BelaContext *context, int frame, int channel, int value);
212 212
213 /** 213 /**
214 * \brief Set the direction of a digital pin to input or output. 214 * \brief Set the direction of a digital pin to input or output.
215 * 215 *
216 * This function sets the direction of a digital pin, at the time indicated by \c frame. 216 * This function sets the direction of a digital pin, at the time indicated by \c frame.
217 * Valid values are \c INPUT and \c OUTPUT. All pins begin as inputs by default. 217 * Valid values are \c INPUT and \c OUTPUT. All pins begin as inputs by default.
218 * 218 *
219 * The value written will persist for all future frames. 219 * The value written will persist for all future frames.
220 * 220 *
221 * \param context The I/O data structure which is passed by BeagleRT to render(). 221 * \param context The I/O data structure which is passed by Bela to render().
222 * \param frame Which frame (i.e. what time) to set the pin direction. Valid values range 222 * \param frame Which frame (i.e. what time) to set the pin direction. Valid values range
223 * from 0 to (context->digitalFrames - 1). 223 * from 0 to (context->digitalFrames - 1).
224 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the 224 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
225 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in 225 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in
226 * digital_gpio_mapping.h. 226 * digital_gpio_mapping.h.
227 * \param value Direction of the pin (\c INPUT or \c OUTPUT). 227 * \param value Direction of the pin (\c INPUT or \c OUTPUT).
228 */ 228 */
229 static inline void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode); 229 static inline void pinModeFrame(BelaContext *context, int frame, int channel, int mode);
230 230
231 /** 231 /**
232 * \brief Set the direction of a digital pin to input or output. 232 * \brief Set the direction of a digital pin to input or output.
233 * 233 *
234 * This function sets the direction of a digital pin, at the time indicated by \c frame. 234 * This function sets the direction of a digital pin, at the time indicated by \c frame.
235 * Valid values are \c INPUT and \c OUTPUT. All pins begin as inputs by default. 235 * Valid values are \c INPUT and \c OUTPUT. All pins begin as inputs by default.
236 * 236 *
237 * The value written will affect only the specified frame. 237 * The value written will affect only the specified frame.
238 * 238 *
239 * \param context The I/O data structure which is passed by BeagleRT to render(). 239 * \param context The I/O data structure which is passed by Bela to render().
240 * \param frame Which frame (i.e. what time) to set the pin direction. Valid values range 240 * \param frame Which frame (i.e. what time) to set the pin direction. Valid values range
241 * from 0 to (context->digitalFrames - 1). 241 * from 0 to (context->digitalFrames - 1).
242 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the 242 * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
243 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in 243 * BeagleBone Black are available. See the constants P8_xx and P9_xx defined in
244 * digital_gpio_mapping.h. 244 * digital_gpio_mapping.h.
245 * \param value Direction of the pin (\c INPUT or \c OUTPUT). 245 * \param value Direction of the pin (\c INPUT or \c OUTPUT).
246 */ 246 */
247 static inline void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode); 247 static inline void pinModeFrameOnce(BelaContext *context, int frame, int channel, int mode);
248 248
249 /** @} */ 249 /** @} */
250 250
251 #else 251 #else
252 252
333 333
334 /** @} */ 334 /** @} */
335 // audioReadFrame() 335 // audioReadFrame()
336 // 336 //
337 // Returns the value of the given audio input at the given frame number. 337 // Returns the value of the given audio input at the given frame number.
338 static inline float audioReadFrame(BeagleRTContext *context, int frame, int channel) { 338 static inline float audioReadFrame(BelaContext *context, int frame, int channel) {
339 return context->audioIn[frame * context->audioChannels + channel]; 339 return context->audioIn[frame * context->audioChannels + channel];
340 } 340 }
341 341
342 // audioWriteFrame() 342 // audioWriteFrame()
343 // 343 //
344 // Sets a given audio output channel to a value for the current frame 344 // Sets a given audio output channel to a value for the current frame
345 static inline void audioWriteFrame(BeagleRTContext *context, int frame, int channel, float value) { 345 static inline void audioWriteFrame(BelaContext *context, int frame, int channel, float value) {
346 context->audioOut[frame * context->audioChannels + channel] = value; 346 context->audioOut[frame * context->audioChannels + channel] = value;
347 } 347 }
348 348
349 // analogReadFrame() 349 // analogReadFrame()
350 // 350 //
351 // Returns the value of the given analog input at the given frame number. 351 // Returns the value of the given analog input at the given frame number.
352 static inline float analogReadFrame(BeagleRTContext *context, int frame, int channel) { 352 static inline float analogReadFrame(BelaContext *context, int frame, int channel) {
353 return context->analogIn[frame * context->analogChannels + channel]; 353 return context->analogIn[frame * context->analogChannels + channel];
354 } 354 }
355 355
356 // analogWriteFrame() 356 // analogWriteFrame()
357 // 357 //
358 // Sets a given analog output channel to a value for the current frame and, if persistent outputs are 358 // Sets a given analog output channel to a value for the current frame and, if persistent outputs are
359 // enabled, for all subsequent frames 359 // enabled, for all subsequent frames
360 static inline void analogWriteFrame(BeagleRTContext *context, int frame, int channel, float value) { 360 static inline void analogWriteFrame(BelaContext *context, int frame, int channel, float value) {
361 if(context->flags & BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST) { 361 if(context->flags & BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST) {
362 for(unsigned int f = frame; f < context->analogFrames; f++) 362 for(unsigned int f = frame; f < context->analogFrames; f++)
363 context->analogOut[frame * context->analogChannels + channel] = value; 363 context->analogOut[frame * context->analogChannels + channel] = value;
364 } 364 }
365 else 365 else
367 } 367 }
368 368
369 // analogWriteFrameOnce() 369 // analogWriteFrameOnce()
370 // 370 //
371 // Sets a given channel to a value for only the current frame 371 // Sets a given channel to a value for only the current frame
372 static inline void analogWriteFrameOnce(BeagleRTContext *context, int frame, int channel, float value) { 372 static inline void analogWriteFrameOnce(BelaContext *context, int frame, int channel, float value) {
373 context->analogOut[frame * context->analogChannels + channel] = value; 373 context->analogOut[frame * context->analogChannels + channel] = value;
374 } 374 }
375 375
376 // digitalReadFrame() 376 // digitalReadFrame()
377 // 377 //
378 // Returns the value of a given digital input at the given frame number 378 // Returns the value of a given digital input at the given frame number
379 static inline int digitalReadFrame(BeagleRTContext *context, int frame, int channel) { 379 static inline int digitalReadFrame(BelaContext *context, int frame, int channel) {
380 return getBit(context->digital[frame], channel + 16); 380 return getBit(context->digital[frame], channel + 16);
381 } 381 }
382 382
383 // digitalWriteFrame() 383 // digitalWriteFrame()
384 // 384 //
385 // Sets a given digital output channel to a value for the current frame and all subsequent frames 385 // Sets a given digital output channel to a value for the current frame and all subsequent frames
386 static inline void digitalWriteFrame(BeagleRTContext *context, int frame, int channel, int value) { 386 static inline void digitalWriteFrame(BelaContext *context, int frame, int channel, int value) {
387 for(unsigned int f = frame; f < context->digitalFrames; f++) { 387 for(unsigned int f = frame; f < context->digitalFrames; f++) {
388 if(value) 388 if(value)
389 context->digital[f] |= 1 << (channel + 16); 389 context->digital[f] |= 1 << (channel + 16);
390 else 390 else
391 context->digital[f] &= ~(1 << (channel + 16)); 391 context->digital[f] &= ~(1 << (channel + 16));
393 } 393 }
394 394
395 // digitalWriteFrameOnce() 395 // digitalWriteFrameOnce()
396 // 396 //
397 // Sets a given digital output channel to a value for the current frame only 397 // Sets a given digital output channel to a value for the current frame only
398 static inline void digitalWriteFrameOnce(BeagleRTContext *context, int frame, int channel, int value) { 398 static inline void digitalWriteFrameOnce(BelaContext *context, int frame, int channel, int value) {
399 if(value) 399 if(value)
400 context->digital[frame] |= 1 << (channel + 16); 400 context->digital[frame] |= 1 << (channel + 16);
401 else 401 else
402 context->digital[frame] &= ~(1 << (channel + 16)); 402 context->digital[frame] &= ~(1 << (channel + 16));
403 } 403 }
404 404
405 // pinModeFrame() 405 // pinModeFrame()
406 // 406 //
407 // Sets the direction of a digital pin for the current frame and all subsequent frames 407 // Sets the direction of a digital pin for the current frame and all subsequent frames
408 static inline void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode) { 408 static inline void pinModeFrame(BelaContext *context, int frame, int channel, int mode) {
409 for(unsigned int f = frame; f < context->digitalFrames; f++) { 409 for(unsigned int f = frame; f < context->digitalFrames; f++) {
410 if(mode == INPUT) 410 if(mode == INPUT)
411 context->digital[f] |= (1 << channel); 411 context->digital[f] |= (1 << channel);
412 else 412 else
413 context->digital[f] &= ~(1 << channel); 413 context->digital[f] &= ~(1 << channel);
415 } 415 }
416 416
417 // pinModeFrameOnce() 417 // pinModeFrameOnce()
418 // 418 //
419 // Sets the direction of a digital pin for the current frame only 419 // Sets the direction of a digital pin for the current frame only
420 static inline void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode) { 420 static inline void pinModeFrameOnce(BelaContext *context, int frame, int channel, int mode) {
421 if(mode == INPUT) 421 if(mode == INPUT)
422 context->digital[frame] |= (1 << channel); 422 context->digital[frame] |= (1 << channel);
423 else 423 else
424 context->digital[frame] &= ~(1 << channel); 424 context->digital[frame] &= ~(1 << channel);
425 } 425 }