From 090acdae44a0a7e99a08c15402a404996d95e447 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 8 Jul 2022 10:46:52 +0100 Subject: [PATCH] More SAMD cleanup --- DCCEXParser.cpp | 2 +- I2CManager.h | 8 ++++---- defines.h | 8 ++++++++ platformio.ini | 6 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 4846a5d..d47dc57 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -914,7 +914,7 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[]) // Disable all interrupts and reset uC __disable_irq(); NVIC_SystemReset(); - while(true); + while(true) {}; #endif #endif break; // and if we didnt restart diff --git a/I2CManager.h b/I2CManager.h index 67fd1ad..49f3e8f 100644 --- a/I2CManager.h +++ b/I2CManager.h @@ -110,11 +110,11 @@ * */ -// Uncomment following line to enable Wire library instead of native I2C drivers -#define I2C_USE_WIRE +// Add following line to config.h to enable Wire library instead of native I2C drivers +//#define I2C_USE_WIRE -// Uncomment following line to disable the use of interrupts by the native I2C drivers. -#define I2C_NO_INTERRUPTS +// Add following line to config.h to disable the use of interrupts by the native I2C drivers. +//#define I2C_NO_INTERRUPTS // Default to use interrupts within the native I2C drivers. #ifndef I2C_NO_INTERRUPTS diff --git a/defines.h b/defines.h index a615669..f61411e 100644 --- a/defines.h +++ b/defines.h @@ -75,6 +75,14 @@ #elif defined(ARDUINO_ARCH_SAMD) #define ARDUINO_TYPE "SAMD21" #undef HAS_AVR_WDT +// SAMD support for I2C is awaiting development +#ifndef DISABLE_EEPROM + #define DISABLE_EEPROM +#endif +#ifndef I2C_NO_INTERRUPTS + #define I2C_NO_INTERRUPTS +#endif + /* TODO when ready #elif defined(ARDUINO_ARCH_RP2040) diff --git a/platformio.ini b/platformio.ini index 740c8cc..6b8796c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -32,7 +32,7 @@ lib_deps = ${env.lib_deps} monitor_speed = 115200 monitor_flags = --echo -build_flags = -std=c++17 -DI2C_USE_WIRE -DDISABLE_EEPROM +build_flags = -std=c++17 [env:samd21-zero-usb] platform = atmelsam @@ -43,7 +43,7 @@ lib_deps = ${env.lib_deps} monitor_speed = 115200 monitor_flags = --echo -build_flags = -std=c++17 -DI2C_USE_WIRE -DDISABLE_EEPROM +build_flags = -std=c++17 [env:samc21-firebox] platform = atmelsam @@ -55,7 +55,7 @@ lib_deps = SparkFun External EEPROM Arduino Library monitor_speed = 115200 monitor_flags = --echo -build_flags = -std=c++17 -DI2C_USE_WIRE -DDISABLE_EEPROM +build_flags = -std=c++17 [env:mega2560-debug] platform = atmelavr