#include <cmath>
#include <libraries/Trill/Trill.h>
#include <libraries/Gui/Gui.h>
float gTouchPosition[2] = { 0.0 , 0.0 };
float gTouchSize = 0.0;
unsigned int gTaskSleepTime = 12000;
float gTimePeriod = 0.015;
void loop(void*)
{
{
touchSensor.readI2C();
gTouchSize = touchSensor.compoundTouchSize();
gTouchPosition[0] = touchSensor.compoundTouchHorizontalLocation();
gTouchPosition[1] = touchSensor.compoundTouchLocation();
usleep(gTaskSleepTime);
}
}
{
fprintf(stderr, "Unable to initialise Trill Hex\n");
return false;
}
return true;
}
{
static unsigned int count = 0;
for(
unsigned int n = 0; n < context->
audioFrames; n++) {
{
gui.sendBuffer(0, gTouchPosition);
gui.sendBuffer(1, gTouchSize);
count = 0;
}
count ++;
}
}
{}
A class to use the Trill family of capacitive sensors. http://bela.io/trill.
Definition Trill.h:14
void printDetails()
Definition Trill.cpp:492
@ HEX
Trill Hex
Definition Trill.h:38
AuxiliaryTask Bela_runAuxiliaryTask(void(*callback)(void *), int priority=0, void *arg=nullptr)
Create and start an AuxiliaryTask.
int Bela_stopRequested()
Check whether the program should stop.
void render(BelaContext *context, void *userData)
User-defined callback function to process audio and sensor data.
Definition render.cpp:68
bool setup(BelaContext *context, void *userData)
User-defined initialisation function which runs before audio rendering begins.
Definition render.cpp:51
void cleanup(BelaContext *context, void *userData)
User-defined cleanup function which runs when the program finishes.
Definition render.cpp:96
Structure holding audio and sensor settings and pointers to I/O data buffers.
Definition Bela.h:231
const uint32_t audioFrames
The number of audio frames per block.
Definition Bela.h:322
char projectName[MAX_PROJECTNAME_LENGTH]
Name of running project.
Definition Bela.h:417
const float audioSampleRate
The audio sample rate in Hz (currently always 44100.0).
Definition Bela.h:328