Skip to content

Commit

Permalink
Also accept char* pointer for fonts (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
ropg authored Mar 18, 2024
1 parent 2ef5428 commit 906d0c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/OLEDDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,10 @@ void OLEDDisplay::setFont(const uint8_t *fontData) {
setLogBuffer();
}

void OLEDDisplay::setFont(const char *fontData) {
setFont(static_cast<const uint8_t*>(reinterpret_cast<const void*>(fontData)));
}

void OLEDDisplay::displayOn(void) {
sendCommand(DISPLAYON);
}
Expand Down
3 changes: 3 additions & 0 deletions src/OLEDDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ class OLEDDisplay : public Stream {
// ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24
void setFont(const uint8_t *fontData);

// Set the current font when supplied as a char* instead of a uint8_t*
void setFont(const char *fontData);

// Set the function that will convert utf-8 to font table index
void setFontTableLookupFunction(FontTableLookupFunction function);

Expand Down

0 comments on commit 906d0c5

Please sign in to comment.