]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Update to allow buffer size to be changed at compile time
authorklueska <klueska>
Mon, 3 Sep 2007 20:29:08 +0000 (20:29 +0000)
committerklueska <klueska>
Mon, 3 Sep 2007 20:29:08 +0000 (20:29 +0000)
tos/lib/printf/PrintfP.nc
tos/lib/printf/printf.h

index deda30c69a9a18d2e5a6dd38a4456bf5e8819831..c69c809a5975bba0d22b5a48b0546172c718c143 100644 (file)
@@ -69,12 +69,12 @@ implementation {
     S_STOPPED,
     S_FLUSHING,
   };
-  
+
   message_t printfMsg;
   nx_uint8_t buffer[PRINTF_BUFFER_SIZE];
   norace nx_uint8_t* next_byte;
   uint8_t state = S_STOPPED;
-  uint8_t bytes_left_to_flush;
+  uint32_t bytes_left_to_flush;
   uint8_t length_to_send;
   
   task void retrySend() {
@@ -86,7 +86,7 @@ implementation {
     printf_msg_t* m = (printf_msg_t*)call Packet.getPayload(&printfMsg, NULL);
     length_to_send = (bytes_left_to_flush < sizeof(printf_msg_t)) ? bytes_left_to_flush : sizeof(printf_msg_t);
     memset(m->buffer, 0, sizeof(printf_msg_t));
-    memcpy(m->buffer, (uint8_t*)next_byte, length_to_send);
+    memcpy(m->buffer, (nx_uint8_t*)next_byte, length_to_send);
     if(call AMSend.send(AM_BROADCAST_ADDR, &printfMsg, sizeof(printf_msg_t)) != SUCCESS)
       post retrySend();  
     else {
index a7cb005a5f44077fcaa013a7647b87e5c9e6dbb3..fcaee28001588785522711cf4ffa5400bacee993 100644 (file)
 #ifndef PRINTF_H
 #define PRINTF_H
 
+#ifndef PRINTF_BUFFER_SIZE
+#define PRINTF_BUFFER_SIZE  250
+#endif
+
 #ifdef _H_msp430hardware_h
   #include <stdio.h>
 #endif
@@ -38,8 +42,6 @@
 #endif
 #include "message.h"
 
-#define PRINTF_BUFFER_SIZE 250
-
 typedef nx_struct printf_msg {
   nx_uint8_t buffer[TOSH_DATA_LENGTH];
 } printf_msg_t;