Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
16:744ce85aede2
Parent:
15:f2569d8e4176
Child:
21:ce51bb0ba4a5
--- a/SnConstants.h	Fri Aug 31 02:09:09 2012 +0000
+++ b/SnConstants.h	Wed Sep 12 04:47:22 2012 +0000
@@ -7,6 +7,8 @@
 // constants
 //
 static const uint32_t kBStime           = 946684800u; // 1/1/2000 00:00:00 UTC
+static const double   kIridEpoch        = 1173325835; // 2007-3-08 03:50:35 GMT (needs to be a double)
+static const double   kSecPerIridTick   = 90e-3; // 90ms/tick
 static const uint32_t kWDFailsafe       = 1200u;
 static const uint8_t  kNchans           = 4u;
 static const uint8_t  kNsamps           = 128u;
@@ -15,24 +17,34 @@
 static const uint16_t kNoTrigPla        = 0x0000u;
 static const uint8_t  kNcomms           = 1u;
 static const uint16_t kNvoltsAve        = 500u; // must be greater than ~10 (but not checked. <2 will result in divide by 0)
+static const float    kAsfClkPrdUs      = 8.535; // us -- change kAdcToMBtimeCut if this is <=2us
+
 
 static const uint32_t kAbsMaxTimer      = 1800u; // timers use integers counting us and can't go longer than ~ this many secs
 // NOTE: these times below must be less than kAbsMaxTimer (this is not checked, however)
+static const uint32_t kDefTimeout       = 300u;  // seconds
 static const uint32_t kConnectTimeout   = 30u;   // seconds
 static const uint32_t kListenTimeout    = 30u;   // seconds
-static const uint32_t kConnectTOSBD     = 300u;  // seconds
+static const uint32_t kConnectSBDTO     = 300u;  // seconds
 static const uint32_t kCommWinLongPrdTk = 300u;  // seconds
-static const uint32_t kSecsPerYear      = 3600u*24u*365u;
+static const uint32_t kSecsPerDay       = 3600u*24u;
+static const uint32_t kSecsPerYear      = kSecsPerDay*365u;
 
 static const uint16_t kTotSamps         = kNchans*kNsamps;
 static const uint16_t kTotDacs          = kNchans*kNfpgaDacs;
 
+static const float    kAdcToMBtimeCut   = (kNsamps*kAsfClkPrdUs)+(kAsfClkPrdUs/2.0);
+
 enum ESnTrgTypes {
-    kThmTrg=0, kFrcTrg=1, kExtTrg=2,
+    kThmTrg=0,
+    kFrcTrg,
+    kExtTrg,
+    kAdcToMBflag,
+    
     kNumTrgs
 };
-
-static const uint8_t kTrgBW[kNumTrgs]  = { BIT(0), BIT(1), BIT(2) };
+                                          // order must match ESnTrgTypes
+static const uint8_t kTrgBW[kNumTrgs] = { BIT(0), BIT(1), BIT(2), BIT(7) };