From b5c01716bb823640455f917c9b3797d10176448f Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Wed, 28 May 2025 12:12:10 +0700 Subject: [PATCH 1/3] =?UTF-8?q?=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20min=20max=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=BC=D0=B0=D0=BA=D1=80=D0=BE=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cores/arduino/wiring_constants.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/cores/arduino/wiring_constants.h b/cores/arduino/wiring_constants.h index 1231a2f..f46dc93 100644 --- a/cores/arduino/wiring_constants.h +++ b/cores/arduino/wiring_constants.h @@ -56,25 +56,23 @@ enum BitOrder #define NOT_AN_INTERRUPT -1 // Math -#ifdef __cplusplus - #include - using std::min; - using std::max; -#else // C - #include - #ifndef abs - #define abs(x) ((x)>0?(x):-(x)) - #endif // abs +#include +// undefine stdlib's abs if encountered +#ifdef abs +#undef abs +#endif +#ifndef abs + #define abs(x) ((x)>0?(x):-(x)) +#endif // abs - #ifndef min - #define min(a,b) ((a)<(b)?(a):(b)) - #endif // min +#ifndef min + #define min(a,b) ((a)<(b)?(a):(b)) +#endif // min - #ifndef max - #define max(a,b) ((a)>(b)?(a):(b)) - #endif // max +#ifndef max + #define max(a,b) ((a)>(b)?(a):(b)) +#endif // max -#endif // __cplusplus #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) #define radians(deg) ((deg)*DEG_TO_RAD) #define degrees(rad) ((rad)*RAD_TO_DEG) -- 2.43.0 From 661224d2608373d79823cb9167eda708dd78361d Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Wed, 28 May 2025 13:51:02 +0700 Subject: [PATCH 2/3] =?UTF-8?q?=D0=BD=D0=B5=D0=BB=D1=8C=D0=B7=D1=8F=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B1=D1=80=D0=B0=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BA=D1=82=20=D1=81=20=D0=BD=D0=B5-void=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=B5=D0=B9,=20=D0=BA=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B0=D1=8F=20=D0=BD=D0=B5=20=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=B5=D1=82=20return,=20=D0=B8=D0=BD=D0=B0=D1=87=D0=B5=20?= =?UTF-8?q?=D0=BD=D0=B0=20risc-v=20=D0=BA=D0=B0=D0=BA=20=D0=BF=D0=BE=D0=BF?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE=20=D0=BC=D0=BE=D0=B6=D0=B5=D1=82=20=D1=81?= =?UTF-8?q?=D0=B5=D0=B1=D1=8F=20=D0=BA=D0=BE=D0=B4=20=D0=B2=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 2392730..2920a9b 100644 --- a/platform.txt +++ b/platform.txt @@ -34,8 +34,8 @@ compiler.optimization_flags.debug=-Og -g3 compiler.extra_flags = -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medlow -Wall -fsigned-char -ffunction-sections compiler.S.flags = {compiler.extra_flags} -x assembler-with-cpp {compiler.define} -I"{runtime.platform.path}/libraries/FreeRTOS/src" {compiler.optimization_flags} {compiler.warning_flags} {compiler.MIK32_Amur.extra_include} -compiler.c.flags = -c -std=gnu11 {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include} -compiler.cpp.flags = -c -std=gnu++17 -fabi-version=0 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include} +compiler.c.flags = -c -std=gnu11 -Werror=return-type {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include} +compiler.cpp.flags = -c -std=gnu++17 -fabi-version=0 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics -Werror=return-type {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include} compiler.c.elf.flags = -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medlow -nostartfiles -Xlinker compiler.ar.flags=rc compiler.elf2bin.flags=-O binary -- 2.43.0 From a31b5a48c0ed0d470eec4630efb4a6fa611c8007 Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Wed, 28 May 2025 14:11:16 +0700 Subject: [PATCH 3/3] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D1=82=D0=B8?= =?UTF-8?q?=D0=BF=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20put=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D1=82=D0=B0=D0=BA=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B6=D0=B5,=20=D0=BA=D0=B0=D0=BA=20=D1=83=20=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=B3=D0=B8=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20arduino?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/EEPROM/src/EEPROM.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/EEPROM/src/EEPROM.h b/libraries/EEPROM/src/EEPROM.h index 315c4e0..780a89e 100644 --- a/libraries/EEPROM/src/EEPROM.h +++ b/libraries/EEPROM/src/EEPROM.h @@ -94,7 +94,7 @@ struct EEPROMClass{ uint16_t length() { return (uint16_t)EEPROM_LENGHT; } template< typename T > - T &put(int idx, T &data) + const T &put(int idx, const T &data) { void* dataPointer = (void*)&data; // check if idx is valid -- 2.43.0