I have ported my simple Round Robin Scheduler into mbed, being a cooperative scheduler the rule is 'dont wait but sleep()', to give the other tasks a slice of the cpu time (none stick code I call it).
Testing the timings out I see that doing a printf("Hello World") hangs that task thread by 15ms, a sprintf() followed by a series of putc(), followed by a sleep(), hang the thread by 1ms for each character. Understandably at 9600 baud 1 character takes about 1ms to transmit so I'm assuming that the Serial library code waits for transmitter empty, sort of understandable.
What I need is a sleepy putc(), has anyone any idea how to do this?
I have ported my simple Round Robin Scheduler into mbed, being a cooperative scheduler the rule is 'dont wait but sleep()', to give the other tasks a slice of the cpu time (none stick code I call it).
Testing the timings out I see that doing a printf("Hello World") hangs that task thread by 15ms, a sprintf() followed by a series of putc(), followed by a sleep(), hang the thread by 1ms for each character. Understandably at 9600 baud 1 character takes about 1ms to transmit so I'm assuming that the Serial library code waits for transmitter empty, sort of understandable.
What I need is a sleepy putc(), has anyone any idea how to do this?