Skip to content

Commit 291115a

Browse files
committed
Merge pull request #1 from mithat/master
const'ed PROGMEM stuff to resolve "[variable] must be const in order to ...
2 parents 7b58778 + 02aa4af commit 291115a

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

BigCrystal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ uint8_t BigCrystal::writeBig(char c, uint8_t col, uint8_t row) {
5252
uint8_t index;
5353
getTableCodeAndIndex(ch, tableCode, index);
5454

55-
uint8_t* table = getTable(tableCode);
55+
const uint8_t* table = getTable(tableCode);
5656
if (table == NULL) {
5757
return 0;
5858
}
@@ -95,7 +95,7 @@ void BigCrystal::getTableCodeAndIndex(char c, uint8_t& tableCode, uint8_t& index
9595
index = (uint8_t) (tableAndIndex & 0x1F);
9696
}
9797

98-
uint8_t* BigCrystal::getTable(uint8_t tableCode) {
98+
const uint8_t* BigCrystal::getTable(uint8_t tableCode) {
9999
switch (tableCode) {
100100
case BF_WIDTH1_TABLE:
101101
return BF_width1;

BigCrystal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class BigCrystal : public Print {
9999
private:
100100
void createCustomChars();
101101
uint8_t getWidthFromTableCode(uint8_t tableCode);
102-
uint8_t* getTable(uint8_t tableCode);
102+
const uint8_t* getTable(uint8_t tableCode);
103103
void getTableCodeAndIndex(char c, uint8_t &tableCode, uint8_t &index);
104104
void clearColumn(uint8_t row, uint8_t col);
105105
char toUpperCase(char c);

BigFont.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//* LMB= lower middle bars(lower middle section of the '8')
2525

2626

27-
uint8_t BF_fontShapes[] PROGMEM = {
27+
const uint8_t BF_fontShapes[] PROGMEM = {
2828
//* LT[8] =
2929
B00111,
3030
B01111,
@@ -103,7 +103,7 @@ uint8_t BF_fontShapes[] PROGMEM = {
103103
* array for the character width that the data starts. 3 bits for
104104
* width and 5 bits for the index. index 0 of this table is for
105105
* ASCII 0x20 (space) */
106-
uint8_t BF_characters[] PROGMEM = {
106+
const uint8_t BF_characters[] PROGMEM = {
107107
(BF_WIDTH1_TABLE << 5) | 0, // 0x20 (space)
108108
(BF_WIDTH1_TABLE << 5) | 1, // 0x21 !
109109
(BF_WIDTH3_SYMBOLS_TABLE << 5) | 0, // 0x22 "
@@ -165,7 +165,7 @@ uint8_t BF_characters[] PROGMEM = {
165165
(BF_WIDTH3_TABLE << 5) | 29 // 0x5A Z
166166
};
167167

168-
uint8_t BF_width1[] PROGMEM = {
168+
const uint8_t BF_width1[] PROGMEM = {
169169
0x20, 0x20, // 0x20 space
170170
0x00, 0x04, // 0x21 !
171171
0x05, 0x20, // 0x27 '
@@ -177,12 +177,12 @@ uint8_t BF_width1[] PROGMEM = {
177177
0x01, 0x05 // 0x3B ;
178178
};
179179

180-
uint8_t BF_width2[] PROGMEM = {
180+
const uint8_t BF_width2[] PROGMEM = {
181181
0x04, 0x04, 0x20, 0x20, // 0x2D -
182182
0x04, 0x04, 0x07, 0x07 // 0x3D =
183183
};
184184

185-
uint8_t BF_width3[] PROGMEM = {
185+
const uint8_t BF_width3[] PROGMEM = {
186186
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, // 0x30 0, 0x4F O
187187
0x01, 0x02, 0x20, 0x04, 0xFF, 0x04, // 0x31 1
188188
0x06, 0x06, 0x02, 0x03, 0x04, 0x04, // 0x32 2
@@ -215,19 +215,19 @@ uint8_t BF_width3[] PROGMEM = {
215215
0x01, 0x06, 0x05, 0x00, 0x07, 0x04 // 0x5A Z
216216
};
217217

218-
uint8_t BF_width3Symbols[] PROGMEM = {
218+
const uint8_t BF_width3Symbols[] PROGMEM = {
219219
0x05, 0x20, 0x05, 0x20, 0x20, 0x20, // 0x22 "
220220
0x04, 0xFF, 0x04, 0x01, 0xFF, 0x01, // 0x2B +
221221
0x01, 0x06, 0x02, 0x20, 0x07, 0x20 // 0x3F ?
222222
};
223223

224-
uint8_t BF_width4[] PROGMEM = {
224+
const uint8_t BF_width4[] PROGMEM = {
225225
0x00, 0x03, 0x20, 0x02, 0x03, 0x20, 0x02, 0x05, // 0x4E N
226226
0x00, 0x01, 0x02, 0x20, 0x03, 0x04, 0x03, 0x04, // 0x51 Q
227227
0x03, 0x20, 0x20, 0x05, 0x20, 0x03, 0x05, 0x20 // 0x56 V
228228
};
229229

230-
uint8_t BF_width5[] PROGMEM = {
230+
const uint8_t BF_width5[] PROGMEM = {
231231
0x00, 0x01, 0x03, 0x01, 0x02, 0x03, 0x20, 0x20, 0x20, 0x05, // 0x4D M
232232
0x00, 0x20, 0x20, 0x20, 0x02, 0x03, 0x04, 0x00, 0x04, 0x05 // 0x57 W
233233
};

BigFont.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
#define BF_WIDTH5_TABLE 0x05
2424
#define BF_WIDTH3_SYMBOLS_TABLE 0x06
2525

26-
extern uint8_t BF_fontShapes[64] PROGMEM;
27-
extern uint8_t BF_characters[59] PROGMEM;
28-
extern uint8_t BF_width1[18] PROGMEM;
29-
extern uint8_t BF_width2[8] PROGMEM;
30-
extern uint8_t BF_width3[180] PROGMEM;
31-
extern uint8_t BF_width3Symbols[18] PROGMEM;
32-
extern uint8_t BF_width4[24] PROGMEM;
33-
extern uint8_t BF_width5[20] PROGMEM;
26+
const extern uint8_t BF_fontShapes[64] PROGMEM;
27+
const extern uint8_t BF_characters[59] PROGMEM;
28+
const extern uint8_t BF_width1[18] PROGMEM;
29+
const extern uint8_t BF_width2[8] PROGMEM;
30+
const extern uint8_t BF_width3[180] PROGMEM;
31+
const extern uint8_t BF_width3Symbols[18] PROGMEM;
32+
const extern uint8_t BF_width4[24] PROGMEM;
33+
const extern uint8_t BF_width5[20] PROGMEM;
3434

3535
#endif

0 commit comments

Comments
 (0)