- Notifications
You must be signed in to change notification settings - Fork 7.6k
/
Copy pathpgmspace.h
88 lines (79 loc) · 2.89 KB
/
pgmspace.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
This file is part of the RaspberryPi core for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndefPGMSPACE_INCLUDE
#definePGMSPACE_INCLUDE
typedefvoidprog_void;
typedefcharprog_char;
typedefunsigned charprog_uchar;
typedefcharprog_int8_t;
typedefunsigned charprog_uint8_t;
typedefshortprog_int16_t;
typedefunsigned shortprog_uint16_t;
typedeflongprog_int32_t;
typedefunsigned longprog_uint32_t;
#definePROGMEM
#definePGM_P const char *
#definePGM_VOID_P const void *
#defineFPSTR(p) ((const char *)(p))
#definePSTR(s) (s)
#define_SFR_BYTE(n) (n)
#definepgm_read_byte(addr) (*(const unsigned char *)(addr))
#definepgm_read_word(addr) ({ \
typeof(addr) _addr = (addr); \
*(const unsigned short *)(_addr); \
})
#definepgm_read_dword(addr) ({ \
typeof(addr) _addr = (addr); \
*(const unsigned long *)(_addr); \
})
#definepgm_read_float(addr) ({ \
typeof(addr) _addr = (addr); \
*(const float *)(_addr); \
})
#definepgm_read_ptr(addr) ({ \
typeof(addr) _addr = (addr); \
*(void * const *)(_addr); \
})
#definepgm_read_byte_near(addr) pgm_read_byte(addr)
#definepgm_read_word_near(addr) pgm_read_word(addr)
#definepgm_read_dword_near(addr) pgm_read_dword(addr)
#definepgm_read_float_near(addr) pgm_read_float(addr)
#definepgm_read_ptr_near(addr) pgm_read_ptr(addr)
#definepgm_read_byte_far(addr) pgm_read_byte(addr)
#definepgm_read_word_far(addr) pgm_read_word(addr)
#definepgm_read_dword_far(addr) pgm_read_dword(addr)
#definepgm_read_float_far(addr) pgm_read_float(addr)
#definepgm_read_ptr_far(addr) pgm_read_ptr(addr)
#definememcmp_P memcmp
#definememccpy_P memccpy
#definememmem_P memmem
#definememcpy_P memcpy
#definestrcpy_P strcpy
#definestrncpy_P strncpy
#definestrcat_P strcat
#definestrncat_P strncat
#definestrcmp_P strcmp
#definestrncmp_P strncmp
#definestrcasecmp_P strcasecmp
#definestrncasecmp_P strncasecmp
#definestrlen_P strlen
#definestrnlen_P strnlen
#definestrstr_P strstr
#defineprintf_P printf
#definesprintf_P sprintf
#definesnprintf_P snprintf
#definevsnprintf_P vsnprintf
#endif