Network, SD, Readall. comments added
Dependencies: Peripherals Buffer_lib_v2 SD_Lib_EffedUP_ERP Time_Lib_v2 Year3_Version5 BMP280 Network_Lib TextLCD BME280
main.cpp@19:8c5615d0768d, 2019-01-18 (annotated)
- Committer:
- emilytrembeth
- Date:
- Fri Jan 18 18:43:21 2019 +0000
- Revision:
- 19:8c5615d0768d
- Parent:
- 18:91285f9cfdb2
- Child:
- 20:15f22e814788
Time is now a thread, so it updates in the background
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
noutram | 0:90e393878517 | 1 | #include "mbed.h" |
emilytrembeth | 4:da63962bc0f1 | 2 | #include "TextLCD.h" |
emilytrembeth | 4:da63962bc0f1 | 3 | #include "SDBlockDevice.h" |
emilytrembeth | 4:da63962bc0f1 | 4 | #include "FATFileSystem.h" |
erolleyparnell | 8:dde5976445b4 | 5 | #include "thread_functions.hpp" |
erolleyparnell | 11:799025124e87 | 6 | #include "SD_functions.hpp" |
erolleyparnell | 11:799025124e87 | 7 | #include "peripherals.hpp" |
emilytrembeth | 15:00422efe0550 | 8 | #include "Network.hpp" |
emilytrembeth | 19:8c5615d0768d | 9 | #include "time_functions.hpp" |
emilytrembeth | 5:60e116a1e913 | 10 | |
erolleyparnell | 13:a89d4591af3f | 11 | #ifndef SD_Present |
erolleyparnell | 13:a89d4591af3f | 12 | #define SD_Present |
erolleyparnell | 13:a89d4591af3f | 13 | #endif |
erolleyparnell | 13:a89d4591af3f | 14 | |
erolleyparnell | 13:a89d4591af3f | 15 | #ifndef DEBUG |
erolleyparnell | 13:a89d4591af3f | 16 | #define DEBUG |
erolleyparnell | 13:a89d4591af3f | 17 | #endif |
erolleyparnell | 13:a89d4591af3f | 18 | |
emilytrembeth | 15:00422efe0550 | 19 | //Serial pc(SERIAL_TX, SERIAL_RX); |
emilytrembeth | 4:da63962bc0f1 | 20 | time_t currentTime; |
emilytrembeth | 4:da63962bc0f1 | 21 | Mutex date_mutex; |
emilytrembeth | 5:60e116a1e913 | 22 | int setting; |
emilytrembeth | 5:60e116a1e913 | 23 | int t; |
noutram | 0:90e393878517 | 24 | |
cgogay | 16:17e8f7d4241a | 25 | Thread t1(osPriorityRealtime); //sensor thread is highest priority |
cgogay | 16:17e8f7d4241a | 26 | Thread t2(osPriorityNormal); |
cgogay | 16:17e8f7d4241a | 27 | Thread t3(osPriorityNormal); |
cgogay | 16:17e8f7d4241a | 28 | Thread t4(osPriorityNormal); |
emilytrembeth | 19:8c5615d0768d | 29 | Thread t5(osPriorityNormal); |
cgogay | 7:981670f59caf | 30 | |
cgogay | 7:981670f59caf | 31 | |
cgogay | 7:981670f59caf | 32 | //LDR sensor |
cgogay | 7:981670f59caf | 33 | AnalogIn LDD_ADC_In(A1); |
cgogay | 7:981670f59caf | 34 | float fLDR = 0.0; |
cgogay | 7:981670f59caf | 35 | float volts = 0.0; |
cgogay | 7:981670f59caf | 36 | |
emilytrembeth | 4:da63962bc0f1 | 37 | |
cgogay | 6:2ef9c06ce506 | 38 | //Main thread |
cgogay | 6:2ef9c06ce506 | 39 | int main() { |
cgogay | 6:2ef9c06ce506 | 40 | |
erolleyparnell | 11:799025124e87 | 41 | //Power On Check TODO |
emilytrembeth | 15:00422efe0550 | 42 | lcd.cls(); |
cgogay | 6:2ef9c06ce506 | 43 | |
cgogay | 17:a3cc9013316c | 44 | //FunctionSD1(); |
cgogay | 17:a3cc9013316c | 45 | |
cgogay | 6:2ef9c06ce506 | 46 | // run threads |
cgogay | 6:2ef9c06ce506 | 47 | t1.start(FunctionSensor); |
erolleyparnell | 18:91285f9cfdb2 | 48 | t2.start(FunctionSerial); |
cgogay | 17:a3cc9013316c | 49 | t3.start(FunctionSD1); |
emilytrembeth | 15:00422efe0550 | 50 | t4.start(Network); |
emilytrembeth | 19:8c5615d0768d | 51 | t5.start(UpdateTime); |
cgogay | 6:2ef9c06ce506 | 52 | } |