Add polling routine XK-AUDIO-216-MC Topic is solved

New to XMOS and XCore? Get started here.
Post Reply
jorsc
Member++
Posts: 21
Joined: Fri May 05, 2017 1:39 pm

Add polling routine XK-AUDIO-216-MC

Post 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


View Solution
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post 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
jorsc
Member++
Posts: 21
Joined: Fri May 05, 2017 1:39 pm

Post by jorsc »

Works!, I missed that there were user_main.h/USER_MAIN_CORES already prepared for this. Thanks!
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Works
great news! Thanks for taking the time to feed this back. Hopefully this may help others.
Post Reply