Skip to content

Commit

Permalink
const'ed PROGMEM stuff to resolve "[variable] must be const in order …
Browse files Browse the repository at this point in the history
…to be put into read-only section by means of ‘__attribute__((progmem))’" in Arduino 1.6.0.
  • Loading branch information
mithat committed Mar 7, 2015
1 parent 7b58778 commit 02aa4af
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions BigCrystal.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion BigCrystal.h
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions BigFont.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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 "
Expand Down Expand Up @@ -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 '
Expand All @@ -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
Expand Down Expand Up @@ -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
};
16 changes: 8 additions & 8 deletions BigFont.h
Expand Up @@ -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

1 comment on commit 02aa4af

@gregington
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request.

I've made the corresponding changes to BigCrystalTWI as well.

Please sign in to comment.