Everyone.
I am using Renesas RA series MCU,
How to transplant pgm_read_byte()?
Can someone teach me?
Thankyou so much.=]
pgm_read_byte()
The data is already const and / or constexpr. For sources that are compatible across non-AVR targets, you would:
const
constexpr
#if defined __AVR__ && defined __GNUC__ #include <avr/pgmspace.h> #else // not avr-gcc #define PROGMEM /* empty */ #define pgm_read_byte(x) (*(x)) #define pgm_read_word(x) (*(x)) #define pgm_read_dword(x) (*(x)) #define pgm_read_float(x) (*(x)) ... #endif
Or, if it need not be cross-target compatible, just do vanilla C/C++ and
#include <avr/pgmspace.h>
PROGMEM
pgm_read_xxx(&var)
var
The data is already
constand / orconstexpr. For sources that are compatible across non-AVR targets, you would:Or, if it need not be cross-target compatible, just do vanilla C/C++ and
#include <avr/pgmspace.h>.PROGMEM.pgm_read_xxx(&var)my just accessingvardirectly.