Fixed B/W fill color

This commit is contained in:
Larry Bank
2024-11-02 17:17:51 +00:00
parent 96d516cb7c
commit 686b0004c4
3 changed files with 18 additions and 9 deletions
+11 -8
View File
@@ -7,7 +7,8 @@
#include "../../../src/bb_epaper.h"
//BBEPAPER bbep(EPD213_104x212); // InkyPHAT 2.13"
BBEPAPER bbep(EPD295_128x296);
// BCM GPIO numbers
//BBEPAPER bbep(EPD154R_152x152);
// BCM GPIO numbers used by Pimoroni e-paper "HATs"
#define PIN_DC 22
#define PIN_RST 27
#define PIN_BUSY 17
@@ -16,18 +17,20 @@ BBEPAPER bbep(EPD295_128x296);
int main(int argc, const char * argv[]) {
bbep.initIO(PIN_DC, PIN_RST, PIN_BUSY, PIN_CS, SPI_BUS, 4000000);
// bbep.allocBuffer();
bbep.initIO(PIN_DC, PIN_RST, PIN_BUSY, PIN_CS, SPI_BUS, 8000000);
bbep.allocBuffer(); // draw into RAM first
bbep.fillScreen(BBEP_WHITE);
bbep.setRotation(90);
bbep.setFont(FONT_16x16);
bbep.setFont(FONT_12x16);
bbep.setTextColor(BBEP_BLACK);
bbep.drawString("Hello World!", 0, 0);
// bbep.writePlane();
bbep.refresh(REFRESH_FULL);
bbep.sleep(DEEP_SLEEP);
bbep.setTextColor(BBEP_RED); // will be black on B/W panels
bbep.drawString("In red!", 0, 16);
bbep.writePlane(); // push the pixels from our RAM buffer to the e-epaper
bbep.refresh(REFRESH_FULL); // do a full refresh (only type possible on B/W/R)
bbep.sleep(DEEP_SLEEP); // turn off the epaper power circuit
return 0;
return 0;
} /* main() */
+6
View File
@@ -1270,6 +1270,12 @@ void bbepFill(BBEPDISP *pBBEP, unsigned char ucData, int iPlane)
} else if (ucData == BBEP_RED) {
uc1 = 0x00; uc2 = 0xff;
}
} else { // B/W
if (ucData == BBEP_WHITE) {
uc1 = uc2 = 0xff;
} else {
uc1 = uc2 = 0x00;
}
}
if (pBBEP->ucScreen) { // there's a local framebuffer, use it
memset(pBBEP->ucScreen, uc1, iSize);
+1 -1
View File
@@ -1090,7 +1090,7 @@ int bbepWriteString(BBEPDISP *pBBEP, int x, int y, char *szMsg, int iSize, int i
}
#endif
}
pBBEP->iCursorX += iLen;
x = pBBEP->iCursorX += iLen;
if (pBBEP->iCursorX >= pBBEP->width-11 && pBBEP->wrap) // word wrap enabled?
{
x = pBBEP->iCursorX = 0; // start at the beginning of the next line