diff --git a/wiring/inc/spark_wiring_spi.h b/wiring/inc/spark_wiring_spi.h index d417f8b277..c2d4a09c88 100644 --- a/wiring/inc/spark_wiring_spi.h +++ b/wiring/inc/spark_wiring_spi.h @@ -112,16 +112,14 @@ class SPIClass { #ifndef SPARK_WIRING_NO_SPI -#define SPI __fetch_global_SPI() -SPIClass& __fetch_global_SPI(); +extern SPIClass SPI; #if Wiring_SPI1 #ifdef SPI1 #undef SPI1 #endif // SPI1 -#define SPI1 __fetch_global_SPI1() -SPIClass& __fetch_global_SPI1(); +extern SPIClass SPI1; #endif // Wiring_SPI1 @@ -130,8 +128,7 @@ SPIClass& __fetch_global_SPI1(); #undef SPI2 #endif // SPI2 -#define SPI2 __fetch_global_SPI2() -SPIClass& __fetch_global_SPI2(); +extern SPIClass SPI2; #endif // Wiring_SPI2 diff --git a/wiring/src/user.cpp b/wiring/src/user.cpp index ecfa0158a1..8f45788855 100644 --- a/wiring/src/user.cpp +++ b/wiring/src/user.cpp @@ -137,7 +137,7 @@ void system_initialize_user_backup_ram() #include "platform_headers.h" -static retained_system volatile uint32_t __backup_sram_signature; +static retained volatile uint32_t __backup_sram_signature; static bool backup_ram_was_valid_ = false; const uint32_t signature = 0x9A271C1E; diff --git a/wiring_globals/src/wiring_globals_spi.cpp b/wiring_globals/src/wiring_globals_spi.cpp index ed27e048b7..ff47631491 100644 --- a/wiring_globals/src/wiring_globals_spi.cpp +++ b/wiring_globals/src/wiring_globals_spi.cpp @@ -6,27 +6,14 @@ #ifndef SPARK_WIRING_NO_SPI - -SPIClass& __fetch_global_SPI() -{ - static SPIClass spi(HAL_SPI_INTERFACE1); - return spi; -} +SPIClass SPI(HAL_SPI_INTERFACE1); #if Wiring_SPI1 -SPIClass& __fetch_global_SPI1() -{ - static SPIClass spi1(HAL_SPI_INTERFACE2); - return spi1; -} +SPIClass SPI1(HAL_SPI_INTERFACE2); #endif #if Wiring_SPI2 -SPIClass& __fetch_global_SPI2() -{ - static SPIClass spi2(HAL_SPI_INTERFACE3); - return spi2; -} +SPIClass SPI2(HAL_SPI_INTERFACE3); #endif #endif //SPARK_WIRING_NO_SPI