Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
3:24c5f0f50bf1
Parent:
1:e392595b4b76
Child:
8:95a325df1f6b
--- a/SnEventFrame.cpp	Tue Jul 24 02:07:23 2012 +0000
+++ b/SnEventFrame.cpp	Tue Jul 31 04:59:16 2012 +0000
@@ -4,14 +4,17 @@
 
 const uint8_t     SnEventFrame::kIOVers = 1;   // MUST BE INCREASED if any member var changes (==> also if kNchans, etc. change!)
 
-void SnEventFrame::ReadFrom(const char* const buf,
-                            const uint8_t loseLSB, const uint8_t loseMSB,
-                            const uint16_t wvBaseline) {
+const char* SnEventFrame::ReadFrom(const char* const buf,
+                                   const uint8_t loseLSB, const uint8_t loseMSB,
+                                   const uint16_t wvBaseline) {
     // no check on the length of buf is done here
     // that should be been done already
     //
     // must match ::WriteToBuf
     
+    // NOTE: on the mbed, this is reduntant (char is unsigned)
+    // but this way, the block can be copied to other computers
+    // and still work.
     union Usub {
         const char* s;
         const uint8_t* u;
@@ -30,16 +33,20 @@
         b.s       = SnBitUtils::ReadFrom(b.s, fCRC);
     }
     
+    return b.s;
 }
 
-void SnEventFrame::WriteTo(char* const buf,
-                           const uint8_t loseLSB, const uint8_t loseMSB,
-                           const uint16_t wvBaseline) const {
+char* SnEventFrame::WriteTo(char* const buf,
+                            const uint8_t loseLSB, const uint8_t loseMSB,
+                            const uint16_t wvBaseline) const {
     // no check on the length of the buf is done here
     // that should be done already
     //
     // must match ReadFromBuf
     
+    // NOTE: on the mbed, this is reduntant (char is unsigned)
+    // but this way, the block can be copied to other computers
+    // and still work.
     union {
         char* s;
         uint8_t* u;
@@ -55,7 +62,8 @@
     b.s           = SnBitUtils::WriteTo(b.s, fTrgBits);
     b.u           = PackWavef(b.u, fData, loseLSB, loseMSB, wvBaseline);
     b.s           = SnBitUtils::WriteTo(b.s, fCRC);
-
+    
+    return b.s;
 }
 
 void SnEventFrame::CalcCRC() {