Skip to content

Commit 074dc92

Browse files
committed
Mark character lines array as const
Characters may be defined as static constexpr arrays in a client application, but passing the data to the LiquidLibrary requires a const_cast because it is not flagged const, even if in practice uint8_t are not modified. This PR will allow to remove the const_cast in client code.
1 parent 2d704b6 commit 074dc92

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/LiquidCrystal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void LiquidCrystal::noAutoscroll(void) {
262262

263263
// Allows us to fill the first 8 CGRAM locations
264264
// with custom characters
265-
void LiquidCrystal::createChar(uint8_t location, uint8_t charmap[]) {
265+
void LiquidCrystal::createChar(uint8_t location, const uint8_t charmap[]) {
266266
location &= 0x7; // we only have 8 locations 0-7
267267
command(LCD_SETCGRAMADDR | (location << 3));
268268
for (int i=0; i<8; i++) {

src/LiquidCrystal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LiquidCrystal : public Print {
7878
void noAutoscroll();
7979

8080
void setRowOffsets(int row1, int row2, int row3, int row4);
81-
void createChar(uint8_t, uint8_t[]);
81+
void createChar(uint8_t, const uint8_t[]);
8282
void setCursor(uint8_t, uint8_t);
8383
virtual size_t write(uint8_t);
8484
void command(uint8_t);

0 commit comments

Comments
 (0)