blynk & neopixelring & w7500
Fork of WIZwiki-7500_Blynk by
Diff: Blynk/BlynkDetectDevice.h
- Revision:
- 9:7369ec77a3ea
- Parent:
- 7:8879692d4e6c
- Child:
- 13:ed6276c0afb7
--- a/Blynk/BlynkDetectDevice.h Wed Oct 12 10:38:37 2016 +0300 +++ b/Blynk/BlynkDetectDevice.h Thu Jan 05 14:55:36 2017 +0200 @@ -11,6 +11,19 @@ #ifndef BlynkDetectDevice_h #define BlynkDetectDevice_h +// General defines + +#define BLYNK_STRINGIFY(x) #x +#define BLYNK_TOSTRING(x) BLYNK_STRINGIFY(x) +#define BLYNK_COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) +#define BLYNK_ATTR_PACKED __attribute__ ((__packed__)) +#define BLYNK_NORETURN __attribute__ ((noreturn)) +#define BLYNK_UNUSED __attribute__((__unused__)) +#define BLYNK_DEPRECATED __attribute__ ((deprecated)) + +// Causes problems on some platforms +#define BLYNK_FORCE_INLINE inline //__attribute__((always_inline)) + #ifndef BLYNK_INFO_CPU /****************************************** @@ -63,11 +76,11 @@ #define BLYNK_USE_128_VPINS #if defined(ENERGIA_ARCH_MSP430) - #define BLYNK_INFO_DEVICE "LaunchPad" + #define BLYNK_INFO_DEVICE "LaunchPad MSP430" #define BLYNK_INFO_CPU "MSP430" #define BLYNK_NO_FLOAT #elif defined(ENERGIA_ARCH_MSP432) - #define BLYNK_INFO_DEVICE "LaunchPad" + #define BLYNK_INFO_DEVICE "LaunchPad MSP432" #define BLYNK_INFO_CPU "MSP432" #elif defined(ENERGIA_ARCH_TIVAC) #define BLYNK_INFO_DEVICE "LaunchPad" @@ -75,9 +88,10 @@ #elif defined(ENERGIA_ARCH_CC3200) #define BLYNK_INFO_CONNECTION "CC3200" #define BLYNK_SEND_CHUNK 64 + #define BLYNK_BUFFERS_SIZE 1024 - #if defined(ENERGIA_CC3200-LAUNCHXL) - #define BLYNK_INFO_DEVICE "CC32000-LanuchXL" + #if defined(ENERGIA_CC3200_LAUNCHXL) //TODO: This is a bug in Energia IDE + #define BLYNK_INFO_DEVICE "CC32000 LaunchXL" #elif defined(ENERGIA_RedBearLab_CC3200) #define BLYNK_INFO_DEVICE "RBL CC3200" #elif defined(ENERGIA_RedBearLab_WiFiMini) @@ -95,13 +109,16 @@ #define BLYNK_INFO_DEVICE "Linux" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 4096 #elif defined(SPARK) || defined(PARTICLE) #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #if PLATFORM_ID==0 #define BLYNK_INFO_DEVICE "Particle Core" + #undef BLYNK_BUFFERS_SIZE // Use default on Core #elif PLATFORM_ID==6 #define BLYNK_INFO_DEVICE "Particle Photon" #elif PLATFORM_ID==8 @@ -117,7 +134,9 @@ #elif PLATFORM_ID==103 #define BLYNK_INFO_DEVICE "Bluz" #else - #warning "Cannot detect board type" + #if defined(BLYNK_DEBUG_ALL) + #warning "Cannot detect board type" + #endif #define BLYNK_INFO_DEVICE "Particle" #endif @@ -125,6 +144,7 @@ #define BLYNK_INFO_DEVICE "MBED" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 512 #define noInterrupts() __disable_irq() #define interrupts() __enable_irq() @@ -139,14 +159,25 @@ #elif defined(ARDUINO) && defined(TEENSYDUINO) - #if defined(__MK20DX256__) + #if defined(__MK66FX1M0__) + #define BLYNK_INFO_DEVICE "Teensy 3.6" + #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 + #elif defined(__MK64FX512__) + #define BLYNK_INFO_DEVICE "Teensy 3.5" + #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 + #elif defined(__MK20DX256__) #define BLYNK_INFO_DEVICE "Teensy 3.2/3.1" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(__MK20DX128__) #define BLYNK_INFO_DEVICE "Teensy 3.0" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(__MKL26Z64__) #define BLYNK_INFO_DEVICE "Teensy LC" + #define BLYNK_BUFFERS_SIZE 512 #elif defined(ARDUINO_ARCH_AVR) #define BLYNK_INFO_DEVICE "Teensy 2.0" #else @@ -157,6 +188,7 @@ #if defined(ESP8266) || defined(ESP32) #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #endif /* Arduino AVR */ @@ -183,9 +215,11 @@ #elif defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) #define BLYNK_INFO_DEVICE "Arduino Mega" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_AVR_ADK) #define BLYNK_INFO_DEVICE "Arduino Mega ADK" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_AVR_LEONARDO) #define BLYNK_INFO_DEVICE "Arduino Leonardo" #elif defined(ARDUINO_AVR_MICRO) @@ -205,26 +239,33 @@ #elif defined(ARDUINO_SAM_DUE) #define BLYNK_INFO_DEVICE "Arduino Due" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_SAMD_ZERO) #define BLYNK_INFO_DEVICE "Arduino Zero" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_SAMD_MKR1000) #define BLYNK_INFO_DEVICE "Arduino MKR1000" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 /* Intel */ #elif defined(ARDUINO_GALILEO) #define BLYNK_INFO_DEVICE "Galileo" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 4096 #elif defined(ARDUINO_GALILEOGEN2) #define BLYNK_INFO_DEVICE "Galileo Gen2" + #define BLYNK_BUFFERS_SIZE 4096 #define BLYNK_USE_128_VPINS #elif defined(ARDUINO_EDISON) #define BLYNK_INFO_DEVICE "Edison" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 4096 #elif defined(ARDUINO_ARCH_ARC32) #define BLYNK_INFO_DEVICE "Arduino 101" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 /* Konekt */ #elif defined(ARDUINO_DASH) @@ -236,6 +277,7 @@ #elif defined(ARDUINO_RedBear_Duo) #define BLYNK_INFO_DEVICE "RedBear Duo" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_BLEND) #define BLYNK_INFO_DEVICE "Blend" #elif defined(ARDUINO_BLEND_MICRO_8MHZ) || defined(ARDUINO_BLEND_MICRO_16MHZ) @@ -258,6 +300,29 @@ /* ESP32 */ #elif defined(ARDUINO_ESP32_DEV) #define BLYNK_INFO_DEVICE "ESP32" + #elif defined(ARDUINO_ESP320) + #define BLYNK_INFO_DEVICE "SweetPeas ESP320" + #elif defined(ARDUINO_NANO32) + #define BLYNK_INFO_DEVICE "ESP32 Nano32" + #elif defined(ARDUINO_LoLin32) + #define BLYNK_INFO_DEVICE "LoLin32" + #elif defined(ARDUINO_ESPea32) + #define BLYNK_INFO_DEVICE "ESPea32" + #elif defined(ARDUINO_QUANTUM) + #define BLYNK_INFO_DEVICE "Noduino Quantum" + + /* STM32 */ + #elif defined(ARDUINO_ARCH_STM32F1) + #define BLYNK_INFO_DEVICE "STM32F1" + #define BLYNK_NO_YIELD + #elif defined(ARDUINO_ARCH_STM32F3) + #define BLYNK_INFO_DEVICE "STM32F3" + #define BLYNK_NO_YIELD + #elif defined(ARDUINO_ARCH_STM32F4) + #define BLYNK_INFO_DEVICE "STM32F4" + #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 + #define BLYNK_NO_YIELD /* Digistump */ #elif defined(ARDUINO_ESP8266_OAK) @@ -282,28 +347,65 @@ #elif defined(ARDUINO_WILDFIRE_V2) #define BLYNK_INFO_DEVICE "Wildfire V2" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_WILDFIRE_V3) #define BLYNK_INFO_DEVICE "Wildfire V3" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 #elif defined(ARDUINO_WILDFIRE_V4) #define BLYNK_INFO_DEVICE "Wildfire V4" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 1024 /* Simblee */ #elif defined(__Simblee__) #define BLYNK_INFO_DEVICE "Simblee" #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 512 + + /* RFduino */ + #elif defined(__RFduino__) + #define BLYNK_INFO_DEVICE "RFduino" + #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 512 + + /* Nordic NRF5x */ + #elif defined(ARDUINO_ARCH_NRF5) + #define BLYNK_INFO_DEVICE "nRF5" + #define BLYNK_USE_128_VPINS + #define BLYNK_BUFFERS_SIZE 512 #else - #warning "Cannot detect board type" + #if defined(BLYNK_DEBUG_ALL) + #warning "Cannot detect board type" + #endif #define BLYNK_INFO_DEVICE "Arduino" #endif #endif - #ifdef BLYNK_DEBUG - #pragma message ("BLYNK_INFO_DEVICE=" BLYNK_INFO_DEVICE) - #pragma message ("BLYNK_INFO_CPU=" BLYNK_INFO_CPU) + #if !defined(BLYNK_MAX_READBYTES) && defined(BLYNK_BUFFERS_SIZE) + #define BLYNK_MAX_READBYTES BLYNK_BUFFERS_SIZE + #endif + + #if !defined(BLYNK_MAX_SENDBYTES) && defined(BLYNK_BUFFERS_SIZE) + #define BLYNK_MAX_SENDBYTES BLYNK_BUFFERS_SIZE + #endif + + // Print diagnostics + + #if defined(BLYNK_DEBUG_ALL) + #if defined(BLYNK_INFO_DEVICE) + #pragma message ("BLYNK_INFO_DEVICE=" BLYNK_TOSTRING(BLYNK_INFO_DEVICE)) + #endif + + #if defined(BLYNK_INFO_CPU) + #pragma message ("BLYNK_INFO_CPU=" BLYNK_TOSTRING(BLYNK_INFO_CPU)) + #endif + + #if defined(BLYNK_BUFFERS_SIZE) + #pragma message ("BLYNK_BUFFERS_SIZE=" BLYNK_TOSTRING(BLYNK_BUFFERS_SIZE)) + #endif #endif #endif