robobuggy / arduino / InterruptRCRecieverReference / PinChangeInt / Examples / GetPSTR / GetPSTR.h @ c5d6b0e8
History | View | Annotate | Download (478 Bytes)
1 |
#ifndef INCLUDE_GETPSTR
|
---|---|
2 |
#define INCLUDE_GETPSTR
|
3 |
|
4 |
#if defined(ARDUINO) && ARDUINO >= 100 |
5 |
#include <Arduino.h> |
6 |
#else
|
7 |
#include "pins_arduino.h" |
8 |
#include "WProgram.h" |
9 |
#include "wiring.h" |
10 |
#endif
|
11 |
|
12 |
#define getPSTR(s) pgmStrToRAM(PSTR(s))
|
13 |
|
14 |
char *_pstr_to_print;
|
15 |
char *pgmStrToRAM(PROGMEM char *theString) { |
16 |
free(_pstr_to_print); |
17 |
_pstr_to_print=(char *) malloc(strlen_P(theString));
|
18 |
strcpy_P(_pstr_to_print, theString); |
19 |
return (_pstr_to_print);
|
20 |
} |
21 |
#endif
|