Initial commit
Dependencies: ConfigFile FXOS8700CQ M2XStreamClient-JMF MODSERIAL SDFileSystem WNCInterface jsonlite mbed-rtos mbed
Fork of StarterKit_M2X_DevLab by
sensors.h@4:08979e323c6e, 2017-04-05 (annotated)
- Committer:
- jk431j
- Date:
- Wed Apr 05 04:53:25 2017 +0000
- Revision:
- 4:08979e323c6e
- Child:
- 5:8099493f2c35
Added sensor reading and M2X command handling,
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jk431j | 4:08979e323c6e | 1 | /* =================================================================== |
jk431j | 4:08979e323c6e | 2 | Copyright © 2016, AVNET Inc. |
jk431j | 4:08979e323c6e | 3 | |
jk431j | 4:08979e323c6e | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
jk431j | 4:08979e323c6e | 5 | you may not use this file except in compliance with the License. |
jk431j | 4:08979e323c6e | 6 | You may obtain a copy of the License at |
jk431j | 4:08979e323c6e | 7 | |
jk431j | 4:08979e323c6e | 8 | http://www.apache.org/licenses/LICENSE-2.0 |
jk431j | 4:08979e323c6e | 9 | |
jk431j | 4:08979e323c6e | 10 | Unless required by applicable law or agreed to in writing, |
jk431j | 4:08979e323c6e | 11 | software distributed under the License is distributed on an |
jk431j | 4:08979e323c6e | 12 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
jk431j | 4:08979e323c6e | 13 | either express or implied. See the License for the specific |
jk431j | 4:08979e323c6e | 14 | language governing permissions and limitations under the License. |
jk431j | 4:08979e323c6e | 15 | |
jk431j | 4:08979e323c6e | 16 | ======================================================================== */ |
jk431j | 4:08979e323c6e | 17 | |
jk431j | 4:08979e323c6e | 18 | #ifndef __SENSORS_H_ |
jk431j | 4:08979e323c6e | 19 | #define __SENSORS_H_ |
jk431j | 4:08979e323c6e | 20 | |
jk431j | 4:08979e323c6e | 21 | //******************************************************************************************************************************************** |
jk431j | 4:08979e323c6e | 22 | //* Create string with sensor readings that can be sent to flow as an HTTP get |
jk431j | 4:08979e323c6e | 23 | //******************************************************************************************************************************************** |
jk431j | 4:08979e323c6e | 24 | |
jk431j | 4:08979e323c6e | 25 | void sensors_init(void); |
jk431j | 4:08979e323c6e | 26 | void read_sensors(void); |
jk431j | 4:08979e323c6e | 27 | void ProcessUsbInterface(void); |
jk431j | 4:08979e323c6e | 28 | |
jk431j | 4:08979e323c6e | 29 | #define SENSOR_FIELD_LEN_LIMIT 32 |
jk431j | 4:08979e323c6e | 30 | typedef struct |
jk431j | 4:08979e323c6e | 31 | { |
jk431j | 4:08979e323c6e | 32 | char Temperature[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 33 | char Humidity[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 34 | char AccelX[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 35 | char AccelY[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 36 | char AccelZ[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 37 | char MagnetometerX[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 38 | char MagnetometerY[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 39 | char MagnetometerZ[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 40 | char AmbientLightVis[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 41 | char AmbientLightIr[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 42 | char UVindex[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 43 | char Proximity[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 44 | char Temperature_Si7020[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 45 | char Humidity_Si7020[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 46 | char Virtual_Sensor1[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 47 | char Virtual_Sensor2[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 48 | char Virtual_Sensor3[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 49 | char Virtual_Sensor4[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 50 | char Virtual_Sensor5[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 51 | char Virtual_Sensor6[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 52 | char Virtual_Sensor7[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 53 | char Virtual_Sensor8[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 54 | char GPS_Satellites[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 55 | char GPS_Latitude[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 56 | char GPS_Longitude[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 57 | char GPS_Altitude[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 58 | char GPS_Speed[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 59 | char GPS_Course[SENSOR_FIELD_LEN_LIMIT]; |
jk431j | 4:08979e323c6e | 60 | float fTemperature; |
jk431j | 4:08979e323c6e | 61 | float fHumidity; |
jk431j | 4:08979e323c6e | 62 | } K64F_Sensors_t ; |
jk431j | 4:08979e323c6e | 63 | |
jk431j | 4:08979e323c6e | 64 | extern K64F_Sensors_t SENSOR_DATA; |
jk431j | 4:08979e323c6e | 65 | |
jk431j | 4:08979e323c6e | 66 | extern I2C i2c; //SDA, SCL -- define the I2C pins being used |
jk431j | 4:08979e323c6e | 67 | extern Serial pc; // tx, rx |
jk431j | 4:08979e323c6e | 68 | #define PRINTF pc.printf |
jk431j | 4:08979e323c6e | 69 | #define PUTS pc.puts |
jk431j | 4:08979e323c6e | 70 | #define USE_COLOR |
jk431j | 4:08979e323c6e | 71 | #ifdef USE_COLOR |
jk431j | 4:08979e323c6e | 72 | #define BLK "\033[30m" |
jk431j | 4:08979e323c6e | 73 | #define RED "\033[31m" |
jk431j | 4:08979e323c6e | 74 | #define GRN "\033[32m" |
jk431j | 4:08979e323c6e | 75 | #define YEL "\033[33m" |
jk431j | 4:08979e323c6e | 76 | #define BLU "\033[34m" |
jk431j | 4:08979e323c6e | 77 | #define MAG "\033[35m" |
jk431j | 4:08979e323c6e | 78 | #define CYN "\033[36m" |
jk431j | 4:08979e323c6e | 79 | #define WHT "\033[37m" |
jk431j | 4:08979e323c6e | 80 | #define DEF "\033[39m" |
jk431j | 4:08979e323c6e | 81 | #else |
jk431j | 4:08979e323c6e | 82 | #define BLK |
jk431j | 4:08979e323c6e | 83 | #define RED |
jk431j | 4:08979e323c6e | 84 | #define GRN |
jk431j | 4:08979e323c6e | 85 | #define YEL |
jk431j | 4:08979e323c6e | 86 | #define BLU |
jk431j | 4:08979e323c6e | 87 | #define MAG |
jk431j | 4:08979e323c6e | 88 | #define CYN |
jk431j | 4:08979e323c6e | 89 | #define WHT |
jk431j | 4:08979e323c6e | 90 | #define DEF |
jk431j | 4:08979e323c6e | 91 | #endif |
jk431j | 4:08979e323c6e | 92 | |
jk431j | 4:08979e323c6e | 93 | #endif |