0

Task Scheduler
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Task Scheduler

by TeddyBonkers on Sat Sep 18, 2021 11:55 am

Hi,
Is there something like a task scheduler in CircuitPython? I'm looking for something like uasyncio or periodic timers - I need to implement a CAN-based communication protocol, and it's hard to do it without interrupts.

Thanks

TeddyBonkers
 
Posts: 9
Joined: Tue Sep 14, 2021 3:21 pm

Re: Task Scheduler

by dastels on Sat Sep 18, 2021 12:36 pm

As far as I know, CircuitPython doesn't have support for real-time programming (or interrupt driven, or concurrent). It skews toward education and hobby use. For more professional/industrial use have a look at MicroPython.

Dave

dastels
 
Posts: 7532
Joined: Tue Oct 20, 2015 3:22 pm

Re: Task Scheduler

by TeddyBonkers on Sat Sep 18, 2021 12:48 pm

Thanks Dave,

I was looking at MicroPython but I think it does not provide support for Feather M4 CAN, so I am probably stuck with the Arduino framework.

TeddyBonkers
 
Posts: 9
Joined: Tue Sep 14, 2021 3:21 pm

Re: Task Scheduler

by danhalbert on Sat Sep 18, 2021 2:55 pm

Take a look at https://github.com/WarriorOfWire/CircuitPython_async (formerly tasko), which is a library that uses async/await to provide an event loop. This is not real-time interrupts, as MicroPython provides, but it is tasking.

An even simpler library is here:
https://github.com/deshipu/meanwhile

We have had discussions about these kinds of capabilities here:
https://github.com/adafruit/circuitpython/issues/4542
https://github.com/adafruit/circuitpython/issues/1380 (discussion closed)

danhalbert
 
Posts: 2521
Joined: Tue Aug 08, 2017 12:37 pm

Re: Task Scheduler

by TeddyBonkers on Sun Sep 19, 2021 1:29 am

I think the CircuitPython_async will do the job for my case. Thanks!

TeddyBonkers
 
Posts: 9
Joined: Tue Sep 14, 2021 3:21 pm

Re: Task Scheduler

by danhalbert on Wed Sep 22, 2021 10:20 pm


danhalbert
 
Posts: 2521
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.