I added functionality to get the RSSI, BER, and Cell Neighbor for reporting connection issues to M2X
Dependencies: mbed FXOS8700CQ mbed-rtos WNCInterface M2XStreamClient-JMF jsonlite
sensors.h@12:0dfd0129f75d, 2019-04-18 (annotated)
- Committer:
- ng977t
- Date:
- Thu Apr 18 21:30:09 2019 +0000
- Revision:
- 12:0dfd0129f75d
- Parent:
- 5:8099493f2c35
Branched to a new project, added more documentation, and updated the config file
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 | ======================================================================== */ |
ng977t | 12:0dfd0129f75d | 17 | #include <string> |
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 | 5:8099493f2c35 | 32 | float Temperature; |
jk431j | 5:8099493f2c35 | 33 | float Humidity; |
jk431j | 5:8099493f2c35 | 34 | float AccelX; |
jk431j | 5:8099493f2c35 | 35 | float AccelY; |
jk431j | 5:8099493f2c35 | 36 | float AccelZ; |
jk431j | 5:8099493f2c35 | 37 | int MagnetometerX; |
jk431j | 5:8099493f2c35 | 38 | int MagnetometerY; |
jk431j | 5:8099493f2c35 | 39 | int MagnetometerZ; |
jk431j | 5:8099493f2c35 | 40 | int AmbientLightVis; |
jk431j | 5:8099493f2c35 | 41 | int AmbientLightIr; |
jk431j | 5:8099493f2c35 | 42 | float UVindex; |
jk431j | 5:8099493f2c35 | 43 | int Proximity; |
jk431j | 5:8099493f2c35 | 44 | float Temperature_Si7020; |
jk431j | 5:8099493f2c35 | 45 | float Humidity_Si7020; |
ng977t | 12:0dfd0129f75d | 46 | int16_t Signal_Strength; |
ng977t | 12:0dfd0129f75d | 47 | int16_t Error; |
ng977t | 12:0dfd0129f75d | 48 | string * Neighbor; |
jk431j | 4:08979e323c6e | 49 | } K64F_Sensors_t ; |
jk431j | 4:08979e323c6e | 50 | |
jk431j | 4:08979e323c6e | 51 | extern K64F_Sensors_t SENSOR_DATA; |
jk431j | 4:08979e323c6e | 52 | |
jk431j | 4:08979e323c6e | 53 | extern I2C i2c; //SDA, SCL -- define the I2C pins being used |
jk431j | 4:08979e323c6e | 54 | extern Serial pc; // tx, rx |
jk431j | 4:08979e323c6e | 55 | #define PRINTF pc.printf |
jk431j | 4:08979e323c6e | 56 | #define PUTS pc.puts |
jk431j | 4:08979e323c6e | 57 | #define USE_COLOR |
jk431j | 4:08979e323c6e | 58 | #ifdef USE_COLOR |
jk431j | 4:08979e323c6e | 59 | #define BLK "\033[30m" |
jk431j | 4:08979e323c6e | 60 | #define RED "\033[31m" |
jk431j | 4:08979e323c6e | 61 | #define GRN "\033[32m" |
jk431j | 4:08979e323c6e | 62 | #define YEL "\033[33m" |
jk431j | 4:08979e323c6e | 63 | #define BLU "\033[34m" |
jk431j | 4:08979e323c6e | 64 | #define MAG "\033[35m" |
jk431j | 4:08979e323c6e | 65 | #define CYN "\033[36m" |
jk431j | 4:08979e323c6e | 66 | #define WHT "\033[37m" |
jk431j | 4:08979e323c6e | 67 | #define DEF "\033[39m" |
jk431j | 4:08979e323c6e | 68 | #else |
jk431j | 4:08979e323c6e | 69 | #define BLK |
jk431j | 4:08979e323c6e | 70 | #define RED |
jk431j | 4:08979e323c6e | 71 | #define GRN |
jk431j | 4:08979e323c6e | 72 | #define YEL |
jk431j | 4:08979e323c6e | 73 | #define BLU |
jk431j | 4:08979e323c6e | 74 | #define MAG |
jk431j | 4:08979e323c6e | 75 | #define CYN |
jk431j | 4:08979e323c6e | 76 | #define WHT |
jk431j | 4:08979e323c6e | 77 | #define DEF |
jk431j | 4:08979e323c6e | 78 | #endif |
jk431j | 4:08979e323c6e | 79 | |
jk431j | 4:08979e323c6e | 80 | #endif |