change mbed file
Dependencies: SDFileSystem FXOS8700Q
SensorData.h@1:ea56355bccae, 2019-03-14 (annotated)
- Committer:
- zer044
- Date:
- Thu Mar 14 21:14:10 2019 +0000
- Revision:
- 1:ea56355bccae
- Parent:
- 0:8190023facdb
Turned the project into a class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oliviab | 0:8190023facdb | 1 | #include "mbed.h" |
oliviab | 0:8190023facdb | 2 | #include <string> |
oliviab | 0:8190023facdb | 3 | #include "FXOS8700Q.h" |
oliviab | 0:8190023facdb | 4 | #include "SDFileSystem.h" |
oliviab | 0:8190023facdb | 5 | |
zer044 | 1:ea56355bccae | 6 | I2C i2c(PTE25, PTE24); |
zer044 | 1:ea56355bccae | 7 | |
zer044 | 1:ea56355bccae | 8 | class SensorData |
zer044 | 1:ea56355bccae | 9 | { |
oliviab | 0:8190023facdb | 10 | |
zer044 | 1:ea56355bccae | 11 | public: |
zer044 | 1:ea56355bccae | 12 | //Constructor |
zer044 | 1:ea56355bccae | 13 | SensorData(); |
zer044 | 1:ea56355bccae | 14 | |
zer044 | 1:ea56355bccae | 15 | void initialise(); |
zer044 | 1:ea56355bccae | 16 | |
zer044 | 1:ea56355bccae | 17 | void run(); |
zer044 | 1:ea56355bccae | 18 | |
zer044 | 1:ea56355bccae | 19 | //Read in serial line and send it to log_data |
zer044 | 1:ea56355bccae | 20 | void readData(); |
zer044 | 1:ea56355bccae | 21 | |
zer044 | 1:ea56355bccae | 22 | //Read in accel and mag data |
zer044 | 1:ea56355bccae | 23 | void sensor_data(); |
zer044 | 1:ea56355bccae | 24 | |
zer044 | 1:ea56355bccae | 25 | //Logs data to /sd/sensors.txt |
zer044 | 1:ea56355bccae | 26 | void log_data(string data); |
zer044 | 1:ea56355bccae | 27 | |
zer044 | 1:ea56355bccae | 28 | string getDataString(); |
oliviab | 0:8190023facdb | 29 | |
oliviab | 0:8190023facdb | 30 | |
zer044 | 1:ea56355bccae | 31 | private: |
zer044 | 1:ea56355bccae | 32 | // Serial s_com(UART3_tx, UART3_rx); // tx, rx read gps in |
zer044 | 1:ea56355bccae | 33 | |
zer044 | 1:ea56355bccae | 34 | FILE *fp; |
zer044 | 1:ea56355bccae | 35 | SDFileSystem sd; // MOSI, MISO, SCK, CS |
zer044 | 1:ea56355bccae | 36 | Serial s_com; // tx, rx read gps in |
zer044 | 1:ea56355bccae | 37 | FXOS8700QAccelerometer acc; //access accelerometer |
zer044 | 1:ea56355bccae | 38 | FXOS8700QMagnetometer mag; |
zer044 | 1:ea56355bccae | 39 | |
zer044 | 1:ea56355bccae | 40 | char rca1[128]; |
zer044 | 1:ea56355bccae | 41 | //string rca2; |
zer044 | 1:ea56355bccae | 42 | string data; |
zer044 | 1:ea56355bccae | 43 | |
zer044 | 1:ea56355bccae | 44 | |
zer044 | 1:ea56355bccae | 45 | |
zer044 | 1:ea56355bccae | 46 | }; |