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