Page 1 of 1

Add polling routine XK-AUDIO-216-MC

Posted: Tue Jan 16, 2018 6:21 pm
by jorsc
As I understand, there are mainly two functions that needs to be modified for custom designs, AudioHwInit() and AudioHwConfig(). These functions are only called by the framework exactly when they are needed.

However suppose I want to add an additional function to audiohw.xc. A custom polling routine (polls a port and audio circuits). This routine should periodically be called (e.g. every 200 ms) and will also use the same I2C bus as the above functions (thus be threadsafe).

Does anyone have a suggestion how this could be added (e,g, with a timer)? Is there already an example that I'm missing? Any suggestion is appreciated as I'm a bit stuck (and new) on this....

Best regard /J

Re: Add polling routine XK-AUDIO-216-MC

Posted: Tue Jan 16, 2018 6:33 pm
by infiniteimprobability
To add a new task/thread to the system, you can follow the usermain.h bit described here:

http://www.xcore.com/viewtopic.php?f=8&t=6305

Try writing the polling routine (using a timerafter case) separately to get comfortable it works and then add it in to usb audio using the above mechanism.

https://www.xmos.com/published/how-peri ... sing-timer

Re: Add polling routine XK-AUDIO-216-MC

Posted: Wed Jan 17, 2018 11:12 am
by jorsc
Works!, I missed that there were user_main.h/USER_MAIN_CORES already prepared for this. Thanks!

Re: Add polling routine XK-AUDIO-216-MC

Posted: Thu Jan 18, 2018 3:11 pm
by infiniteimprobability
Works
great news! Thanks for taking the time to feed this back. Hopefully this may help others.