Merck / Mbed OS SmartCap_OS5

Dependencies:   nRF51822

Committer:
sgetz7908
Date:
Fri Sep 11 19:27:20 2020 +0000
Revision:
50:8dca54c1e3fd
Parent:
49:d2bd9056426e
Child:
51:53fe9aff625a
Child:
54:bc0199198178
Changed to V1.18; Only adapt the cap on threshold just prior to going to sleep for SHIP_MODE.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgetz7908 0:cec02cf6df66 1
sgetz7908 0:cec02cf6df66 2 #ifndef MAIN_H
sgetz7908 0:cec02cf6df66 3 #define MAIN_H
sgetz7908 0:cec02cf6df66 4
sgetz7908 50:8dca54c1e3fd 5 #define FW_VERSION "V1.18" // major revisions will be 1xx, 2xx, etc.
sgetz7908 0:cec02cf6df66 6
sgetz7908 48:bb7d5118e03c 7 #define SKIP_SHIP_MODE 0 // 0=normal, 1=Test mode, where SHIP_MODE is skipped
sgetz7908 23:7ca590427f0e 8 #define UART_DEBUGGING 0 // if =1, put out debug info on the BLE_UART
sgetz7908 33:787d30671783 9 #define ENABLE_LED 0 // if =1, enable the debug LED
sgetz7908 46:b85be1ccf179 10 //#define TEST_ON_NRF51_DK 0 // if =1, configure for running on nRF51-DK board
sgetz7908 9:0b017e956142 11
sgetz7908 23:7ca590427f0e 12 //#define DARK_SAMPLE_PERIOD 15 // During manufacturing, this determines how many seconds between light_sensor samples
sgetz7908 23:7ca590427f0e 13 //#define MIN_DARK_TIME_MIN 15 // Number of minutes the unit needs to be in the dark to go into SHIP_MODE
sgetz7908 9:0b017e956142 14
fdelahan 37:0cb0a0b22b99 15 #define PERIODIC_TICK_SEC 1 // update rtc and run check cap rate
fdelahan 40:adabdb1c5abe 16 #define FAST_TICK_SEC 1 // update rtc and run check cap rate while in init and test mode
sgetz7908 26:a577c4b69fe0 17 #define EOL_TICK_SEC 10 // update rtc and run check cap rate while in EOL mode
sgetz7908 9:0b017e956142 18
fdelahan 47:a1e91dea282d 19 #define CAP_THRESHOLD_ON 42 // Cap on threshold. Lower value means it triggers more easily
fdelahan 47:a1e91dea282d 20 #define CAP_THRESHOLD_OFF 12 // Cap off threshold. Higher value means it triggers more easily
fdelahan 47:a1e91dea282d 21 #define CAP_THRESHOLD_OFF_EOL 25 // Cap off threshold for EOL to ensure bluetooth advertising - FTD 08212020
fdelahan 47:a1e91dea282d 22
sgetz7908 50:8dca54c1e3fd 23 #define CAP_THRESHOLD_ON_INITIAL 15 // initial value of adaptive cap_off threshold (Must be higher than CAPTHRESHOLD_OFF)
sgetz7908 48:bb7d5118e03c 24 #define CAP_THRESHOLD_ADAPT_RATE 192 // How fast the thresholf adapts. number 0 to 256. 256 means adapt immediately, 0 means no adapt.
sgetz7908 48:bb7d5118e03c 25 #define CAP_THRESHOLD_PERCENT_OF_PEAK 192 // What fraction of the peak on-off cap reading is used for the threshold. %*256, so 85% is .85*256=218
sgetz7908 48:bb7d5118e03c 26
fdelahan 47:a1e91dea282d 27 #define CAP_SAMPLES 2 // Number of samples used for cap sensor average - FTD 08212020
sgetz7908 46:b85be1ccf179 28
sgetz7908 46:b85be1ccf179 29 //#define CAP_THRESHOLD 25 // adjusts the sensitivity of the cap sensor. Lower value means it triggers more easily
sgetz7908 46:b85be1ccf179 30 //#define CAP_MAX_OFF_READING 1024 // if the off reading exceeds this limit, then reading is invalid and we use last valid reading
sgetz7908 23:7ca590427f0e 31
sgetz7908 35:e8fa201fe147 32 #define EOL_TIMEOUT_DAYS 31 // number of days after package is open before unit goes into EOL mode.
fdelahan 37:0cb0a0b22b99 33 #define EOL_MAX_USES 120 // number of uses after which the unit goes into EOL mode.
sgetz7908 26:a577c4b69fe0 34
fdelahan 47:a1e91dea282d 35 #define CAP_LED_OFF_DELAY 0.0035 // delay (seconds) between turning on analog power and taking a cap sensor ADC reading with the sensor LED off - FTD 08212020
fdelahan 47:a1e91dea282d 36 #define CAP_LED_ON_DELAY 0.000075 // delay (seconds) between turning on cap sensor LED and taking a cap sensor ADC reading - FTD 08212020
fdelahan 47:a1e91dea282d 37
fdelahan 39:93d6d459c76c 38 #define LIGHT_SENSE_PWRON_DELAY 0.200 // delay (seconds) between turning on light sense circuit, and taking an ADC reading.
sgetz7908 38:4b06a103c044 39
sgetz7908 38:4b06a103c044 40
sgetz7908 23:7ca590427f0e 41 extern void process_cmd(char * cmd);
sgetz7908 27:bb7247a1704e 42 extern void dataWasRead(void);
sgetz7908 2:def2c045c43a 43
sgetz7908 2:def2c045c43a 44 //******************************************************************************
sgetz7908 0:cec02cf6df66 45
sgetz7908 0:cec02cf6df66 46 #endif // #ifndef MAIN_H