Initial commit

Dependencies:   ConfigFile FXOS8700CQ M2XStreamClient-JMF MODSERIAL SDFileSystem WNCInterface jsonlite mbed-rtos mbed

Fork of StarterKit_M2X_DevLab by Jan Korycan

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sensors.h Source File

sensors.h

00001 /* ===================================================================
00002 Copyright © 2016, AVNET Inc.  
00003 
00004 Licensed under the Apache License, Version 2.0 (the "License"); 
00005 you may not use this file except in compliance with the License.
00006 You may obtain a copy of the License at
00007 
00008    http://www.apache.org/licenses/LICENSE-2.0
00009 
00010 Unless required by applicable law or agreed to in writing, 
00011 software distributed under the License is distributed on an 
00012 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
00013 either express or implied. See the License for the specific 
00014 language governing permissions and limitations under the License.
00015 
00016 ======================================================================== */
00017 
00018 #ifndef __SENSORS_H_
00019 #define __SENSORS_H_
00020 
00021 //********************************************************************************************************************************************
00022 //* Create string with sensor readings that can be sent to flow as an HTTP get
00023 //********************************************************************************************************************************************
00024 
00025 void sensors_init(void);
00026 void read_sensors(void);
00027 void ProcessUsbInterface(void);
00028 
00029 #define SENSOR_FIELD_LEN_LIMIT  32
00030 typedef struct
00031 {
00032     float   Temperature;
00033     float   Humidity;
00034     float   AccelX;
00035     float   AccelY;
00036     float   AccelZ;
00037     int     MagnetometerX;
00038     int     MagnetometerY;
00039     int     MagnetometerZ;
00040     int     AmbientLightVis;
00041     int     AmbientLightIr;
00042     float   UVindex;
00043     int     Proximity;
00044     float   Temperature_Si7020;
00045     float   Humidity_Si7020;
00046 } K64F_Sensors_t ;
00047 
00048 extern K64F_Sensors_t  SENSOR_DATA;
00049 
00050 extern I2C i2c;    //SDA, SCL -- define the I2C pins being used
00051 extern Serial pc; // tx, rx
00052 #define PRINTF pc.printf
00053 #define PUTS   pc.puts
00054 #define USE_COLOR
00055 #ifdef USE_COLOR
00056  #define BLK "\033[30m"
00057  #define RED "\033[31m"
00058  #define GRN "\033[32m"
00059  #define YEL "\033[33m"
00060  #define BLU "\033[34m"
00061  #define MAG "\033[35m"
00062  #define CYN "\033[36m"
00063  #define WHT "\033[37m"
00064  #define DEF "\033[39m"
00065 #else
00066  #define BLK
00067  #define RED
00068  #define GRN
00069  #define YEL
00070  #define BLU
00071  #define MAG
00072  #define CYN
00073  #define WHT
00074  #define DEF
00075 #endif
00076 
00077 #endif