Hello ,
I recently started working on ChibiOS. I can create a simple in ChibiOS . But now I wanted to create a periodic task which will activate at a certain period (500ms) then how can I do it in ChibiOS.
And one more thing I wanted to ask, about aperiodic task I wanted create a application where I have two Tasks ,one is periodic task activates at every 500ms and inside that I will check for a condition (lets say sensor input) if it is satisfies then I want to activate my a periodic tasks. Then how I can implement this application.
Can you please help me to design this application.
Thanks!!
Regards,
Varad Diwakar
creating periodic and aperiodic tasks
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: creating periodic and aperiodic tasks
Hi,
All tasks are the same in ChibiOS, you can do periodic or aperiodic operations inside thread functions.
There are examples for periodic tasks in the book here: http://chibios.org/dokuwiki/doku.php?id ... _threading
Look at the 3 solutions for "fixed intervals".
Your periodic task could terminate when not needed and be restarted by the aperiodic task. Alternatively you can have it waiting on a semaphore, there are several possible solutions for this.
Giovanni
All tasks are the same in ChibiOS, you can do periodic or aperiodic operations inside thread functions.
There are examples for periodic tasks in the book here: http://chibios.org/dokuwiki/doku.php?id ... _threading
Look at the 3 solutions for "fixed intervals".
Your periodic task could terminate when not needed and be restarted by the aperiodic task. Alternatively you can have it waiting on a semaphore, there are several possible solutions for this.
Giovanni
-
- Posts: 166
- Joined: Wed Jan 09, 2019 12:37 pm
- Has thanked: 19 times
- Been thanked: 31 times
Re: creating periodic and aperiodic tasks
Depending on your sensor, you could have a thread suspended with timeout (chThdSuspendTimeoutS), and have the sensor interrupt wake the thread (chThdResumeI). You can then process according to either timeout (MSG_TIMEOUT) or interrupt condition.
Mike
Mike
Who is online
Users browsing this forum: No registered users and 19 guests