USB Host Shield 2.0
version_helper.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
16  */
17 
18 /*
19  * Universal Arduino(tm) "IDE" fixups.
20  * Includes fixes for versions as low as 0023, used by Digilent.
21  */
22 
23 #if defined(ARDUINO) && ARDUINO >=100
24 #include <Arduino.h>
25 #else
26 #include <WProgram.h>
27 #include <pins_arduino.h>
28 #ifdef __AVR__
29 #include <avr/pgmspace.h>
30 #include <avr/io.h>
31 #else
32 #endif
33 #endif
34 
35 #ifndef __PGMSPACE_H_
36 #define __PGMSPACE_H_ 1
37 
38 #include <inttypes.h>
39 
40 #ifndef PROGMEM
41 #define PROGMEM
42 #endif
43 #ifndef PGM_P
44 #define PGM_P const char *
45 #endif
46 #ifndef PSTR
47 #define PSTR(str) (str)
48 #endif
49 #ifndef F
50 #define F(str) (str)
51 #endif
52 #ifndef _SFR_BYTE
53 #define _SFR_BYTE(n) (n)
54 #endif
55 
56 #ifndef prog_void
57 typedef void prog_void;
58 #endif
59 #ifndef prog_char
60 typedef char prog_char;
61 #endif
62 #ifndef prog_uchar
63 typedef unsigned char prog_uchar;
64 #endif
65 #ifndef prog_int8_t
66 typedef int8_t prog_int8_t;
67 #endif
68 #ifndef prog_uint8_t
69 typedef uint8_t prog_uint8_t;
70 #endif
71 #ifndef prog_int16_t
72 typedef int16_t prog_int16_t;
73 #endif
74 #ifndef prog_uint16_t
75 typedef uint16_t prog_uint16_t;
76 #endif
77 #ifndef prog_int32_t
78 typedef int32_t prog_int32_t;
79 #endif
80 #ifndef prog_uint32_t
81 typedef uint32_t prog_uint32_t;
82 #endif
83 
84 #ifndef memchr_P
85 #define memchr_P(str, c, len) memchr((str), (c), (len))
86 #endif
87 #ifndef memcmp_P
88 #define memcmp_P(a, b, n) memcmp((a), (b), (n))
89 #endif
90 #ifndef memcpy_P
91 #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
92 #endif
93 #ifndef memmem_P
94 #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
95 #endif
96 #ifndef memrchr_P
97 #define memrchr_P(str, val, len) memrchr((str), (val), (len))
98 #endif
99 #ifndef strcat_P
100 #define strcat_P(dest, src) strcat((dest), (src))
101 #endif
102 #ifndef strchr_P
103 #define strchr_P(str, c) strchr((str), (c))
104 #endif
105 #ifndef strchrnul_P
106 #define strchrnul_P(str, c) strchrnul((str), (c))
107 #endif
108 #ifndef strcmp_P
109 #define strcmp_P(a, b) strcmp((a), (b))
110 #endif
111 #ifndef strcpy_P
112 #define strcpy_P(dest, src) strcpy((dest), (src))
113 #endif
114 #ifndef strcasecmp_P
115 #define strcasecmp_P(a, b) strcasecmp((a), (b))
116 #endif
117 #ifndef strcasestr_P
118 #define strcasestr_P(a, b) strcasestr((a), (b))
119 #endif
120 #ifndef strlcat_P
121 #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
122 #endif
123 #ifndef strlcpy_P
124 #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
125 #endif
126 #ifndef strlen_P
127 #define strlen_P(s) strlen((const char *)(s))
128 #endif
129 #ifndef strnlen_P
130 #define strnlen_P(str, len) strnlen((str), (len))
131 #endif
132 #ifndef strncmp_P
133 #define strncmp_P(a, b, n) strncmp((a), (b), (n))
134 #endif
135 #ifndef strncasecmp_P
136 #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
137 #endif
138 #ifndef strncat_P
139 #define strncat_P(a, b, n) strncat((a), (b), (n))
140 #endif
141 #ifndef strncpy_P
142 #define strncpy_P(a, b, n) strncmp((a), (b), (n))
143 #endif
144 #ifndef strpbrk_P
145 #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
146 #endif
147 #ifndef strrchr_P
148 #define strrchr_P(str, c) strrchr((str), (c))
149 #endif
150 #ifndef strsep_P
151 #define strsep_P(strp, delim) strsep((strp), (delim))
152 #endif
153 #ifndef strspn_P
154 #define strspn_P(str, chrs) strspn((str), (chrs))
155 #endif
156 #ifndef strstr_P
157 #define strstr_P(a, b) strstr((a), (b))
158 #endif
159 #ifndef sprintf_P
160 #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
161 #endif
162 #ifndef vfprintf_P
163 #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
164 #endif
165 #ifndef printf_P
166 #define printf_P(...) printf(__VA_ARGS__)
167 #endif
168 #ifndef snprintf_P
169 #define snprintf_P(s, n, ...) ((s), (n), __VA_ARGS__)
170 #endif
171 #ifndef vsprintf_P
172 #define vsprintf_P(s, ...) ((s),__VA_ARGS__)
173 #endif
174 #ifndef vsnprintf_P
175 #define vsnprintf_P(s, n, ...) ((s), (n),__VA_ARGS__)
176 #endif
177 #ifndef fprintf_P
178 #define fprintf_P(s, ...) ((s), __VA_ARGS__)
179 #endif
180 
181 #ifndef pgm_read_byte
182 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
183 #endif
184 #ifndef pgm_read_word
185 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
186 #endif
187 #ifndef pgm_read_dword
188 #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
189 #endif
190 #ifndef pgm_read_float
191 #define pgm_read_float(addr) (*(const float *)(addr))
192 #endif
193 
194 #ifndef pgm_read_byte_near
195 #define pgm_read_byte_near(addr) pgm_read_byte(addr)
196 #endif
197 #ifndef pgm_read_word_near
198 #define pgm_read_word_near(addr) pgm_read_word(addr)
199 #endif
200 #ifndef pgm_read_dword_near
201 #define pgm_read_dword_near(addr) pgm_read_dword(addr)
202 #endif
203 #ifndef pgm_read_float_near
204 #define pgm_read_float_near(addr) pgm_read_float(addr)
205 #endif
206 #ifndef pgm_read_byte_far
207 #define pgm_read_byte_far(addr) pgm_read_byte(addr)
208 #endif
209 #ifndef pgm_read_word_far
210 #define pgm_read_word_far(addr) pgm_read_word(addr)
211 #endif
212 #ifndef pgm_read_dword_far
213 #define pgm_read_dword_far(addr) pgm_read_dword(addr)
214 #endif
215 #ifndef pgm_read_float_far
216 #define pgm_read_float_far(addr) pgm_read_float(addr)
217 #endif
218 
219 #ifndef pgm_read_pointer
220 #define pgm_read_pointer
221 #endif
222 #endif
void prog_void
int8_t prog_int8_t
int32_t prog_int32_t
uint8_t prog_uint8_t
int16_t prog_int16_t
uint32_t prog_uint32_t
uint16_t prog_uint16_t
unsigned char prog_uchar
char prog_char