diff --git a/ArduinoProps.zip b/ArduinoProps.zip index ae7a888..dd0f2b0 100644 Binary files a/ArduinoProps.zip and b/ArduinoProps.zip differ diff --git a/examples/BlinkOnBridgeProp/BlinkOnBridgeProp.ino b/examples/BlinkOnBridgeProp/BlinkOnBridgeProp.ino index 6723d98..e9c2397 100644 --- a/examples/BlinkOnBridgeProp/BlinkOnBridgeProp.ino +++ b/examples/BlinkOnBridgeProp/BlinkOnBridgeProp.ino @@ -1,3 +1,4 @@ + /* BlinkOnBridgeProp.ino MIT License (c) Faure Systems diff --git a/examples/BlinkOnStm32Nucleo144Prop/BlinkOnStm32Nucleo144Prop.ino b/examples/BlinkOnStm32Nucleo144Prop/BlinkOnStm32Nucleo144Prop.ino index 398765d..eaa2276 100644 --- a/examples/BlinkOnStm32Nucleo144Prop/BlinkOnStm32Nucleo144Prop.ino +++ b/examples/BlinkOnStm32Nucleo144Prop/BlinkOnStm32Nucleo144Prop.ino @@ -14,9 +14,10 @@ - STM32 Nucleo-144 borads require: STM32duino LwIP and STM32duino STM32Ethernet libraries */ +#if defined(ARDUINO_ARCH_STM32) #include #include -#include "Stm32Nucleo144Prop.h" +//#include "Stm32Nucleo144Prop.h" #include "ArduinoProps.h" #include "Stm32Millis.h" extern Stm32MillisClass Stm32Millis; @@ -119,3 +120,4 @@ void InboxMessage::run(String a) { prop.sendOmit(a); } } +#endif diff --git a/src/ArduinoProps.h b/src/ArduinoProps.h index 3746a9a..0ee99b8 100644 --- a/src/ArduinoProps.h +++ b/src/ArduinoProps.h @@ -10,8 +10,12 @@ #ifndef _ArduinoProps_h #define _ArduinoProps_h -#if !defined(STM32F4xx) && !defined(STM32F7xx) // tested with STM32F767 +#if defined(ARDUINO_ARCH_STM32) +// tested with STM32F767ZI +#include +#include "Stm32Nucleo144Prop.h" +#else #if defined(ARDUINO) && ARDUINO >= 100 #include "arduino.h" @@ -23,9 +27,7 @@ #include "EthernetProp.h" #include "WifiProp.h" -#else // !STM32F4xx && !STM32F7xx -#include -#endif // STM32F4 +#endif #include "PropAction.h" #include "PropData.h" diff --git a/src/BridgeProp.cpp b/src/BridgeProp.cpp index ef073c6..ca19fda 100644 --- a/src/BridgeProp.cpp +++ b/src/BridgeProp.cpp @@ -9,6 +9,10 @@ #include "BridgeProp.h" +#if defined(ARDUINO_ARCH_STM32) +// Don't compile Arduino Bridge library when compiling for STM32 ARCH +#else + BridgeProp::BridgeProp(const char* client_id, const char* in_box, const char* out_box, const char* broker, const int port) : Prop(client_id, in_box, out_box, broker, port) { @@ -26,3 +30,4 @@ void BridgeProp::setBrokerIpAddress(IPAddress ip, uint16_t port) _client.setServer(_brokerIpAddress, port); } +#endif diff --git a/src/BridgeProp.h b/src/BridgeProp.h index 2197f4d..439a33e 100644 --- a/src/BridgeProp.h +++ b/src/BridgeProp.h @@ -9,6 +9,10 @@ #ifndef BRIDGEPROP_H #define BRIDGEPROP_H +#if defined(ARDUINO_ARCH_STM32) +// Don't compile Arduino Bridge library when compiling for STM32 ARCH +#else + #include #include #include "Prop.h" @@ -25,3 +29,4 @@ class BridgeProp : public Prop }; #endif +#endif diff --git a/src/EthernetProp.cpp b/src/EthernetProp.cpp index 7e2eae4..aed2376 100644 --- a/src/EthernetProp.cpp +++ b/src/EthernetProp.cpp @@ -9,6 +9,10 @@ #include "EthernetProp.h" +#if defined(ARDUINO_ARCH_STM32) +// Don't compile Arduino Ethernet library when compiling for STM32 ARCH +#else + EthernetProp::EthernetProp(const char* client_id, const char* in_box, const char* out_box, const char* broker, const int port) : Prop(client_id, in_box, out_box, broker, port) { @@ -19,3 +23,5 @@ void EthernetProp::begin(void(*on_message)(String)) { if (on_message) onInboxMessageReceived = on_message; } + +#endif diff --git a/src/EthernetProp.h b/src/EthernetProp.h index b36d212..cc25d73 100644 --- a/src/EthernetProp.h +++ b/src/EthernetProp.h @@ -9,6 +9,9 @@ #ifndef ETHERNETPROP_H #define ETHERNETPROP_H +#if defined(ARDUINO_ARCH_STM32) +// Don't compile Arduino Ethernet library when compiling for STM32 ARCH +#else #include #include @@ -26,3 +29,4 @@ class EthernetProp : public Prop }; #endif +#endif diff --git a/src/Prop.cpp b/src/Prop.cpp index 5b4c75f..eba6cbf 100644 --- a/src/Prop.cpp +++ b/src/Prop.cpp @@ -8,7 +8,6 @@ */ #include "Prop.h" -//#include #if defined(__AVR__) #include #endif @@ -99,7 +98,7 @@ void Prop::checkDataChanges() void Prop::resetMcu() { -#if defined(ARDUINO_ARCH_SAMD) || defined(STM32F4xx) || defined(STM32F7xx) +#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4) || defined(ARDUINO_ARCH_STM32F7) NVIC_SystemReset(); #elif defined(ARDUINO_ARCH_AVR) || defined(__AVR__) wdt_enable(WDTO_15MS); diff --git a/src/Prop.h b/src/Prop.h index d8ce097..1df8c46 100644 --- a/src/Prop.h +++ b/src/Prop.h @@ -9,7 +9,9 @@ #ifndef PROP_H #define PROP_H -#if !defined(STM32F4xx) && !defined(STM32F7xx) // tested with STM32F767 +#if defined(ARDUINO_ARCH_STM32) +// tested with STM32F767ZI +#else #if defined(ARDUINO) && ARDUINO >= 100 #include "arduino.h" @@ -19,7 +21,7 @@ #include -#endif // !STM32F4xx && !STM32F7xx +#endif #include #include diff --git a/src/PropAction.cpp b/src/PropAction.cpp index 90dc22c..ca33696 100644 --- a/src/PropAction.cpp +++ b/src/PropAction.cpp @@ -9,8 +9,19 @@ #include "PropAction.h" -#if defined(STM32F4xx) || defined(STM32F7xx) +#if defined(ARDUINO_ARCH_STM32) +// tested with STM32F767ZI +#include #include "Stm32Millis.h" + +#else + +#if defined(ARDUINO) && ARDUINO >= 100 +#include "arduino.h" +#else +#include "WProgram.h" +#endif + #endif PropAction::PropAction() diff --git a/src/Stm32Millis.cpp b/src/Stm32Millis.cpp index 9599586..cd097bb 100644 --- a/src/Stm32Millis.cpp +++ b/src/Stm32Millis.cpp @@ -6,11 +6,11 @@ Implement millis() missing in STM32duino. */ -#if defined(STM32F4xx) || defined(STM32F7xx) +#if defined(ARDUINO_ARCH_STM32) #include "Stm32Millis.h" unsigned long Stm32MillisClass::milliseconds = 0; Stm32MillisClass Stm32Millis; -#endif // STM32F4xx|STM32F7xx +#endif diff --git a/src/Stm32Millis.h b/src/Stm32Millis.h index f259c73..9d67ab1 100644 --- a/src/Stm32Millis.h +++ b/src/Stm32Millis.h @@ -11,7 +11,7 @@ #ifndef STM32MILLIS_H #define STM32MILLIS_H -#if defined(STM32F4xx) || defined(STM32F7xx) +#if defined(ARDUINO_ARCH_STM32) #include @@ -44,5 +44,5 @@ class Stm32MillisClass { extern Stm32MillisClass Stm32Millis; -#endif // STM32F4xx|STM32F7xx +#endif // STM32 #endif diff --git a/src/Stm32Nucleo144Prop.cpp b/src/Stm32Nucleo144Prop.cpp index c588522..2a5b5e7 100644 --- a/src/Stm32Nucleo144Prop.cpp +++ b/src/Stm32Nucleo144Prop.cpp @@ -6,6 +6,7 @@ Prop for Arduino with Ethernet shield. */ +#if defined(ARDUINO_ARCH_STM32) #include "Stm32Nucleo144Prop.h" @@ -19,3 +20,5 @@ void Stm32Nucleo144Prop::begin(void(*on_message)(String)) { if (on_message) onInboxMessageReceived = on_message; } + +#endif diff --git a/src/WifiProp.cpp b/src/WifiProp.cpp index 99f5907..4f09596 100644 --- a/src/WifiProp.cpp +++ b/src/WifiProp.cpp @@ -9,6 +9,10 @@ #include "WifiProp.h" +#if defined(ARDUINO_ARCH_STM32) +// Don't compile Arduino WiFi libraries when compiling for STM32 ARCH +#else + #if defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRVIDOR4000) @@ -26,3 +30,4 @@ void WifiProp::begin(void(*on_message)(String)) #endif +#endif diff --git a/src/WifiProp.h b/src/WifiProp.h index b87157a..12757b3 100644 --- a/src/WifiProp.h +++ b/src/WifiProp.h @@ -9,6 +9,9 @@ #ifndef WIFIPROP_H #define WIFIPROP_H +#if defined(ARDUINO_ARCH_STM32) +// Don't compile Arduino WiFi libraries when compiling for STM32 ARCH +#else #if defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRVIDOR4000) @@ -30,6 +33,5 @@ private: }; #endif - - +#endif #endif