Pages: 1 [2]   Go Down
Author Topic: Arduino Due Task Scheduler  (Read 10150 times)
0 Members and 1 Guest are viewing this topic.
North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 52
Posts: 1778
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

From what I can tell, yield has a similar effect to the task actually exiting; it simply moves focus to the next task. I don't think you even need to use it in some circumstances. 'suspend()' may be a better name.

It is handy for breaking a 'long' operation; for example calculating PI to 6000 places in one hit halts everything else on the system for quite some time.

Data buffers could overflow if they aren't read often enough; SPI may be interrupt driven, but the code using it may not be, and will require a slice of time to act on the data.
« Last Edit: November 14, 2012, 09:59:55 pm by pYro_65 » Logged


0
Offline Offline
God Member
*****
Karma: 24
Posts: 586
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, yield() is useful if you write a program than does a lot of work and you care about letting other stuff run.

But its main purpose is for libraries that wait.  For example, inside Serial.print(), if the transmit buffer is full, yield() is called while it waits for space in the buffer.
Logged

Pages: 1 [2]   Go Up
Jump to: