PDA

View Full Version : memcpy_P missing from pgmspace.h for Teensy 3



matt
11-27-2012, 11:28 PM
As the title says.

I added the following to ..\cores\teensy3\avr\pgmspace.h

#define memcpy_P(a, b, c) memcpy((a), (b), (c))

I believe this is correct since there is no separation of data and program space in the ARM, so we don't need separate _P functions.
Can this be added to a future release please?

PaulStoffregen
11-27-2012, 11:57 PM
I added it earlier today, while investigating the RF22 library. Here's an updated core library.

http://www.pjrc.com/teensy/beta/teensy3_27nov12.zip

renasis
10-24-2013, 05:20 AM
Hello,

There were a few functions that were missing when I tried to compile my sketch ported from a duino. I tried adding similarly to pgmspace.h, however I have never added functions to pgmspace.h, not sure if I did it correctly. Can you confirm that this is the correct way to do this?

#define strcasestr_P(a,b) strcasestr((a),(b))
#define strncasecmp_P(a,b,num) strncasecmp((a),(b),(num))
#define memcmp_P(dest, src, num) memcmp((dest), (src), (num))

Thanks,

-ren

PaulStoffregen
10-24-2013, 08:21 AM
Yes, those look good.