From 02aa4afc0152ba9f72962f373c75223a3a485c58 Mon Sep 17 00:00:00 2001 From: Mithat Konar Date: Fri, 6 Mar 2015 21:10:56 -0600 Subject: [PATCH] =?UTF-8?q?const'ed=20PROGMEM=20stuff=20to=20resolve=20"[v?= =?UTF-8?q?ariable]=20must=20be=20const=20in=20order=20to=20be=20put=20int?= =?UTF-8?q?o=20read-only=20section=20by=20means=20of=20=E2=80=98=5F=5Fattr?= =?UTF-8?q?ibute=5F=5F((progmem))=E2=80=99"=20in=20Arduino=201.6.0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BigCrystal.cpp | 4 ++-- BigCrystal.h | 2 +- BigFont.c | 16 ++++++++-------- BigFont.h | 16 ++++++++-------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/BigCrystal.cpp b/BigCrystal.cpp index 9368e58..05271c7 100644 --- a/BigCrystal.cpp +++ b/BigCrystal.cpp @@ -52,7 +52,7 @@ uint8_t BigCrystal::writeBig(char c, uint8_t col, uint8_t row) { uint8_t index; getTableCodeAndIndex(ch, tableCode, index); - uint8_t* table = getTable(tableCode); + const uint8_t* table = getTable(tableCode); if (table == NULL) { return 0; } @@ -95,7 +95,7 @@ void BigCrystal::getTableCodeAndIndex(char c, uint8_t& tableCode, uint8_t& index index = (uint8_t) (tableAndIndex & 0x1F); } -uint8_t* BigCrystal::getTable(uint8_t tableCode) { +const uint8_t* BigCrystal::getTable(uint8_t tableCode) { switch (tableCode) { case BF_WIDTH1_TABLE: return BF_width1; diff --git a/BigCrystal.h b/BigCrystal.h index 8c0d543..d6b3c8e 100644 --- a/BigCrystal.h +++ b/BigCrystal.h @@ -99,7 +99,7 @@ class BigCrystal : public Print { private: void createCustomChars(); uint8_t getWidthFromTableCode(uint8_t tableCode); - uint8_t* getTable(uint8_t tableCode); + const uint8_t* getTable(uint8_t tableCode); void getTableCodeAndIndex(char c, uint8_t &tableCode, uint8_t &index); void clearColumn(uint8_t row, uint8_t col); char toUpperCase(char c); diff --git a/BigFont.c b/BigFont.c index d7d37f3..07cfa8e 100644 --- a/BigFont.c +++ b/BigFont.c @@ -24,7 +24,7 @@ //* LMB= lower middle bars(lower middle section of the '8') -uint8_t BF_fontShapes[] PROGMEM = { +const uint8_t BF_fontShapes[] PROGMEM = { //* LT[8] = B00111, B01111, @@ -103,7 +103,7 @@ uint8_t BF_fontShapes[] PROGMEM = { * array for the character width that the data starts. 3 bits for * width and 5 bits for the index. index 0 of this table is for * ASCII 0x20 (space) */ -uint8_t BF_characters[] PROGMEM = { +const uint8_t BF_characters[] PROGMEM = { (BF_WIDTH1_TABLE << 5) | 0, // 0x20 (space) (BF_WIDTH1_TABLE << 5) | 1, // 0x21 ! (BF_WIDTH3_SYMBOLS_TABLE << 5) | 0, // 0x22 " @@ -165,7 +165,7 @@ uint8_t BF_characters[] PROGMEM = { (BF_WIDTH3_TABLE << 5) | 29 // 0x5A Z }; -uint8_t BF_width1[] PROGMEM = { +const uint8_t BF_width1[] PROGMEM = { 0x20, 0x20, // 0x20 space 0x00, 0x04, // 0x21 ! 0x05, 0x20, // 0x27 ' @@ -177,12 +177,12 @@ uint8_t BF_width1[] PROGMEM = { 0x01, 0x05 // 0x3B ; }; -uint8_t BF_width2[] PROGMEM = { +const uint8_t BF_width2[] PROGMEM = { 0x04, 0x04, 0x20, 0x20, // 0x2D - 0x04, 0x04, 0x07, 0x07 // 0x3D = }; -uint8_t BF_width3[] PROGMEM = { +const uint8_t BF_width3[] PROGMEM = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, // 0x30 0, 0x4F O 0x01, 0x02, 0x20, 0x04, 0xFF, 0x04, // 0x31 1 0x06, 0x06, 0x02, 0x03, 0x04, 0x04, // 0x32 2 @@ -215,19 +215,19 @@ uint8_t BF_width3[] PROGMEM = { 0x01, 0x06, 0x05, 0x00, 0x07, 0x04 // 0x5A Z }; -uint8_t BF_width3Symbols[] PROGMEM = { +const uint8_t BF_width3Symbols[] PROGMEM = { 0x05, 0x20, 0x05, 0x20, 0x20, 0x20, // 0x22 " 0x04, 0xFF, 0x04, 0x01, 0xFF, 0x01, // 0x2B + 0x01, 0x06, 0x02, 0x20, 0x07, 0x20 // 0x3F ? }; -uint8_t BF_width4[] PROGMEM = { +const uint8_t BF_width4[] PROGMEM = { 0x00, 0x03, 0x20, 0x02, 0x03, 0x20, 0x02, 0x05, // 0x4E N 0x00, 0x01, 0x02, 0x20, 0x03, 0x04, 0x03, 0x04, // 0x51 Q 0x03, 0x20, 0x20, 0x05, 0x20, 0x03, 0x05, 0x20 // 0x56 V }; -uint8_t BF_width5[] PROGMEM = { +const uint8_t BF_width5[] PROGMEM = { 0x00, 0x01, 0x03, 0x01, 0x02, 0x03, 0x20, 0x20, 0x20, 0x05, // 0x4D M 0x00, 0x20, 0x20, 0x20, 0x02, 0x03, 0x04, 0x00, 0x04, 0x05 // 0x57 W }; diff --git a/BigFont.h b/BigFont.h index 98f2452..f961f5c 100644 --- a/BigFont.h +++ b/BigFont.h @@ -23,13 +23,13 @@ #define BF_WIDTH5_TABLE 0x05 #define BF_WIDTH3_SYMBOLS_TABLE 0x06 -extern uint8_t BF_fontShapes[64] PROGMEM; -extern uint8_t BF_characters[59] PROGMEM; -extern uint8_t BF_width1[18] PROGMEM; -extern uint8_t BF_width2[8] PROGMEM; -extern uint8_t BF_width3[180] PROGMEM; -extern uint8_t BF_width3Symbols[18] PROGMEM; -extern uint8_t BF_width4[24] PROGMEM; -extern uint8_t BF_width5[20] PROGMEM; +const extern uint8_t BF_fontShapes[64] PROGMEM; +const extern uint8_t BF_characters[59] PROGMEM; +const extern uint8_t BF_width1[18] PROGMEM; +const extern uint8_t BF_width2[8] PROGMEM; +const extern uint8_t BF_width3[180] PROGMEM; +const extern uint8_t BF_width3Symbols[18] PROGMEM; +const extern uint8_t BF_width4[24] PROGMEM; +const extern uint8_t BF_width5[20] PROGMEM; #endif