Utilities.h File Reference

Wiring-inspired utility functions and macros. More...

#include "Bela.h"
Include dependency graph for Utilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INPUT   0x0
 
#define OUTPUT   0x1
 

Functions

static float map (float x, float in_min, float in_max, float out_min, float out_max)
 Linearly rescale a number from one range of values to another. More...
 
static float constrain (float x, float min_val, float max_val)
 Constrain a number to stay within a given range. More...
 
static float min (float x, float y)
 Returns the maximum of two numbers. More...
 
static float max (float x, float y)
 Returns the minimum of two numbers. More...
 
static float audioRead (BelaContext *context, int frame, int channel)
 Read an audio input, specifying the frame number (when to read) and the channel. More...
 
static void audioWrite (BelaContext *context, int frame, int channel, float value)
 Write an audio output, specifying the frame number (when to write) and the channel. More...
 
static float analogRead (BelaContext *context, int frame, int channel)
 Read an analog input, specifying the frame number (when to read) and the channel. More...
 
static void analogWrite (BelaContext *context, int frame, int channel, float value)
 Write an analog output, specifying the frame number (when to write) and the channel. More...
 
static void analogWriteOnce (BelaContext *context, int frame, int channel, float value)
 Write an analog output, specifying the frame number (when to write) and the channel. More...
 
static int digitalRead (BelaContext *context, int frame, int channel)
 Read a digital input, specifying the frame number (when to read) and the pin. More...
 
static void digitalWrite (BelaContext *context, int frame, int channel, int value)
 Write a digital output, specifying the frame number (when to write) and the pin. More...
 
static void digitalWriteOnce (BelaContext *context, int frame, int channel, int value)
 Write a digital output, specifying the frame number (when to write) and the pin. More...
 
static void pinMode (BelaContext *context, int frame, int channel, int mode)
 Set the direction of a digital pin to input or output. More...
 
static void pinModeOnce (BelaContext *context, int frame, int channel, int mode)
 Set the direction of a digital pin to input or output. More...
 

Detailed Description

Wiring-inspired utility functions and macros.

Macros and functions for I/O and data processing taking after the Wiring (Arduino) language. This code began as part of the Hackable Instruments project (EPSRC) at Queen Mary University of London, 2013-14.

(c) 2014-15 Andrew McPherson, Victor Zappi and Giulio Moro, Queen Mary University of London