From d984592654b4f4d449a423ff04dc25b27c13b04f Mon Sep 17 00:00:00 2001 From: Scott Howard Date: Tue, 4 Jun 2013 17:48:51 -0400 Subject: [PATCH] newer fcc requries PROGMEM variables to be consts --- libraries/GSM/GSM3ShieldV1AccessProvider.cpp | 4 +-- libraries/GSM/GSM3ShieldV1BaseProvider.cpp | 2 +- libraries/GSM/GSM3ShieldV1BaseProvider.h | 4 +-- .../GSM/GSM3ShieldV1DataNetworkProvider.cpp | 4 +-- libraries/GSM/GSM3ShieldV1ModemCore.cpp | 9 ++++++- libraries/GSM/GSM3ShieldV1ModemCore.h | 4 +-- .../GSM/GSM3ShieldV1MultiClientProvider.cpp | 2 +- .../GSM/GSM3ShieldV1MultiServerProvider.cpp | 2 +- libraries/Robot_Control/Squawk.cpp | 6 ++--- libraries/Robot_Control/SquawkSD.cpp | 4 +-- libraries/Robot_Control/glcdfont.c | 2 +- .../utility/scripts_Hello_User.h | 26 +++++++++---------- libraries/TFT/utility/Adafruit_ST7735.cpp | 6 ++--- libraries/TFT/utility/Adafruit_ST7735.h | 4 +-- libraries/TFT/utility/glcdfont.c | 2 +- 15 files changed, 44 insertions(+), 37 deletions(-) diff --git a/libraries/GSM/GSM3ShieldV1AccessProvider.cpp b/libraries/GSM/GSM3ShieldV1AccessProvider.cpp index 67ae75553c6..d628c905555 100644 --- a/libraries/GSM/GSM3ShieldV1AccessProvider.cpp +++ b/libraries/GSM/GSM3ShieldV1AccessProvider.cpp @@ -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) diff --git a/libraries/GSM/GSM3ShieldV1BaseProvider.cpp b/libraries/GSM/GSM3ShieldV1BaseProvider.cpp index d63967be3b0..9ed11656f2e 100644 --- a/libraries/GSM/GSM3ShieldV1BaseProvider.cpp +++ b/libraries/GSM/GSM3ShieldV1BaseProvider.cpp @@ -12,7 +12,7 @@ int GSM3ShieldV1BaseProvider::ready() 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; diff --git a/libraries/GSM/GSM3ShieldV1BaseProvider.h b/libraries/GSM/GSM3ShieldV1BaseProvider.h index 802d46cbd6e..f62fc1deac8 100644 --- a/libraries/GSM/GSM3ShieldV1BaseProvider.h +++ b/libraries/GSM/GSM3ShieldV1BaseProvider.h @@ -54,7 +54,7 @@ class GSM3ShieldV1BaseProvider @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 @@ class GSM3ShieldV1BaseProvider }; -#endif \ No newline at end of file +#endif diff --git a/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp b/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp index aaffdba6ec7..f0b732a741b 100644 --- a/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp +++ b/libraries/GSM/GSM3ShieldV1DataNetworkProvider.cpp @@ -1,8 +1,8 @@ #include #include -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) diff --git a/libraries/GSM/GSM3ShieldV1ModemCore.cpp b/libraries/GSM/GSM3ShieldV1ModemCore.cpp index c90ff4dd49d..e0a4f6c4b04 100644 --- a/libraries/GSM/GSM3ShieldV1ModemCore.cpp +++ b/libraries/GSM/GSM3ShieldV1ModemCore.cpp @@ -81,6 +81,13 @@ void GSM3ShieldV1ModemCore::genericCommand_rq(PROGMEM prog_char str[], bool addC writePGM(str, addCR); } +//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) { @@ -157,7 +164,7 @@ void GSM3ShieldV1ModemCore::openCommand(GSM3ShieldV1BaseProvider* provider, GSM3 }; -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; diff --git a/libraries/GSM/GSM3ShieldV1ModemCore.h b/libraries/GSM/GSM3ShieldV1ModemCore.h index f9efce7286b..63d50676280 100644 --- a/libraries/GSM/GSM3ShieldV1ModemCore.h +++ b/libraries/GSM/GSM3ShieldV1ModemCore.h @@ -167,7 +167,7 @@ class GSM3ShieldV1ModemCore : public GSM3SoftSerialMgr, public Print @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 @@ class GSM3ShieldV1ModemCore : public GSM3SoftSerialMgr, public Print extern GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore; -#endif \ No newline at end of file +#endif diff --git a/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp b/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp index 797424f03be..c2fd72d4659 100644 --- a/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp +++ b/libraries/GSM/GSM3ShieldV1MultiClientProvider.cpp @@ -1,7 +1,7 @@ #include #include -char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC="; +const char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC="; #define __TOUTFLUSH__ 10000 diff --git a/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp b/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp index 6a915f29d65..de74b4973ee 100644 --- a/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp +++ b/libraries/GSM/GSM3ShieldV1MultiServerProvider.cpp @@ -4,7 +4,7 @@ #define __NCLIENTS_MAX__ 3 -char _command_QILOCIP[] PROGMEM = "AT+QILOCIP"; +const char _command_QILOCIP[] PROGMEM = "AT+QILOCIP"; GSM3ShieldV1MultiServerProvider::GSM3ShieldV1MultiServerProvider() { diff --git a/libraries/Robot_Control/Squawk.cpp b/libraries/Robot_Control/Squawk.cpp index 5b39ebea1ac..55b6b995c11 100644 --- a/libraries/Robot_Control/Squawk.cpp +++ b/libraries/Robot_Control/Squawk.cpp @@ -81,7 +81,7 @@ osc_t osc[4]; 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 @@ uint16_t period_tbl[84] PROGMEM = { }; // 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 @@ void squawk_playroutine() { } lockout = false; -} \ No newline at end of file +} diff --git a/libraries/Robot_Control/SquawkSD.cpp b/libraries/Robot_Control/SquawkSD.cpp index 3c97ef43a99..365cdc5fbb4 100644 --- a/libraries/Robot_Control/SquawkSD.cpp +++ b/libraries/Robot_Control/SquawkSD.cpp @@ -13,7 +13,7 @@ class StreamFile : public SquawkStream { 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 @@ void SquawkSynthSD::convert(Fat16 in, Fat16 out) { out.write(note[2] | (sample[2] == 0 ? 0x00 : 0x80)); } } -}*/ \ No newline at end of file +}*/ diff --git a/libraries/Robot_Control/glcdfont.c b/libraries/Robot_Control/glcdfont.c index abc36317ead..ebf7472ba41 100644 --- a/libraries/Robot_Control/glcdfont.c +++ b/libraries/Robot_Control/glcdfont.c @@ -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, diff --git a/libraries/Robot_Control/utility/scripts_Hello_User.h b/libraries/Robot_Control/utility/scripts_Hello_User.h index 29f085f1cf4..12a71f6c2a5 100644 --- a/libraries/Robot_Control/utility/scripts_Hello_User.h +++ b/libraries/Robot_Control/utility/scripts_Hello_User.h @@ -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!"; +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!"; -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_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 @@ void writeScript(int seq, int line, int col){ textManager.writeText(line,col,buffer); } -*/ \ No newline at end of file +*/ diff --git a/libraries/TFT/utility/Adafruit_ST7735.cpp b/libraries/TFT/utility/Adafruit_ST7735.cpp index ed57bf72bdd..f16642e36b8 100755 --- a/libraries/TFT/utility/Adafruit_ST7735.cpp +++ b/libraries/TFT/utility/Adafruit_ST7735.cpp @@ -97,7 +97,7 @@ void Adafruit_ST7735::writedata(uint8_t c) { // 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 @@ PROGMEM static prog_uchar // 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 @@ void Adafruit_ST7735::commandList(uint8_t *addr) { // 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 diff --git a/libraries/TFT/utility/Adafruit_ST7735.h b/libraries/TFT/utility/Adafruit_ST7735.h index c0d5de08662..1aa4efebc0c 100755 --- a/libraries/TFT/utility/Adafruit_ST7735.h +++ b/libraries/TFT/utility/Adafruit_ST7735.h @@ -129,8 +129,8 @@ class Adafruit_ST7735 : public Adafruit_GFX { 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; diff --git a/libraries/TFT/utility/glcdfont.c b/libraries/TFT/utility/glcdfont.c index a325057214f..9527e35588d 100644 --- a/libraries/TFT/utility/glcdfont.c +++ b/libraries/TFT/utility/glcdfont.c @@ -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,