blynk & neopixelring & w7500

Fork of WIZwiki-7500_Blynk by IOP

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 // General defines
00015 
00016 #define BLYNK_STRINGIFY(x) #x
00017 #define BLYNK_TOSTRING(x) BLYNK_STRINGIFY(x)
00018 #define BLYNK_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
00019 #define BLYNK_ATTR_PACKED __attribute__ ((__packed__))
00020 #define BLYNK_NORETURN __attribute__ ((noreturn))
00021 #define BLYNK_UNUSED __attribute__((__unused__))
00022 #define BLYNK_DEPRECATED __attribute__ ((deprecated))
00023 
00024 // Causes problems on some platforms
00025 #define BLYNK_FORCE_INLINE inline //__attribute__((always_inline))
00026 
00027 #ifndef BLYNK_INFO_CPU
00028 
00029     /******************************************
00030      * ATmega
00031      */
00032 
00033     #if   defined(__AVR_ATmega168__)
00034     #define BLYNK_INFO_CPU      "ATmega168"
00035     #elif defined(__AVR_ATmega328P__)
00036     #define BLYNK_INFO_CPU      "ATmega328P"
00037     #elif defined(__AVR_ATmega1280__)
00038     #define BLYNK_INFO_CPU      "ATmega1280"
00039     #elif defined(__AVR_ATmega1284__)
00040     #define BLYNK_INFO_CPU      "ATmega1284"
00041     #elif defined(__AVR_ATmega2560__)
00042     #define BLYNK_INFO_CPU      "ATmega2560"
00043     #elif defined(__AVR_ATmega32U4__)
00044     #define BLYNK_INFO_CPU      "ATmega32U4"
00045     #elif defined(__SAM3X8E__)
00046     #define BLYNK_INFO_CPU      "AT91SAM3X8E"
00047 
00048     /******************************************
00049      * ATtiny
00050      */
00051 
00052     #elif defined(__AVR_ATtiny25__)
00053     #define BLYNK_INFO_CPU      "ATtiny25"
00054     #elif defined(__AVR_ATtiny45__)
00055     #define BLYNK_INFO_CPU      "ATtiny45"
00056     #elif defined(__AVR_ATtiny85__)
00057     #define BLYNK_INFO_CPU      "ATtiny85"
00058     #elif defined(__AVR_ATtiny24__)
00059     #define BLYNK_INFO_CPU      "ATtiny24"
00060     #elif defined(__AVR_ATtiny44__)
00061     #define BLYNK_INFO_CPU      "ATtiny44"
00062     #elif defined(__AVR_ATtiny84__)
00063     #define BLYNK_INFO_CPU      "ATtiny84"
00064     #elif defined(__AVR_ATtiny2313__)
00065     #define BLYNK_INFO_CPU      "ATtiny2313"
00066     #elif defined(__AVR_ATtiny4313__)
00067     #define BLYNK_INFO_CPU      "ATtiny4313"
00068     #endif
00069 #endif
00070 
00071 #ifndef BLYNK_INFO_DEVICE
00072 
00073     #if   defined(ENERGIA)
00074 
00075         #define BLYNK_NO_YIELD
00076         #define BLYNK_USE_128_VPINS
00077 
00078         #if   defined(ENERGIA_ARCH_MSP430)
00079             #define BLYNK_INFO_DEVICE  "LaunchPad MSP430"
00080             #define BLYNK_INFO_CPU     "MSP430"
00081             #define BLYNK_NO_FLOAT
00082         #elif defined(ENERGIA_ARCH_MSP432)
00083             #define BLYNK_INFO_DEVICE  "LaunchPad MSP432"
00084             #define BLYNK_INFO_CPU     "MSP432"
00085         #elif defined(ENERGIA_ARCH_TIVAC)
00086             #define BLYNK_INFO_DEVICE  "LaunchPad"
00087 
00088         #elif defined(ENERGIA_ARCH_CC3200)
00089             #define BLYNK_INFO_CONNECTION  "CC3200"
00090             #define BLYNK_SEND_CHUNK 64
00091             #define BLYNK_BUFFERS_SIZE 1024
00092 
00093             #if   defined(ENERGIA_CC3200_LAUNCHXL) //TODO: This is a bug in Energia IDE
00094             #define BLYNK_INFO_DEVICE  "CC32000 LaunchXL"
00095             #elif defined(ENERGIA_RedBearLab_CC3200)
00096             #define BLYNK_INFO_DEVICE  "RBL CC3200"
00097             #elif defined(ENERGIA_RedBearLab_WiFiMini)
00098             #define BLYNK_INFO_DEVICE  "RBL WiFi Mini"
00099             #elif defined(ENERGIA_RedBearLab_WiFiMicro)
00100             #define BLYNK_INFO_DEVICE  "RBL WiFi Micro"
00101             #endif
00102         #endif
00103 
00104         #if !defined(BLYNK_INFO_DEVICE)
00105         #define BLYNK_INFO_DEVICE  "Energia"
00106         #endif
00107 
00108     #elif defined(LINUX)
00109 
00110         #define BLYNK_INFO_DEVICE  "Linux"
00111         #define BLYNK_USE_128_VPINS
00112         #define BLYNK_BUFFERS_SIZE 4096
00113 
00114     #elif defined(SPARK) || defined(PARTICLE)
00115 
00116         #define BLYNK_USE_128_VPINS
00117         #define BLYNK_BUFFERS_SIZE 1024
00118 
00119         #if PLATFORM_ID==0
00120         #define BLYNK_INFO_DEVICE  "Particle Core"
00121         #undef BLYNK_BUFFERS_SIZE // Use default on Core
00122         #elif PLATFORM_ID==6
00123         #define BLYNK_INFO_DEVICE  "Particle Photon"
00124         #elif PLATFORM_ID==8
00125         #define BLYNK_INFO_DEVICE  "Particle P1"
00126         #elif PLATFORM_ID==9
00127         #define BLYNK_INFO_DEVICE  "Particle Ethernet"
00128         #elif PLATFORM_ID==10
00129         #define BLYNK_INFO_DEVICE  "Particle Electron"
00130         #elif PLATFORM_ID==31
00131         #define BLYNK_INFO_DEVICE  "Particle RPi"
00132         #elif PLATFORM_ID==82
00133         #define BLYNK_INFO_DEVICE  "Digistump Oak"
00134         #elif PLATFORM_ID==88
00135         #define BLYNK_INFO_DEVICE  "RedBear Duo"
00136         #elif PLATFORM_ID==103
00137         #define BLYNK_INFO_DEVICE  "Bluz"
00138         #else
00139         #if defined(BLYNK_DEBUG_ALL)
00140             #warning "Cannot detect board type"
00141         #endif
00142         #define BLYNK_INFO_DEVICE  "Particle"
00143         #endif
00144 
00145     #elif defined(MBED_LIBRARY_VERSION)
00146 
00147         #define BLYNK_INFO_DEVICE  "MBED"
00148         #define BLYNK_USE_128_VPINS
00149         #define BLYNK_BUFFERS_SIZE 512
00150         #define noInterrupts() __disable_irq()
00151         #define interrupts()   __enable_irq()
00152 
00153     #elif defined(ARDUINO) && defined(MPIDE)
00154         #define BLYNK_NO_YIELD
00155 
00156         #if   defined(_BOARD_UNO_)
00157         #define BLYNK_INFO_DEVICE  "chipKIT Uno32"
00158         #else
00159         #define BLYNK_INFO_DEVICE  "chipKIT"
00160         #endif
00161 
00162     #elif defined(ARDUINO) && defined(TEENSYDUINO)
00163 
00164         #if   defined(__MK66FX1M0__)
00165         #define BLYNK_INFO_DEVICE  "Teensy 3.6"
00166         #define BLYNK_USE_128_VPINS
00167         #define BLYNK_BUFFERS_SIZE 1024
00168         #elif defined(__MK64FX512__)
00169         #define BLYNK_INFO_DEVICE  "Teensy 3.5"
00170         #define BLYNK_USE_128_VPINS
00171         #define BLYNK_BUFFERS_SIZE 1024
00172         #elif defined(__MK20DX256__)
00173         #define BLYNK_INFO_DEVICE  "Teensy 3.2/3.1"
00174         #define BLYNK_USE_128_VPINS
00175         #define BLYNK_BUFFERS_SIZE 1024
00176         #elif   defined(__MK20DX128__)
00177         #define BLYNK_INFO_DEVICE  "Teensy 3.0"
00178         #define BLYNK_USE_128_VPINS
00179         #define BLYNK_BUFFERS_SIZE 1024
00180         #elif   defined(__MKL26Z64__)
00181         #define BLYNK_INFO_DEVICE  "Teensy LC"
00182         #define BLYNK_BUFFERS_SIZE 512
00183         #elif   defined(ARDUINO_ARCH_AVR)
00184         #define BLYNK_INFO_DEVICE  "Teensy 2.0"
00185         #else
00186         #define BLYNK_INFO_DEVICE  "Teensy"
00187         #endif
00188 
00189     #elif defined(ARDUINO)
00190 
00191         #if defined(ESP8266) || defined(ESP32)
00192             #define BLYNK_USE_128_VPINS
00193             #define BLYNK_BUFFERS_SIZE 1024
00194         #endif
00195 
00196         /* Arduino AVR */
00197         #if   defined(ARDUINO_AVR_NANO)
00198         #define BLYNK_INFO_DEVICE  "Arduino Nano"
00199         #elif defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE)
00200         #define BLYNK_INFO_DEVICE  "Arduino Uno"
00201         #elif defined(ARDUINO_AVR_YUN)
00202         #define BLYNK_INFO_DEVICE  "Arduino Yun"
00203         #elif defined(ARDUINO_AVR_MINI)
00204         #define BLYNK_INFO_DEVICE  "Arduino Mini"
00205         #elif defined(ARDUINO_AVR_ETHERNET)
00206         #define BLYNK_INFO_DEVICE  "Arduino Ethernet"
00207         #elif defined(ARDUINO_AVR_FIO)
00208         #define BLYNK_INFO_DEVICE  "Arduino Fio"
00209         #elif defined(ARDUINO_AVR_BT)
00210         #define BLYNK_INFO_DEVICE  "Arduino BT"
00211         #elif defined(ARDUINO_AVR_PRO)
00212         #define BLYNK_INFO_DEVICE  "Arduino Pro"
00213         #elif defined(ARDUINO_AVR_NG)
00214         #define BLYNK_INFO_DEVICE  "Arduino NG"
00215         #elif defined(ARDUINO_AVR_GEMMA)
00216         #define BLYNK_INFO_DEVICE  "Arduino Gemma"
00217         #elif defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560)
00218         #define BLYNK_INFO_DEVICE  "Arduino Mega"
00219         #define BLYNK_USE_128_VPINS
00220         #define BLYNK_BUFFERS_SIZE 1024
00221         #elif defined(ARDUINO_AVR_ADK)
00222         #define BLYNK_INFO_DEVICE  "Arduino Mega ADK"
00223         #define BLYNK_USE_128_VPINS
00224         #define BLYNK_BUFFERS_SIZE 1024
00225         #elif defined(ARDUINO_AVR_LEONARDO)
00226         #define BLYNK_INFO_DEVICE  "Arduino Leonardo"
00227         #elif defined(ARDUINO_AVR_MICRO)
00228         #define BLYNK_INFO_DEVICE  "Arduino Micro"
00229         #elif defined(ARDUINO_AVR_ESPLORA)
00230         #define BLYNK_INFO_DEVICE  "Arduino Esplora"
00231         #elif defined(ARDUINO_AVR_LILYPAD)
00232         #define BLYNK_INFO_DEVICE  "Lilypad"
00233         #elif defined(ARDUINO_AVR_LILYPAD_USB)
00234         #define BLYNK_INFO_DEVICE  "Lilypad USB"
00235         #elif defined(ARDUINO_AVR_ROBOT_MOTOR)
00236         #define BLYNK_INFO_DEVICE  "Robot Motor"
00237         #elif defined(ARDUINO_AVR_ROBOT_CONTROL)
00238         #define BLYNK_INFO_DEVICE  "Robot Control"
00239 
00240         /* Arduino SAM/SAMD */
00241         #elif defined(ARDUINO_SAM_DUE)
00242         #define BLYNK_INFO_DEVICE  "Arduino Due"
00243         #define BLYNK_USE_128_VPINS
00244         #define BLYNK_BUFFERS_SIZE 1024
00245         #elif defined(ARDUINO_SAMD_ZERO)
00246         #define BLYNK_INFO_DEVICE  "Arduino Zero"
00247         #define BLYNK_USE_128_VPINS
00248         #define BLYNK_BUFFERS_SIZE 1024
00249         #elif defined(ARDUINO_SAMD_MKR1000)
00250         #define BLYNK_INFO_DEVICE  "Arduino MKR1000"
00251         #define BLYNK_USE_128_VPINS
00252         #define BLYNK_BUFFERS_SIZE 1024
00253 
00254         /* Intel */
00255         #elif defined(ARDUINO_GALILEO)
00256         #define BLYNK_INFO_DEVICE  "Galileo"
00257         #define BLYNK_USE_128_VPINS
00258         #define BLYNK_BUFFERS_SIZE 4096
00259         #elif defined(ARDUINO_GALILEOGEN2)
00260         #define BLYNK_INFO_DEVICE  "Galileo Gen2"
00261         #define BLYNK_BUFFERS_SIZE 4096
00262         #define BLYNK_USE_128_VPINS
00263         #elif defined(ARDUINO_EDISON)
00264         #define BLYNK_INFO_DEVICE  "Edison"
00265         #define BLYNK_USE_128_VPINS
00266         #define BLYNK_BUFFERS_SIZE 4096
00267         #elif defined(ARDUINO_ARCH_ARC32)
00268         #define BLYNK_INFO_DEVICE  "Arduino 101"
00269         #define BLYNK_USE_128_VPINS
00270         #define BLYNK_BUFFERS_SIZE 1024
00271 
00272         /* Konekt */
00273         #elif defined(ARDUINO_DASH)
00274         #define BLYNK_INFO_DEVICE  "Dash"
00275         #elif defined(ARDUINO_DASHPRO)
00276         #define BLYNK_INFO_DEVICE  "Dash Pro"
00277 
00278         /* Red Bear Lab */
00279         #elif defined(ARDUINO_RedBear_Duo)
00280         #define BLYNK_INFO_DEVICE  "RedBear Duo"
00281         #define BLYNK_USE_128_VPINS
00282         #define BLYNK_BUFFERS_SIZE 1024
00283         #elif defined(ARDUINO_BLEND)
00284         #define BLYNK_INFO_DEVICE  "Blend"
00285         #elif defined(ARDUINO_BLEND_MICRO_8MHZ) || defined(ARDUINO_BLEND_MICRO_16MHZ)
00286         #define BLYNK_INFO_DEVICE  "Blend Micro"
00287         #elif defined(ARDUINO_RBL_nRF51822)
00288         #define BLYNK_INFO_DEVICE  "BLE Nano"
00289 
00290         /* ESP8266 */
00291         #elif defined(ARDUINO_ESP8266_ESP01)
00292         #define BLYNK_INFO_DEVICE  "ESP8266"
00293         #elif defined(ARDUINO_ESP8266_ESP12)
00294         #define BLYNK_INFO_DEVICE  "ESP-12"
00295         #elif defined(ARDUINO_ESP8266_NODEMCU)
00296         #define BLYNK_INFO_DEVICE  "NodeMCU"
00297         #elif defined(ARDUINO_ESP8266_THING)
00298         #define BLYNK_INFO_DEVICE  "Esp Thing"
00299         #elif defined(ARDUINO_ESP8266_THING_DEV)
00300         #define BLYNK_INFO_DEVICE  "Esp Thing Dev"
00301 
00302         /* ESP32 */
00303         #elif defined(ARDUINO_ESP32_DEV)
00304         #define BLYNK_INFO_DEVICE  "ESP32"
00305         #elif defined(ARDUINO_ESP320)
00306         #define BLYNK_INFO_DEVICE  "SweetPeas ESP320"
00307         #elif defined(ARDUINO_NANO32)
00308         #define BLYNK_INFO_DEVICE  "ESP32 Nano32"
00309         #elif defined(ARDUINO_LoLin32)
00310         #define BLYNK_INFO_DEVICE  "LoLin32"
00311         #elif defined(ARDUINO_ESPea32)
00312         #define BLYNK_INFO_DEVICE  "ESPea32"
00313         #elif defined(ARDUINO_QUANTUM)
00314         #define BLYNK_INFO_DEVICE  "Noduino Quantum"
00315 
00316         /* STM32 */
00317         #elif defined(ARDUINO_ARCH_STM32F1)
00318         #define BLYNK_INFO_DEVICE  "STM32F1"
00319         #define BLYNK_NO_YIELD
00320         #elif defined(ARDUINO_ARCH_STM32F3)
00321         #define BLYNK_INFO_DEVICE  "STM32F3"
00322         #define BLYNK_NO_YIELD
00323         #elif defined(ARDUINO_ARCH_STM32F4)
00324         #define BLYNK_INFO_DEVICE  "STM32F4"
00325         #define BLYNK_USE_128_VPINS
00326         #define BLYNK_BUFFERS_SIZE 1024
00327         #define BLYNK_NO_YIELD
00328 
00329         /* Digistump */
00330         #elif defined(ARDUINO_ESP8266_OAK)
00331         #define BLYNK_INFO_DEVICE  "Oak"
00332         #define BLYNK_USE_128_VPINS
00333         #elif defined(ARDUINO_AVR_DIGISPARK)
00334         #define BLYNK_INFO_DEVICE  "Digispark"
00335         #define BLYNK_NO_YIELD
00336         #elif defined(ARDUINO_AVR_DIGISPARKPRO)
00337         #define BLYNK_INFO_DEVICE  "Digispark Pro"
00338         #define BLYNK_NO_YIELD
00339 
00340         /* Microduino */
00341         #elif defined(ARDUINO_AVR_USB)
00342         #define BLYNK_INFO_DEVICE  "CoreUSB"
00343         #elif defined(ARDUINO_AVR_PLUS)
00344         #define BLYNK_INFO_DEVICE  "Core+"
00345         #elif defined(ARDUINO_AVR_RF)
00346         #define BLYNK_INFO_DEVICE  "CoreRF"
00347 
00348         /* Wildfire */
00349         #elif defined(ARDUINO_WILDFIRE_V2)
00350         #define BLYNK_INFO_DEVICE  "Wildfire V2"
00351         #define BLYNK_USE_128_VPINS
00352         #define BLYNK_BUFFERS_SIZE 1024
00353         #elif defined(ARDUINO_WILDFIRE_V3)
00354         #define BLYNK_INFO_DEVICE  "Wildfire V3"
00355         #define BLYNK_USE_128_VPINS
00356         #define BLYNK_BUFFERS_SIZE 1024
00357         #elif defined(ARDUINO_WILDFIRE_V4)
00358         #define BLYNK_INFO_DEVICE  "Wildfire V4"
00359         #define BLYNK_USE_128_VPINS
00360         #define BLYNK_BUFFERS_SIZE 1024
00361 
00362         /* Simblee */
00363         #elif defined(__Simblee__)
00364         #define BLYNK_INFO_DEVICE  "Simblee"
00365         #define BLYNK_USE_128_VPINS
00366         #define BLYNK_BUFFERS_SIZE 512
00367 
00368         /* RFduino */
00369         #elif defined(__RFduino__)
00370         #define BLYNK_INFO_DEVICE  "RFduino"
00371         #define BLYNK_USE_128_VPINS
00372         #define BLYNK_BUFFERS_SIZE 512
00373 
00374         /* Nordic NRF5x */
00375         #elif defined(ARDUINO_ARCH_NRF5)
00376         #define BLYNK_INFO_DEVICE  "nRF5"
00377         #define BLYNK_USE_128_VPINS
00378         #define BLYNK_BUFFERS_SIZE 512
00379 
00380         #else
00381         #if defined(BLYNK_DEBUG_ALL)
00382             #warning "Cannot detect board type"
00383         #endif
00384         #define BLYNK_INFO_DEVICE  "Arduino"
00385         #endif
00386 
00387     #endif
00388 
00389     #if !defined(BLYNK_MAX_READBYTES) && defined(BLYNK_BUFFERS_SIZE)
00390     #define BLYNK_MAX_READBYTES  BLYNK_BUFFERS_SIZE
00391     #endif
00392 
00393     #if !defined(BLYNK_MAX_SENDBYTES) && defined(BLYNK_BUFFERS_SIZE)
00394     #define BLYNK_MAX_SENDBYTES  BLYNK_BUFFERS_SIZE
00395     #endif
00396 
00397     // Print diagnostics
00398 
00399     #if defined(BLYNK_DEBUG_ALL)
00400         #if defined(BLYNK_INFO_DEVICE)
00401         #pragma message ("BLYNK_INFO_DEVICE=" BLYNK_TOSTRING(BLYNK_INFO_DEVICE))
00402         #endif
00403 
00404         #if defined(BLYNK_INFO_CPU)
00405         #pragma message ("BLYNK_INFO_CPU="    BLYNK_TOSTRING(BLYNK_INFO_CPU))
00406         #endif
00407 
00408         #if defined(BLYNK_BUFFERS_SIZE)
00409         #pragma message ("BLYNK_BUFFERS_SIZE=" BLYNK_TOSTRING(BLYNK_BUFFERS_SIZE))
00410         #endif
00411     #endif
00412 
00413 #endif
00414 
00415 #endif