Repository navigation
Expand file tree
/
Copy pathmprintf-doc.html
More file actions
31 lines (27 loc) · 2.18 KB
/
Copy pathmprintf-doc.html
File metadata and controls
31 lines (27 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>mprintf documentation</title></head><body>
<h2 class="entry-title">mprintf: A thread safe printf: mprintf library</h2>
<div class="entry-content">
<p>So, I decided to take this one step further and build a library that
hides the details of the mutex and variadic macro. To use the library
you will need to:</p>
<ol><li>Go into your libraries directory and make a new directory called ‘mprintf’</li><li>Copy these two files into the new directory; mprintf.h mprintf.cpp</li><li>Put the #include <mprintf.h> and #include <cserial.h> into all the sketches or programs that will be using mprintf.</li><li>Put the following two statements at the beginning of your setup() function</li></ol>
<p>serial_stdout_init(9600);<br>
mprintf_init();</p>
<p style="padding-left: 30px;">5. use mprintf the same way you would use printf</p>
<p style="padding-left: 30px;">example: mprintf(“hello world\n”);</p>
<p style="padding-left: 30px; text-align: left;">Update:<em> 20100118:
make sure your freeRTOS task has more then the minimum stack. mprintf
will not work properly for some value conversions (like int or decimal
or anything that requires addition stack depth). I increased by 2 X (2 *
configMINIMAL_STACK_SIZE) and all is well for a while. I’m working on
getting some kind of high water stack report by task so we can see when
things are getting read to blow up!). Note, tasks use stack for their
local variables. Global variables (not welcome) are safer until a good
method of reporting predicted stack usage can be generated from the
compiler. Thoughts? send them to me!<br>
</em></p>
<p style="padding-left: 30px; text-align: left;"><em>source : <a href="http://www.out--there.com/blog/mprintf-a-thread-safe-printf-mprintf-library/">http://www.out--there.com/blog/mprintf-a-thread-safe-printf-mprintf-library/<br>
</a>date : </em><abbr class="published" title="2010-01-12T22:38:25+0000">Tuesday, January 12, 2010</abbr></p>
</div>
</body></html>