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
Add polling routine XK-AUDIO-216-MC Topic is solved
-
- Member++
- Posts: 21
- Joined: Fri May 05, 2017 1:39 pm
-
Verified
- XCore Legend
- Posts: 1156
- Joined: Thu May 27, 2010 10:08 am
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
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
Engineer at XMOS
-
- Member++
- Posts: 21
- Joined: Fri May 05, 2017 1:39 pm
Works!, I missed that there were user_main.h/USER_MAIN_CORES already prepared for this. Thanks!
-
Verified
- XCore Legend
- Posts: 1156
- Joined: Thu May 27, 2010 10:08 am
great news! Thanks for taking the time to feed this back. Hopefully this may help others.Works
Engineer at XMOS