Reputation: 33
Everyone.
I am using Renesas RA series MCU,
How to transplant pgm_read_byte()?
Can someone teach me?
Thankyou so much.=]
Upvotes: -1
Views: 390
Reputation: 3888
How to transplant
pgm_read_byte()
?
The data is already const
and / or constexpr
. For sources that are compatible across non-AVR targets, you would:
#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)
my just accessing var
directly.Upvotes: 0