File: const_progmem.patch

package info (click to toggle)
arduino 2%3A1.0.5%2Bdfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 40,280 kB
  • ctags: 18,385
  • sloc: java: 57,238; cpp: 23,031; ansic: 13,695; makefile: 2,315; xml: 468; perl: 201; sh: 156; python: 62
file content (305 lines) | stat: -rw-r--r-- 12,948 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
Description: newer gcc requires PROGMEM variables to be consts
Author: Scott Howard <showard@debian.org>

Index: arduino/libraries/Robot_Control/glcdfont.c
===================================================================
--- arduino.orig/libraries/Robot_Control/glcdfont.c	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/Robot_Control/glcdfont.c	2013-06-04 15:58:54.879832010 -0400
@@ -6,7 +6,7 @@
 
 // standard ascii 5x7 font
 
-static unsigned char  font[] PROGMEM = {
+static const unsigned char  font[] PROGMEM = {
         0x00, 0x00, 0x00, 0x00, 0x00,   
 	0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 	
 	0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 	
Index: arduino/libraries/TFT/utility/glcdfont.c
===================================================================
--- arduino.orig/libraries/TFT/utility/glcdfont.c	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/TFT/utility/glcdfont.c	2013-06-04 15:58:54.879832010 -0400
@@ -8,7 +8,7 @@
 
 // standard ascii 5x7 font
 
-static unsigned char  font[] PROGMEM = {
+static const unsigned char  font[] PROGMEM = {
         0x00, 0x00, 0x00, 0x00, 0x00,   
 	0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 	
 	0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 	
Index: arduino/libraries/TFT/utility/Adafruit_ST7735.cpp
===================================================================
--- arduino.orig/libraries/TFT/utility/Adafruit_ST7735.cpp	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/TFT/utility/Adafruit_ST7735.cpp	2013-06-04 15:58:57.000000000 -0400
@@ -97,7 +97,7 @@
 // formatting -- storage-wise this is hundreds of bytes more compact
 // than the equivalent code.  Companion function follows.
 #define DELAY 0x80
-PROGMEM static prog_uchar
+PROGMEM static const prog_uchar
   Bcmd[] = {                  // Initialization commands for 7735B screens
     18,                       // 18 commands in list:
     ST7735_SWRESET,   DELAY,  //  1: Software reset, no args, w/delay
@@ -231,7 +231,7 @@
 
 // Companion code to the above tables.  Reads and issues
 // a series of LCD commands stored in PROGMEM byte array.
-void Adafruit_ST7735::commandList(uint8_t *addr) {
+void Adafruit_ST7735::commandList(const uint8_t *addr) {
 
   uint8_t  numCommands, numArgs;
   uint16_t ms;
@@ -256,7 +256,7 @@
 
 
 // Initialization code common to both 'B' and 'R' type displays
-void Adafruit_ST7735::commonInit(uint8_t *cmdList) {
+void Adafruit_ST7735::commonInit(const uint8_t *cmdList) {
 
   constructor(ST7735_TFTWIDTH, ST7735_TFTHEIGHT);
   colstart  = rowstart = 0; // May be overridden in init func
Index: arduino/libraries/TFT/utility/Adafruit_ST7735.h
===================================================================
--- arduino.orig/libraries/TFT/utility/Adafruit_ST7735.h	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/TFT/utility/Adafruit_ST7735.h	2013-06-04 15:58:54.883832010 -0400
@@ -129,8 +129,8 @@
   void     spiwrite(uint8_t),
            writecommand(uint8_t c),
            writedata(uint8_t d),
-           commandList(uint8_t *addr),
-           commonInit(uint8_t *cmdList);
+           commandList(const uint8_t *addr),
+           commonInit(const uint8_t *cmdList);
 //uint8_t  spiread(void);
 
   boolean  hwSPI;
Index: arduino/libraries/Robot_Control/Squawk.cpp
===================================================================
--- arduino.orig/libraries/Robot_Control/Squawk.cpp	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/Robot_Control/Squawk.cpp	2013-06-04 15:58:54.883832010 -0400
@@ -81,7 +81,7 @@
 uint8_t pcm = 128;
 
 // ProTracker period tables
-uint16_t period_tbl[84] PROGMEM = {
+const uint16_t period_tbl[84] PROGMEM = {
   3424, 3232, 3048, 2880, 2712, 2560, 2416, 2280, 2152, 2032, 1920, 1814,
   1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016,  960,  907,
    856,  808,  762,  720,  678,  640,  604,  570,  538,  508,  480,  453,
@@ -92,7 +92,7 @@
 };
 
 // ProTracker sine table
-int8_t sine_tbl[32] PROGMEM = {
+const int8_t sine_tbl[32] PROGMEM = {
   0x00, 0x0C, 0x18, 0x25, 0x30, 0x3C, 0x47, 0x51, 0x5A, 0x62, 0x6A, 0x70, 0x76, 0x7A, 0x7D, 0x7F,
   0x7F, 0x7F, 0x7D, 0x7A, 0x76, 0x70, 0x6A, 0x62, 0x5A, 0x51, 0x47, 0x3C, 0x30, 0x25, 0x18, 0x0C,
 };
@@ -598,4 +598,4 @@
   }
 
   lockout = false;
-}
\ No newline at end of file
+}
Index: arduino/libraries/Robot_Control/SquawkSD.cpp
===================================================================
--- arduino.orig/libraries/Robot_Control/SquawkSD.cpp	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/Robot_Control/SquawkSD.cpp	2013-06-04 15:58:54.883832010 -0400
@@ -13,7 +13,7 @@
 
 static StreamFile file;
 
-extern uint16_t period_tbl[84] PROGMEM;
+const extern uint16_t period_tbl[84] PROGMEM;
 
 void SquawkSynthSD::play(Fat16 melody) {
 	SquawkSynth::pause();
@@ -179,4 +179,4 @@
       out.write(note[2] | (sample[2] == 0 ? 0x00 : 0x80));
     }
   }
-}*/
\ No newline at end of file
+}*/
Index: arduino/libraries/Robot_Control/utility/scripts_Hello_User.h
===================================================================
--- arduino.orig/libraries/Robot_Control/utility/scripts_Hello_User.h	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/Robot_Control/utility/scripts_Hello_User.h	2013-06-04 15:58:54.883832010 -0400
@@ -4,20 +4,20 @@
 //as the ram of Arduino is very tiny, keeping too many string in it
 //can kill the program
 
-prog_char hello_user_script1[] PROGMEM="What's your name?";
-prog_char hello_user_script2[] PROGMEM="Give me a name!";
-prog_char hello_user_script3[] PROGMEM="And the country?";
-prog_char hello_user_script4[] PROGMEM="The city you're in?";
-prog_char hello_user_script5[] PROGMEM="  Plug me to\n\n  your computer\n\n  and start coding!";
-
-prog_char hello_user_script6[] PROGMEM="     Hello User!\n\n It's me, your robot\n\n    I'm alive! <3";
-prog_char hello_user_script7[] PROGMEM="  First I need some\n\n   input from you!";
-prog_char hello_user_script8[] PROGMEM="     Use the knob\n\n   to select letters";
-prog_char hello_user_script9[] PROGMEM="   Use L/R button\n\n to move the cursor,\n\n  middle to confirm";
-prog_char hello_user_script10[] PROGMEM="  Press middle key\n   to continue...";
-prog_char hello_user_script11[] PROGMEM="  Choose \"enter\" to\n\n  finish the input";
+const prog_char hello_user_script1[] PROGMEM="What's your name?";
+const prog_char hello_user_script2[] PROGMEM="Give me a name!";
+const prog_char hello_user_script3[] PROGMEM="And the country?";
+const prog_char hello_user_script4[] PROGMEM="The city you're in?";
+const prog_char hello_user_script5[] PROGMEM="  Plug me to\n\n  your computer\n\n  and start coding!";
+
+const prog_char hello_user_script6[] PROGMEM="     Hello User!\n\n It's me, your robot\n\n    I'm alive! <3";
+const prog_char hello_user_script7[] PROGMEM="  First I need some\n\n   input from you!";
+const prog_char hello_user_script8[] PROGMEM="     Use the knob\n\n   to select letters";
+const prog_char hello_user_script9[] PROGMEM="   Use L/R button\n\n to move the cursor,\n\n  middle to confirm";
+const prog_char hello_user_script10[] PROGMEM="  Press middle key\n   to continue...";
+const prog_char hello_user_script11[] PROGMEM="  Choose \"enter\" to\n\n  finish the input";
 
-PROGMEM const char *scripts_Hello_User[]={
+const char *scripts_Hello_User[]={
   hello_user_script1,
   hello_user_script2,
   hello_user_script3,
@@ -48,4 +48,4 @@
   textManager.writeText(line,col,buffer);
 }
 
-*/
\ No newline at end of file
+*/
Index: arduino/libraries/GSM/GSM3ShieldV1BaseProvider.cpp
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1BaseProvider.cpp	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1BaseProvider.cpp	2013-06-04 15:58:54.883832010 -0400
@@ -12,7 +12,7 @@
 	return theGSM3ShieldV1ModemCore.getCommandError();
 };
 
-void GSM3ShieldV1BaseProvider::prepareAuxLocate(PROGMEM prog_char str[], char auxLocate[])
+void GSM3ShieldV1BaseProvider::prepareAuxLocate(PROGMEM const prog_char str[], char auxLocate[])
 {
 	int i=0;
 	char c;
Index: arduino/libraries/GSM/GSM3ShieldV1BaseProvider.h
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1BaseProvider.h	2013-06-04 15:58:54.891832010 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1BaseProvider.h	2013-06-04 15:58:54.883832010 -0400
@@ -54,7 +54,7 @@
 		@param str			PROGMEN
 		@param auxLocate	Buffer where to locate strings
 	*/
-	void prepareAuxLocate(PROGMEM prog_char str[], char auxLocate[]);
+	void prepareAuxLocate(PROGMEM const prog_char str[], char auxLocate[]);
 
 	/** Manages modem response
 		@param from 		Initial byte of buffer
@@ -70,4 +70,4 @@
 
 };
 
-#endif
\ No newline at end of file
+#endif
Index: arduino/libraries/GSM/GSM3ShieldV1AccessProvider.cpp
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1AccessProvider.cpp	2013-03-18 21:49:27.515574917 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1AccessProvider.cpp	2013-06-04 16:00:44.043834605 -0400
@@ -6,8 +6,8 @@
 #define __TOUTMODEMCONFIGURATION__ 5000//equivalent to 30000 because of time in interrupt routine.
 #define __TOUTAT__ 1000
 
-char _command_AT[] PROGMEM = "AT";
-char _command_CGREG[] PROGMEM = "AT+CGREG?";
+const char _command_AT[] PROGMEM = "AT";
+const char _command_CGREG[] PROGMEM = "AT+CGREG?";
 
 
 GSM3ShieldV1AccessProvider::GSM3ShieldV1AccessProvider(bool debug)
Index: arduino/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp	2013-03-18 21:49:27.519574917 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp	2013-06-04 15:59:25.059832727 -0400
@@ -1,8 +1,8 @@
 #include <GSM3ShieldV1DataNetworkProvider.h>
 #include <Arduino.h>
 
-char _command_CGATT[] PROGMEM = "AT+CGATT=";
-char _command_SEPARATOR[] PROGMEM = "\",\"";
+const char _command_CGATT[] PROGMEM = "AT+CGATT=";
+const char _command_SEPARATOR[] PROGMEM = "\",\"";
 
 //Attach GPRS main function.	
 GSM3_NetworkStatus_t GSM3ShieldV1DataNetworkProvider::attachGPRS(char* apn, char* user_name, char* password, bool synchronous)
Index: arduino/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp	2013-03-18 21:49:27.519574917 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp	2013-06-04 16:01:16.647835379 -0400
@@ -1,7 +1,7 @@
 #include <GSM3ShieldV1MultiClientProvider.h>
 #include <GSM3ShieldV1ModemCore.h>
 
-char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC=";
+const char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC=";
 
 #define __TOUTFLUSH__ 10000
 
Index: arduino/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp	2013-03-18 21:49:27.519574917 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp	2013-06-04 16:02:37.907837311 -0400
@@ -4,7 +4,7 @@
 
 #define __NCLIENTS_MAX__ 3
 
-char _command_QILOCIP[] PROGMEM = "AT+QILOCIP";
+const char _command_QILOCIP[] PROGMEM = "AT+QILOCIP";
 
 GSM3ShieldV1MultiServerProvider::GSM3ShieldV1MultiServerProvider()
 {
Index: arduino/libraries/GSM/GSM3ShieldV1ModemCore.cpp
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1ModemCore.cpp	2013-03-18 21:49:27.519574917 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1ModemCore.cpp	2013-06-04 17:03:11.463923667 -0400
@@ -82,6 +82,13 @@
 }
 
 //Generic command (const string).
+void GSM3ShieldV1ModemCore::genericCommand_rq(const char* str, bool addCR)
+{
+	theBuffer().flush();
+	writePGM(str, addCR);
+}
+
+//Generic command (const string).
 void GSM3ShieldV1ModemCore::genericCommand_rqc(const char* str, bool addCR)
 {
 	theBuffer().flush();
@@ -157,7 +164,7 @@
 
 };
 
-size_t GSM3ShieldV1ModemCore::writePGM(PROGMEM prog_char str[], bool CR)
+size_t GSM3ShieldV1ModemCore::writePGM(PROGMEM const prog_char str[], bool CR)
 {
 	int i=0;
 	char c;
Index: arduino/libraries/GSM/GSM3ShieldV1ModemCore.h
===================================================================
--- arduino.orig/libraries/GSM/GSM3ShieldV1ModemCore.h	2013-03-18 21:49:27.519574917 -0400
+++ arduino/libraries/GSM/GSM3ShieldV1ModemCore.h	2013-06-04 17:03:10.503923645 -0400
@@ -167,7 +167,7 @@
 			@param CR			Carriadge return adding automatically
 			@return size
 		 */
-		virtual size_t writePGM(PROGMEM prog_char str[], bool CR=true);
+		virtual size_t writePGM(PROGMEM const prog_char str[], bool CR=true);
 		
 		/** Establish debug mode
 			@param db			Boolean that indicates debug on or off
@@ -257,4 +257,4 @@
 
 extern GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore;
 
-#endif
\ No newline at end of file
+#endif