Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Tue Oct 16 04:47:44 2012 +0000
Revision:
22:f957c4f840ad
Child:
40:1324da35afd4
USB comm only. Make firing of comm window independent of real time clock. Add heartbeat firing time to the data stream.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uci1 22:f957c4f840ad 1 #ifndef SN_SnHeartbeatFrame
uci1 22:f957c4f840ad 2 #define SN_SnHeartbeatFrame
uci1 22:f957c4f840ad 3
uci1 22:f957c4f840ad 4 #include <stdint.h>
uci1 22:f957c4f840ad 5 #include "SnCommWin.h"
uci1 22:f957c4f840ad 6
uci1 22:f957c4f840ad 7 class SnHeartbeatFrame {
uci1 22:f957c4f840ad 8 public:
uci1 22:f957c4f840ad 9 // i/o version
uci1 22:f957c4f840ad 10 static const uint8_t kIOVers; // MUST BE INCREASED if any member var changes
uci1 22:f957c4f840ad 11 static const uint32_t kMaxSizeOf = 2u*sizeof(uint32_t);
uci1 22:f957c4f840ad 12
uci1 22:f957c4f840ad 13 public:
uci1 22:f957c4f840ad 14 SnHeartbeatFrame() {}
uci1 22:f957c4f840ad 15 virtual ~SnHeartbeatFrame() {}
uci1 22:f957c4f840ad 16
uci1 22:f957c4f840ad 17 static
uci1 22:f957c4f840ad 18 uint32_t SizeOf(const uint8_t rv) { return kMaxSizeOf; }
uci1 22:f957c4f840ad 19
uci1 22:f957c4f840ad 20 template<class T>
uci1 22:f957c4f840ad 21 static
uci1 22:f957c4f840ad 22 SnCommWin::ECommWinResult WriteTo(T& x,
uci1 22:f957c4f840ad 23 const uint32_t time,
uci1 22:f957c4f840ad 24 const uint32_t num) {
uci1 22:f957c4f840ad 25 // expect 'x' to be a MODSERIAL or a char const*
uci1 22:f957c4f840ad 26 x = SnBitUtils::WriteTo(x, time);
uci1 22:f957c4f840ad 27 x = SnBitUtils::WriteTo(x, num);
uci1 22:f957c4f840ad 28 return SnCommWin::kOkMsgSent;
uci1 22:f957c4f840ad 29 }
uci1 22:f957c4f840ad 30
uci1 22:f957c4f840ad 31 template<class T>
uci1 22:f957c4f840ad 32 static
uci1 22:f957c4f840ad 33 SnCommWin::ECommWinResult ReadFrom(T& b,
uci1 22:f957c4f840ad 34 uint32_t& time,
uci1 22:f957c4f840ad 35 uint32_t& num) {
uci1 22:f957c4f840ad 36 b = SnBitUtils::ReadFrom(b, time);
uci1 22:f957c4f840ad 37 b = SnBitUtils::ReadFrom(b, num);
uci1 22:f957c4f840ad 38 return SnCommWin::kOkWithMsg;
uci1 22:f957c4f840ad 39 }
uci1 22:f957c4f840ad 40
uci1 22:f957c4f840ad 41
uci1 22:f957c4f840ad 42 };
uci1 22:f957c4f840ad 43
uci1 22:f957c4f840ad 44 #endif // SN_SnHeartbeatFrame