From c26a03e82f9566a64ce1be9410a31dda927b54c5 Mon Sep 17 00:00:00 2001 From: 0xPIT <karl@pitrich.com> Date: Fri, 6 Jan 2017 23:17:59 +0100 Subject: [PATCH] change to uint8_t type --- OLEDDisplay.cpp | 8 ++++---- OLEDDisplay.h | 10 +++++----- OLEDDisplayFonts.h | 8 ++++---- OLEDDisplayUi.cpp | 6 +++--- OLEDDisplayUi.h | 12 ++++++------ examples/SSD1306SimpleDemo/images.h | 2 +- examples/SSD1306UiDemo/images.h | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/OLEDDisplay.cpp b/OLEDDisplay.cpp index 47ecbec..57566d3 100644 --- a/OLEDDisplay.cpp +++ b/OLEDDisplay.cpp @@ -347,11 +347,11 @@ void OLEDDisplay::drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16 fillCircle(xRadius + maxProgressWidth, yRadius, innerRadius); } -void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const unsigned char *image) { +void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *image) { drawInternal(xMove, yMove, width, height, image, 0, 0); } -void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const unsigned char *xbm) { +void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm) { int16_t widthInXbm = (width + 7) / 8; uint8_t data; @@ -525,7 +525,7 @@ void OLEDDisplay::setTextAlignment(OLEDDISPLAY_TEXT_ALIGNMENT textAlignment) { this->textAlignment = textAlignment; } -void OLEDDisplay::setFont(const unsigned char *fontData) { +void OLEDDisplay::setFont(const uint8_t *fontData) { this->fontData = fontData; } @@ -692,7 +692,7 @@ void OLEDDisplay::sendInitCommands(void) { sendCommand(DISPLAYON); } -void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const unsigned char *data, uint16_t offset, uint16_t bytesInData) { +void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *data, uint16_t offset, uint16_t bytesInData) { if (width < 0 || height < 0) return; if (yMove + height < 0 || yMove > DISPLAY_HEIGHT) return; if (xMove + width < 0 || xMove > DISPLAY_WIDTH) return; diff --git a/OLEDDisplay.h b/OLEDDisplay.h index b8067fc..c850694 100644 --- a/OLEDDisplay.h +++ b/OLEDDisplay.h @@ -155,10 +155,10 @@ class OLEDDisplay : public Print { void drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t progress); // Draw a bitmap in the internal image format - void drawFastImage(int16_t x, int16_t y, int16_t width, int16_t height, const unsigned char *image); + void drawFastImage(int16_t x, int16_t y, int16_t width, int16_t height, const uint8_t *image); // Draw a XBM - void drawXbm(int16_t x, int16_t y, int16_t width, int16_t height, const unsigned char *xbm); + void drawXbm(int16_t x, int16_t y, int16_t width, int16_t height, const uint8_t *xbm); /* Text functions */ @@ -184,7 +184,7 @@ class OLEDDisplay : public Print { // Sets the current font. Available default fonts // ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24 - void setFont(const unsigned char *fontData); + void setFont(const uint8_t *fontData); /* Display functions */ @@ -237,7 +237,7 @@ class OLEDDisplay : public Print { OLEDDISPLAY_TEXT_ALIGNMENT textAlignment = TEXT_ALIGN_LEFT; OLEDDISPLAY_COLOR color = WHITE; - const unsigned char *fontData = ArialMT_Plain_10; + const uint8_t *fontData = ArialMT_Plain_10; // State values for logBuffer uint16_t logBufferSize = 0; @@ -259,7 +259,7 @@ class OLEDDisplay : public Print { static char* utf8ascii(String s); static byte utf8ascii(byte ascii); - void inline drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const unsigned char *data, uint16_t offset, uint16_t bytesInData) __attribute__((always_inline)); + void inline drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *data, uint16_t offset, uint16_t bytesInData) __attribute__((always_inline)); void drawStringInternal(int16_t xMove, int16_t yMove, char* text, uint16_t textLength, uint16_t textWidth); diff --git a/OLEDDisplayFonts.h b/OLEDDisplayFonts.h index e885a70..3544edb 100644 --- a/OLEDDisplayFonts.h +++ b/OLEDDisplayFonts.h @@ -1,7 +1,7 @@ #ifndef OLEDDISPLAYFONTS_h #define OLEDDISPLAYFONTS_h -const unsigned char ArialMT_Plain_10[] PROGMEM = { +const uint8_t ArialMT_Plain_10[] PROGMEM = { 0x0A, // Width: 10 0x0D, // Height: 13 0x20, // First Char: 32 @@ -425,7 +425,7 @@ const unsigned char ArialMT_Plain_10[] PROGMEM = { 0x20,0x00,0xC8,0x09,0x00,0x06,0xC8,0x01,0x20 // 255 }; -const unsigned char ArialMT_Plain_16[] PROGMEM = { +const uint8_t ArialMT_Plain_16[] PROGMEM = { 0x10, // Width: 16 0x13, // Height: 19 0x20, // First Char: 32 @@ -848,7 +848,7 @@ const unsigned char ArialMT_Plain_16[] PROGMEM = { 0x00,0x00,0x00,0xF8,0xFF,0x03,0x80,0x20,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x80,0x20,0x00,0x00,0x1F, // 254 0xC0,0x01,0x00,0x00,0x06,0x02,0x10,0x38,0x02,0x00,0xE0,0x01,0x10,0x38,0x00,0x00,0x07,0x00,0xC0 // 255 }; -const unsigned char ArialMT_Plain_24[] PROGMEM = { +const uint8_t ArialMT_Plain_24[] PROGMEM = { 0x18, // Width: 24 0x1C, // Height: 28 0x20, // First Char: 32 @@ -1271,4 +1271,4 @@ const unsigned char ArialMT_Plain_24[] PROGMEM = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x07,0xE0,0xFF,0xFF,0x07,0x00,0x1C,0x18,0x00,0x00,0x06,0x30,0x00,0x00,0x06,0x30,0x00,0x00,0x06,0x30,0x00,0x00,0x0E,0x38,0x00,0x00,0x1C,0x1C,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF0,0x03, // 254 0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x7E,0x00,0x06,0xC0,0xF0,0x01,0x06,0xC0,0x80,0x0F,0x07,0x00,0x00,0xFE,0x03,0x00,0x00,0xFC,0x00,0xC0,0xC0,0x1F,0x00,0xC0,0xF8,0x03,0x00,0x00,0x3E,0x00,0x00,0x00,0x06 // 255 }; -#endif +#endif diff --git a/OLEDDisplayUi.cpp b/OLEDDisplayUi.cpp index cea3bb5..f9b8370 100644 --- a/OLEDDisplayUi.cpp +++ b/OLEDDisplayUi.cpp @@ -90,10 +90,10 @@ void OLEDDisplayUi::setIndicatorPosition(IndicatorPosition pos) { void OLEDDisplayUi::setIndicatorDirection(IndicatorDirection dir) { this->indicatorDirection = dir; } -void OLEDDisplayUi::setActiveSymbol(const unsigned char* symbol) { +void OLEDDisplayUi::setActiveSymbol(const uint8_t* symbol) { this->activeSymbol = symbol; } -void OLEDDisplayUi::setInactiveSymbol(const unsigned char* symbol) { +void OLEDDisplayUi::setInactiveSymbol(const uint8_t* symbol) { this->inactiveSymbol = symbol; } @@ -361,7 +361,7 @@ void OLEDDisplayUi::drawIndicator() { } uint16_t frameStartPos = (12 * frameCount / 2); - const unsigned char *image; + const uint8_t *image; uint16_t x,y; for (byte i = 0; i < this->frameCount; i++) { diff --git a/OLEDDisplayUi.h b/OLEDDisplayUi.h index ac2d9ed..1e6372e 100644 --- a/OLEDDisplayUi.h +++ b/OLEDDisplayUi.h @@ -61,11 +61,11 @@ enum FrameState { }; -const unsigned char ANIMATION_activeSymbol[] PROGMEM = { +const uint8_t ANIMATION_activeSymbol[] PROGMEM = { 0x00, 0x18, 0x3c, 0x7e, 0x7e, 0x3c, 0x18, 0x00 }; -const unsigned char ANIMATION_inactiveSymbol[] PROGMEM = { +const uint8_t ANIMATION_inactiveSymbol[] PROGMEM = { 0x00, 0x0, 0x0, 0x18, 0x18, 0x0, 0x0, 0x00 }; @@ -106,8 +106,8 @@ class OLEDDisplayUi { IndicatorPosition indicatorPosition = BOTTOM; IndicatorDirection indicatorDirection = LEFT_RIGHT; - const unsigned char* activeSymbol = ANIMATION_activeSymbol; - const unsigned char* inactiveSymbol = ANIMATION_inactiveSymbol; + const uint8_t* activeSymbol = ANIMATION_activeSymbol; + const uint8_t* inactiveSymbol = ANIMATION_inactiveSymbol; bool shouldDrawIndicators = true; @@ -240,12 +240,12 @@ class OLEDDisplayUi { /** * Set the symbol to indicate an active frame in the indicator bar. */ - void setActiveSymbol(const unsigned char* symbol); + void setActiveSymbol(const uint8_t* symbol); /** * Set the symbol to indicate an inactive frame in the indicator bar. */ - void setInactiveSymbol(const unsigned char* symbol); + void setInactiveSymbol(const uint8_t* symbol); // Frame settings diff --git a/examples/SSD1306SimpleDemo/images.h b/examples/SSD1306SimpleDemo/images.h index 5526ed4..5041799 100644 --- a/examples/SSD1306SimpleDemo/images.h +++ b/examples/SSD1306SimpleDemo/images.h @@ -1,6 +1,6 @@ #define WiFi_Logo_width 60 #define WiFi_Logo_height 36 -const unsigned char WiFi_Logo_bits[] PROGMEM = { +const uint8_t WiFi_Logo_bits[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, diff --git a/examples/SSD1306UiDemo/images.h b/examples/SSD1306UiDemo/images.h index 662bd1f..2489d1e 100644 --- a/examples/SSD1306UiDemo/images.h +++ b/examples/SSD1306UiDemo/images.h @@ -1,6 +1,6 @@ #define WiFi_Logo_width 60 #define WiFi_Logo_height 36 -const unsigned char WiFi_Logo_bits[] PROGMEM = { +const uint8_t WiFi_Logo_bits[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, @@ -27,7 +27,7 @@ const unsigned char WiFi_Logo_bits[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const unsigned char activeSymbol[] PROGMEM = { +const uint8_t activeSymbol[] PROGMEM = { B00000000, B00000000, B00011000, @@ -38,7 +38,7 @@ const unsigned char activeSymbol[] PROGMEM = { B00011000 }; -const unsigned char inactiveSymbol[] PROGMEM = { +const uint8_t inactiveSymbol[] PROGMEM = { B00000000, B00000000, B00000000, -- GitLab