ryjobil Thanks for clearing my misunderstanding. Does code run from an AuxiliaryTask execute on DSP resources,
The code all executes on the CPU. There is not such a thing as dedicated "DSP resources".
ryjobil , but only as a lower priority task that does not block render()?
so it runs on the same "resources" (CPU) as the audio thread, but at a lower priority (as long as the priority you set is < BELA_AUDIO_PRIORITY
).
ryjobil If this is the case, then what code structure would need to be used for background operations done in Kernal mode?
A Xenomai task can switch between primary ("Xenomai") and secondary ("Linux") mode as needed. This is mostly fine for most applications, though if sometimes you just want to use just a regular thread, just create one withpthread
.
ryjobil would you agree this is a potential cause for a segfault?
no, again scheduling it while it's already running should be a no-op, so no reason for segfault, afaik.
An issue I see with the code is:
> int serial_port = open("/dev/ttyUSB0", O_RDWR); /* ttyUSB0 is the FT232 based USB2SERIAL Converter */
Is this really supposed to work? Move the call to open()
to setup()
. Currently you are opening it in both places, but the serial_port
variable used by readTouchData()
is the global one, no the one you open in setup()
.
To test if the reading work, just try to read()
(maybe in a loop?) from within setup()
, just after you cfsetospeed()
.
Also, that setup()
function should be returning true
at the end, don't you get a compiler warning?