* AM2321的取温度间隔得大于2s,否则,i2c会不工作了 * SimpleTimer有个bug,会导致两次快速的读温度,现在读温度函数里加了保护 * Blynk有个bug,会导致无法把数据传到服务器 * 现在可以正常工作了

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BlynkDetectDevice.h Source File

BlynkDetectDevice.h

Go to the documentation of this file.
00001 /**
00002  * @file       BlynkDetectDevice.h
00003  * @author     Volodymyr Shymanskyy
00004  * @license    This project is released under the MIT License (MIT)
00005  * @copyright  Copyright (c) 2016 Volodymyr Shymanskyy
00006  * @date       May 2016
00007  * @brief
00008  *
00009  */
00010 
00011 #ifndef BlynkDetectDevice_h
00012 #define BlynkDetectDevice_h
00013 
00014 #ifndef BLYNK_INFO_CPU
00015 
00016     /******************************************
00017      * ATmega
00018      */
00019 
00020     #if   defined(__AVR_ATmega168__)
00021     #define BLYNK_INFO_CPU      "ATmega168"
00022     #elif defined(__AVR_ATmega328P__)
00023     #define BLYNK_INFO_CPU      "ATmega328P"
00024     #elif defined(__AVR_ATmega1280__)
00025     #define BLYNK_INFO_CPU      "ATmega1280"
00026     #elif defined(__AVR_ATmega1284__)
00027     #define BLYNK_INFO_CPU      "ATmega1284"
00028     #elif defined(__AVR_ATmega2560__)
00029     #define BLYNK_INFO_CPU      "ATmega2560"
00030     #elif defined(__AVR_ATmega32U4__)
00031     #define BLYNK_INFO_CPU      "ATmega32U4"
00032     #elif defined(__SAM3X8E__)
00033     #define BLYNK_INFO_CPU      "AT91SAM3X8E"
00034 
00035     /******************************************
00036      * ATtiny
00037      */
00038 
00039     #elif defined(__AVR_ATtiny25__)
00040     #define BLYNK_INFO_CPU      "ATtiny25"
00041     #elif defined(__AVR_ATtiny45__)
00042     #define BLYNK_INFO_CPU      "ATtiny45"
00043     #elif defined(__AVR_ATtiny85__)
00044     #define BLYNK_INFO_CPU      "ATtiny85"
00045     #elif defined(__AVR_ATtiny24__)
00046     #define BLYNK_INFO_CPU      "ATtiny24"
00047     #elif defined(__AVR_ATtiny44__)
00048     #define BLYNK_INFO_CPU      "ATtiny44"
00049     #elif defined(__AVR_ATtiny84__)
00050     #define BLYNK_INFO_CPU      "ATtiny84"
00051     #elif defined(__AVR_ATtiny2313__)
00052     #define BLYNK_INFO_CPU      "ATtiny2313"
00053     #elif defined(__AVR_ATtiny4313__)
00054     #define BLYNK_INFO_CPU      "ATtiny4313"
00055     #endif
00056 #endif
00057 
00058 #ifndef BLYNK_INFO_DEVICE
00059 
00060     #if   defined(ENERGIA)
00061         #define BLYNK_INFO_DEVICE  "Energia"
00062         #define BLYNK_USE_128_VPINS
00063 
00064         #if   defined(__MSP430F5529__)
00065         #define BLYNK_INFO_CPU  "MSP430F5529"
00066         #define BLYNK_NO_FLOAT
00067         #endif
00068 
00069     #elif defined(LINUX)
00070 
00071         #define BLYNK_INFO_DEVICE  "Linux"
00072         #define BLYNK_USE_128_VPINS
00073 
00074     #elif defined(SPARK) || defined(PARTICLE)
00075 
00076         #define BLYNK_USE_128_VPINS
00077 
00078         #if PLATFORM_ID==0
00079         #define BLYNK_INFO_DEVICE  "Particle Core"
00080         #elif PLATFORM_ID==6
00081         #define BLYNK_INFO_DEVICE  "Particle Photon"
00082         #elif PLATFORM_ID==8
00083         #define BLYNK_INFO_DEVICE  "Particle P1"
00084         #elif PLATFORM_ID==9
00085         #define BLYNK_INFO_DEVICE  "Particle Ethernet"
00086         #elif PLATFORM_ID==10
00087         #define BLYNK_INFO_DEVICE  "Particle Electron"
00088         #elif PLATFORM_ID==82
00089         #define BLYNK_INFO_DEVICE  "Digistump Oak"
00090         #elif PLATFORM_ID==88
00091         #define BLYNK_INFO_DEVICE  "RedBear Duo"
00092         #elif PLATFORM_ID==103
00093         #define BLYNK_INFO_DEVICE  "Bluz"
00094         #else
00095         #warning "Cannot detect board type"
00096         #define BLYNK_INFO_DEVICE  "Particle"
00097         #endif
00098 
00099     #elif defined(MBED_LIBRARY_VERSION)
00100 
00101         #define BLYNK_INFO_DEVICE  "MBED"
00102         #define BLYNK_USE_128_VPINS
00103 
00104     #elif defined(ARDUINO) && defined(MPIDE)
00105         #define BLYNK_NO_YIELD
00106 
00107         #if   defined(_BOARD_UNO_)
00108         #define BLYNK_INFO_DEVICE  "chipKIT Uno32"
00109         #else
00110         #define BLYNK_INFO_DEVICE  "chipKIT"
00111         #endif
00112 
00113     #elif defined(ARDUINO) && defined(TEENSYDUINO)
00114 
00115         #if   defined(__MK20DX256__)
00116         #define BLYNK_INFO_DEVICE  "Teensy 3.2/3.1"
00117         #define BLYNK_USE_128_VPINS
00118         #elif   defined(__MK20DX128__)
00119         #define BLYNK_INFO_DEVICE  "Teensy 3.0"
00120         #define BLYNK_USE_128_VPINS
00121         #elif   defined(__MKL26Z64__)
00122         #define BLYNK_INFO_DEVICE  "Teensy LC"
00123         #elif   defined(ARDUINO_ARCH_AVR)
00124         #define BLYNK_INFO_DEVICE  "Teensy 2.0"
00125         #else
00126         #define BLYNK_INFO_DEVICE  "Teensy"
00127         #endif
00128 
00129     #elif defined(ARDUINO)
00130 
00131         #ifdef ESP8266
00132             #define BLYNK_USE_128_VPINS
00133         #endif
00134 
00135         /* Arduino AVR */
00136         #if   defined(ARDUINO_AVR_NANO)
00137         #define BLYNK_INFO_DEVICE  "Arduino Nano"
00138         #elif defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE)
00139         #define BLYNK_INFO_DEVICE  "Arduino Uno"
00140         #elif defined(ARDUINO_AVR_YUN)
00141         #define BLYNK_INFO_DEVICE  "Arduino Yun"
00142         #elif defined(ARDUINO_AVR_MINI)
00143         #define BLYNK_INFO_DEVICE  "Arduino Mini"
00144         #elif defined(ARDUINO_AVR_ETHERNET)
00145         #define BLYNK_INFO_DEVICE  "Arduino Ethernet"
00146         #elif defined(ARDUINO_AVR_FIO)
00147         #define BLYNK_INFO_DEVICE  "Arduino Fio"
00148         #elif defined(ARDUINO_AVR_BT)
00149         #define BLYNK_INFO_DEVICE  "Arduino BT"
00150         #elif defined(ARDUINO_AVR_PRO)
00151         #define BLYNK_INFO_DEVICE  "Arduino Pro"
00152         #elif defined(ARDUINO_AVR_NG)
00153         #define BLYNK_INFO_DEVICE  "Arduino NG"
00154         #elif defined(ARDUINO_AVR_GEMMA)
00155         #define BLYNK_INFO_DEVICE  "Arduino Gemma"
00156         #elif defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560)
00157         #define BLYNK_INFO_DEVICE  "Arduino Mega"
00158         #define BLYNK_USE_128_VPINS
00159         #elif defined(ARDUINO_AVR_ADK)
00160         #define BLYNK_INFO_DEVICE  "Arduino Mega ADK"
00161         #define BLYNK_USE_128_VPINS
00162         #elif defined(ARDUINO_AVR_LEONARDO)
00163         #define BLYNK_INFO_DEVICE  "Arduino Leonardo"
00164         #elif defined(ARDUINO_AVR_MICRO)
00165         #define BLYNK_INFO_DEVICE  "Arduino Micro"
00166         #elif defined(ARDUINO_AVR_ESPLORA)
00167         #define BLYNK_INFO_DEVICE  "Arduino Esplora"
00168         #elif defined(ARDUINO_AVR_LILYPAD)
00169         #define BLYNK_INFO_DEVICE  "Lilypad"
00170         #elif defined(ARDUINO_AVR_LILYPAD_USB)
00171         #define BLYNK_INFO_DEVICE  "Lilypad USB"
00172         #elif defined(ARDUINO_AVR_ROBOT_MOTOR)
00173         #define BLYNK_INFO_DEVICE  "Robot Motor"
00174         #elif defined(ARDUINO_AVR_ROBOT_CONTROL)
00175         #define BLYNK_INFO_DEVICE  "Robot Control"
00176 
00177         /* Arduino SAM/SAMD */
00178         #elif defined(ARDUINO_SAM_DUE)
00179         #define BLYNK_INFO_DEVICE  "Arduino Due"
00180         #define BLYNK_USE_128_VPINS
00181         #elif defined(ARDUINO_SAMD_ZERO)
00182         #define BLYNK_INFO_DEVICE  "Arduino Zero"
00183         #define BLYNK_USE_128_VPINS
00184         #elif defined(ARDUINO_SAMD_MKR1000)
00185         #define BLYNK_INFO_DEVICE  "Arduino MKR1000"
00186         #define BLYNK_USE_128_VPINS
00187 
00188         /* Intel */
00189         #elif defined(ARDUINO_GALILEO)
00190         #define BLYNK_INFO_DEVICE  "Galileo"
00191         #define BLYNK_USE_128_VPINS
00192         #elif defined(ARDUINO_GALILEOGEN2)
00193         #define BLYNK_INFO_DEVICE  "Galileo Gen2"
00194         #define BLYNK_USE_128_VPINS
00195         #elif defined(ARDUINO_EDISON)
00196         #define BLYNK_INFO_DEVICE  "Edison"
00197         #define BLYNK_USE_128_VPINS
00198         #elif defined(ARDUINO_ARCH_ARC32) // TODO
00199         #define BLYNK_INFO_DEVICE  "Arduino 101"
00200         #define BLYNK_USE_128_VPINS
00201 
00202         /* Konekt */
00203         #elif defined(ARDUINO_DASH)
00204         #define BLYNK_INFO_DEVICE  "Dash"
00205         #elif defined(ARDUINO_DASHPRO)
00206         #define BLYNK_INFO_DEVICE  "Dash Pro"
00207 
00208         /* Red Bear Lab */
00209         #elif defined(ARDUINO_RedBear_Duo)
00210         #define BLYNK_INFO_DEVICE  "RedBear Duo"
00211         #define BLYNK_USE_128_VPINS
00212         #elif defined(ARDUINO_BLEND)
00213         #define BLYNK_INFO_DEVICE  "Blend"
00214         #elif defined(ARDUINO_BLEND_MICRO_8MHZ) || defined(ARDUINO_BLEND_MICRO_16MHZ)
00215         #define BLYNK_INFO_DEVICE  "Blend Micro"
00216         #elif defined(ARDUINO_RBL_nRF51822)
00217         #define BLYNK_INFO_DEVICE  "BLE Nano"
00218 
00219         /* ESP8266 */
00220         #elif defined(ARDUINO_ESP8266_ESP01)
00221         #define BLYNK_INFO_DEVICE  "ESP8266"
00222         #elif defined(ARDUINO_ESP8266_ESP12)
00223         #define BLYNK_INFO_DEVICE  "ESP-12"
00224         #elif defined(ARDUINO_ESP8266_NODEMCU)
00225         #define BLYNK_INFO_DEVICE  "NodeMCU"
00226         #elif defined(ARDUINO_ESP8266_THING)
00227         #define BLYNK_INFO_DEVICE  "Esp Thing"
00228         #elif defined(ARDUINO_ESP8266_THING_DEV)
00229         #define BLYNK_INFO_DEVICE  "Esp Thing Dev"
00230 
00231         /* Digistump */
00232         #elif defined(ARDUINO_ESP8266_OAK)
00233         #define BLYNK_INFO_DEVICE  "Oak"
00234         #define BLYNK_USE_128_VPINS
00235         #elif defined(ARDUINO_AVR_DIGISPARK)
00236         #define BLYNK_INFO_DEVICE  "Digispark"
00237         #define BLYNK_NO_INFO
00238         #elif defined(ARDUINO_AVR_DIGISPARKPRO)
00239         #define BLYNK_INFO_DEVICE  "Digispark Pro"
00240         #define BLYNK_NO_INFO
00241 
00242         /* Microduino */
00243         #elif defined(ARDUINO_AVR_USB)
00244         #define BLYNK_INFO_DEVICE  "CoreUSB"
00245         #elif defined(ARDUINO_AVR_PLUS)
00246         #define BLYNK_INFO_DEVICE  "Core+"
00247         #elif defined(ARDUINO_AVR_RF)
00248         #define BLYNK_INFO_DEVICE  "CoreRF"
00249 
00250         /* Wildfire */
00251         #elif defined(ARDUINO_WILDFIRE_V2)
00252         #define BLYNK_INFO_DEVICE  "Wildfire V2"
00253         #define BLYNK_USE_128_VPINS
00254         #elif defined(ARDUINO_WILDFIRE_V3)
00255         #define BLYNK_INFO_DEVICE  "Wildfire V3"
00256         #define BLYNK_USE_128_VPINS
00257         #elif defined(ARDUINO_WILDFIRE_V4)
00258         #define BLYNK_INFO_DEVICE  "Wildfire V4"
00259         #define BLYNK_USE_128_VPINS
00260 
00261         /* Simblee */
00262         #elif defined(__Simblee__) // TODO: ARDUINO_SIMBLEE bug?
00263         #define BLYNK_INFO_DEVICE  "Simblee"
00264 
00265         #else
00266         #warning "Cannot detect board type"
00267         #define BLYNK_INFO_DEVICE  "Arduino"
00268         #endif
00269 
00270     #endif
00271 #endif
00272 
00273 #endif
00274