Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Wed Oct 30 21:15:33 2013 +0000
Revision:
42:ac162d15e578
Parent:
40:1324da35afd4
Child:
46:07b107ad648d
no debug. afar and sbd enabled. twitter off (broken). fix so modserial does not use vtable. add CheckSignalStrength. fix Send to return bytes sent, not buffered. use SBD checksum and without union

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 40:1324da35afd4 10 // if these change, it is likely that some i/o version (config, event, etc) will need to change
uci1 40:1324da35afd4 11 static const bool kIridPwrFromAfar = false; // true if Iridium & Afar are on the same relay, false if not
uci1 1:e392595b4b76 12 static const uint32_t kBStime = 946684800u; // 1/1/2000 00:00:00 UTC
uci1 1:e392595b4b76 13 static const uint8_t kNchans = 4u;
uci1 1:e392595b4b76 14 static const uint8_t kNsamps = 128u;
uci1 1:e392595b4b76 15 static const uint8_t kNfpgaDacs = 4u;
uci1 40:1324da35afd4 16 static const uint8_t kNplasV1 = 5u;//72; // update config i/o version if this changes
uci1 40:1324da35afd4 17 static const uint8_t kNplas = kNplasV1; // update config i/o version if this changes
uci1 1:e392595b4b76 18 static const uint16_t kNoTrigPla = 0x0000u;
uci1 42:ac162d15e578 19 static const uint8_t kNcomms = 2u;
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 40:1324da35afd4 25 // NOTE: these times (in sec) must be less than kAbsMaxTimer (this is not checked, however)
uci1 40:1324da35afd4 26 static const uint8_t kDefTimeoutMin = 3u; // minutes. used in case a clock error is detected or range needs enforcing
uci1 40:1324da35afd4 27 static const uint32_t kCommWinLongPrdTk = 300u; // seconds. check if it's time for a comm win every X sec. this way comm per can be longer than Timer allows
uci1 40:1324da35afd4 28
uci1 40:1324da35afd4 29 static const uint16_t kMaxConsecCommFails = 4; // (exclusive) number of times a comm win can fail before the mbed resets
uci1 40:1324da35afd4 30
uci1 28:484943132bb0 31 // safety nets
uci1 40:1324da35afd4 32 static const uint16_t kMaxFirstSeq = 25000; // max specifiable seq number -- leave room to grow
uci1 28:484943132bb0 33 static const float kMinForcePer = 0.05; // seconds -- safety net for max force trigger rate
uci1 28:484943132bb0 34 static const uint16_t kMaxThrottlePerMs = 60000; // ms -- max time between thermal triggers
uci1 28:484943132bb0 35 static const uint16_t kMaxBatVoltLowPwr = 25000; // ADCs -- probably futile, but try to prevent it from being in low power mode always
uci1 40:1324da35afd4 36 static const uint32_t kMinCommWinPeriod = 120; // seconds -- min time between communication windows
uci1 28:484943132bb0 37 static const uint32_t kMaxCommWinPeriod = 259200; // seconds -- max time between communication windows
uci1 40:1324da35afd4 38 static const uint32_t kMinCommWinDur = 600; // seconds -- min communication window duration -- must be >= Ncomms*listen/connect timeout
uci1 28:484943132bb0 39 static const uint32_t kMaxWatchDogPer = 3600; // seconds -- max time before watchdog reset on idle
uci1 40:1324da35afd4 40 static const uint32_t kMinWatchDogPer = 300; // seconds -- min time before watchdog reset on idle
uci1 28:484943132bb0 41
uci1 1:e392595b4b76 42 static const uint16_t kTotSamps = kNchans*kNsamps;
uci1 1:e392595b4b76 43 static const uint16_t kTotDacs = kNchans*kNfpgaDacs;
uci1 1:e392595b4b76 44
uci1 16:744ce85aede2 45 static const float kAdcToMBtimeCut = (kNsamps*kAsfClkPrdUs)+(kAsfClkPrdUs/2.0);
uci1 16:744ce85aede2 46
uci1 1:e392595b4b76 47 enum ESnTrgTypes {
uci1 16:744ce85aede2 48 kThmTrg=0,
uci1 16:744ce85aede2 49 kFrcTrg,
uci1 16:744ce85aede2 50 kExtTrg,
uci1 16:744ce85aede2 51 kAdcToMBflag,
uci1 16:744ce85aede2 52
uci1 1:e392595b4b76 53 kNumTrgs
uci1 1:e392595b4b76 54 };
uci1 16:744ce85aede2 55 // order must match ESnTrgTypes
uci1 16:744ce85aede2 56 static const uint8_t kTrgBW[kNumTrgs] = { BIT(0), BIT(1), BIT(2), BIT(7) };
uci1 1:e392595b4b76 57
uci1 1:e392595b4b76 58
uci1 1:e392595b4b76 59
uci1 0:664899e0b988 60 #endif // SN_SnConstants