]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/uprintf/README.txt
Add uprintf library; use it in tmimsp platforms
[tinyos-2.x.git] / tos / lib / uprintf / README.txt
diff --git a/tos/lib/uprintf/README.txt b/tos/lib/uprintf/README.txt
new file mode 100644 (file)
index 0000000..dedf345
--- /dev/null
@@ -0,0 +1,29 @@
+The UprintC component uses the uprintf() function.  The MSP430 libc provides
+uprintf(), which can be trivially created for any other platform.  The benefits
+of uprintf are:
+
+* No internal buffer; data are written as the format string is parsed.
+* By using a pointer to a putc() function, the function is usable for
+  multiple UARTs, when appropriate.
+
+An example of using UprintC is shown below.
+
+configuration AppC {
+  ...
+  components PlatformUartC as UartC;
+  AppP.UartResource -> UartC;
+  AppP.UartByte -> UartC;
+
+  components new UprintC();
+  AppP.Uprint -> UprintC;
+  UprintC.UartByte  -> UartC;
+  ...
+}
+
+module AppP {
+  ...
+  #define cprintf(fmt, args...) uprintf(call Uprint.uptr(), fmt, ## args)
+  ...
+  cprintf("Hello, world!\r\n");
+  ...
+}