From 57aa1457e0d4ed0016f2cee1937a4564b2de9c80 Mon Sep 17 00:00:00 2001 From: pmantoine Date: Sun, 23 Oct 2022 17:49:39 +0800 Subject: [PATCH] GETFLASHW hack for SAMD/STM32 --- FSH.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FSH.h b/FSH.h index 850311e..ea54554 100644 --- a/FSH.h +++ b/FSH.h @@ -1,5 +1,5 @@ /* - * © 2022 Paul M Antoine + * © 2022 Paul M. Antoine * © 2021 Neil McKechnie * © 2021 Harald Barth * © 2021 Fred Decker @@ -48,10 +48,10 @@ typedef char FSH; #define FLASH #define strlen_P strlen #define strcpy_P strcpy -#elif defined(ARDUINO_ARCH_STM32) +#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32) typedef __FlashStringHelper FSH; -#define GETFLASH(addr) pgm_read_byte_near(addr) -#define GETFLASHW(addr) pgm_read_word_near(addr) +#define GETFLASH(addr) pgm_read_byte(addr) +#define GETFLASHW(addr) (*(const unsigned int8_t *)(addr)) | ((*(const unsigned int8_t *)(addr+1)) << 8) #ifdef FLASH #undef FLASH #endif