I'm thinking it would be nice to be able to call fprintf() and print directly to a serial port on the AVR. I don't know if there's already support for this or not.
Otherwise, I have to either malloc() or permanently assign space for a buffer to build the string (either statically, or by statically allocating a bigger stack). I figure internally, fprintf() outputs a byte at a time into the FILE structure, I just have to associate one with a call to sdWrite() somehow.
Any suggestions?
TIA!
fprintf() to serial port on AVR
Moderator: tfAteba
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: fprintf() to serial port on AVR
You should read the WinAVR C library documentation, I did something like that for ARM using newlib, a mechanism must exist for WinAVR too.
Be careful that the prinft-like functions can eat a lot of stack space.
Giovanni
Be careful that the prinft-like functions can eat a lot of stack space.
Giovanni