Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Wed May 29 00:20:31 2013 +0000
Revision:
37:ff95e7070f26
Parent:
36:87865913ae6f
Child:
38:9070c17536cd
SBD only and DEBUG enabled. Safety nets enabled. Protocol and Comms as separate packages. Compiles, but untested.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uci1 1:e392595b4b76 1 #ifndef SN_SnConstants
uci1 1:e392595b4b76 2 #define SN_SnConstants
uci1 1:e392595b4b76 3
uci1 1:e392595b4b76 4 #include "SnBitUtils.h"
uci1 37:ff95e7070f26 5 #include "SnCommConstants.h"
uci1 25:57b2627fe756 6
uci1 1:e392595b4b76 7 //
uci1 1:e392595b4b76 8 // constants
uci1 1:e392595b4b76 9 //
uci1 36:87865913ae6f 10 static const bool kIridAfarPwrSame = true; // true if Iridium & Afar are on the same relay, false if not
uci1 1:e392595b4b76 11 static const uint32_t kBStime = 946684800u; // 1/1/2000 00:00:00 UTC
uci1 16:744ce85aede2 12 static const double kIridEpoch = 1173325835; // 2007-3-08 03:50:35 GMT (needs to be a double)
uci1 16:744ce85aede2 13 static const double kSecPerIridTick = 90e-3; // 90ms/tick
uci1 1:e392595b4b76 14 static const uint8_t kNchans = 4u;
uci1 1:e392595b4b76 15 static const uint8_t kNsamps = 128u;
uci1 1:e392595b4b76 16 static const uint8_t kNfpgaDacs = 4u;
uci1 3:24c5f0f50bf1 17 static const uint8_t kNplas = 5u;//72;
uci1 1:e392595b4b76 18 static const uint16_t kNoTrigPla = 0x0000u;
uci1 36:87865913ae6f 19 static const uint8_t kNcomms = 1u;
uci1 8:95a325df1f6b 20 static const uint16_t kNvoltsAve = 500u; // must be greater than ~10 (but not checked. <2 will result in divide by 0)
uci1 16:744ce85aede2 21 static const float kAsfClkPrdUs = 8.535; // us -- change kAdcToMBtimeCut if this is <=2us
uci1 16:744ce85aede2 22
uci1 1:e392595b4b76 23 static const uint32_t kAbsMaxTimer = 1800u; // timers use integers counting us and can't go longer than ~ this many secs
uci1 3:24c5f0f50bf1 24
uci1 28:484943132bb0 25 // safety nets
uci1 28:484943132bb0 26 static const float kMinForcePer = 0.05; // seconds -- safety net for max force trigger rate
uci1 28:484943132bb0 27 static const uint16_t kMaxThrottlePerMs = 60000; // ms -- max time between thermal triggers
uci1 28:484943132bb0 28 static const uint16_t kMaxBatVoltLowPwr = 25000; // ADCs -- probably futile, but try to prevent it from being in low power mode always
uci1 28:484943132bb0 29 static const uint32_t kMaxCommWinPeriod = 259200; // seconds -- max time between communication windows
uci1 28:484943132bb0 30 static const uint32_t kMinCommWinDur = 300; // seconds -- min communication window duration -- must be >= Ncomms*listen/connect timeout
uci1 28:484943132bb0 31 static const uint32_t kMaxWatchDogPer = 3600; // seconds -- max time before watchdog reset on idle
uci1 28:484943132bb0 32 static const uint32_t kMinWatchDogPer = 30; // seconds -- min time before watchdog reset on idle
uci1 28:484943132bb0 33
uci1 1:e392595b4b76 34 static const uint16_t kTotSamps = kNchans*kNsamps;
uci1 1:e392595b4b76 35 static const uint16_t kTotDacs = kNchans*kNfpgaDacs;
uci1 1:e392595b4b76 36
uci1 16:744ce85aede2 37 static const float kAdcToMBtimeCut = (kNsamps*kAsfClkPrdUs)+(kAsfClkPrdUs/2.0);
uci1 16:744ce85aede2 38
uci1 1:e392595b4b76 39 enum ESnTrgTypes {
uci1 16:744ce85aede2 40 kThmTrg=0,
uci1 16:744ce85aede2 41 kFrcTrg,
uci1 16:744ce85aede2 42 kExtTrg,
uci1 16:744ce85aede2 43 kAdcToMBflag,
uci1 16:744ce85aede2 44
uci1 1:e392595b4b76 45 kNumTrgs
uci1 1:e392595b4b76 46 };
uci1 16:744ce85aede2 47 // order must match ESnTrgTypes
uci1 16:744ce85aede2 48 static const uint8_t kTrgBW[kNumTrgs] = { BIT(0), BIT(1), BIT(2), BIT(7) };
uci1 1:e392595b4b76 49
uci1 1:e392595b4b76 50
uci1 1:e392595b4b76 51
uci1 0:664899e0b988 52 #endif // SN_SnConstants