Skip to content

Commit 2e7189a

Browse files
Laurence BankLaurence Bank
authored andcommitted
Fixed conflict with bb_epaper
1 parent 995a720 commit 2e7189a

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=OneBitDisplay
2-
version=2.3.2
2+
version=2.3.3
33
author=Larry Bank
44
maintainer=Larry Bank
55
sentence=OLED, LCD and e-paper library for 1-bit per pixel displays.

src/obd.inl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
// obd.inl
1818
// display interfacing/control code for OneBitDisplay library
1919
//
20+
#ifdef __AVR__
21+
#define WIMPY_MCU
22+
#endif
23+
2024
#if defined(_LINUX_) || defined(ARDUINO_ARCH_MCS51)
2125
#define memcpy_P memcpy
2226
#endif
@@ -32,7 +36,6 @@ static void EPDWriteImage(OBDISP *pOBD, uint8_t ucCMD, uint8_t *pBits, int x, in
3236
void EPD213_Begin(OBDISP *pOBD, int x, int y, int w, int h, int bPartial);
3337
void EPD_CMD2(OBDISP *pOBD, uint8_t cmd, uint8_t param);
3438
void obdSetDCMode(OBDISP *pOBD, int iMode);
35-
void InvertBytes(uint8_t *pData, uint8_t bLen);
3639
void SPI_BitBang(OBDISP *pOBD, uint8_t *pData, int iLen, uint8_t iMOSIPin, uint8_t iSCKPin);
3740
static void RawWrite(OBDISP *pOBD, unsigned char *pData, int iLen);
3841
void RawWriteData(OBDISP *pOBD, unsigned char *pData, int iLen);
@@ -2057,6 +2060,7 @@ void obdSPIInit(OBDISP *pOBD, int iType, int iDC, int iCS, int iReset, int iMOSI
20572060
pOBD->iFlags |= (OBD_HAS_PARTIAL_UPDATE | OBD_HAS_FAST_UPDATE);
20582061
pOBD->can_flip = 0;
20592062
return; // nothing else to do yet
2063+
#ifndef WIMPY_MCU
20602064
} else if (iType == EPD29_BWYR_128x296) {
20612065
pOBD->native_width = pOBD->width = 128;
20622066
pOBD->native_height = pOBD->height = 296;
@@ -2122,6 +2126,7 @@ void obdSPIInit(OBDISP *pOBD, int iType, int iDC, int iCS, int iReset, int iMOSI
21222126
pOBD->iTimeout = 20000; // 4-color need a longer timeout (20 seconds)
21232127
pOBD->pInitFull = epd30_bwyr_init_sequence_full;
21242128
return;
2129+
#endif // !WIMPY_MCU
21252130
} else if (iType == EPD213_122x250 || iType == EPD213_104x212 || iType == EPD29B_128x296)
21262131
{
21272132
if (iType == EPD213_122x250) {
@@ -3040,9 +3045,11 @@ static int EPDDumpPartial(OBDISP *pOBD, uint8_t *pBuffer, int x, int y, int w, i
30403045
EPDSendCMDSequence(pOBD, pOBD->pInitPart);
30413046
if (pOBD->chip_type == OBD_CHIP_UC8151) {
30423047
int iSize = pOBD->width * ((pOBD->height+7)>>3);
3048+
#ifndef WIMPY_MCU
30433049
EPDWriteImage(pOBD, 0x10, &pOBD->ucScreen[iSize], 0,0,pOBD->width, pOBD->height, pOBD->iFlags & OBD_FAST_INVERTED); // write old data inverted
30443050
EPDWriteImage(pOBD, 0x13, NULL, 0, 0, pOBD->width, pOBD->height, pOBD->iFlags & OBD_FAST_INVERTED);
30453051
memcpy(&pOBD->ucScreen[iSize], pOBD->ucScreen, iSize); // new becomes old
3052+
#endif // WIMPY_MCU
30463053
lTime = millis() - lTime;
30473054
pOBD->iDataTime = (int)lTime;
30483055
lTime = millis();
@@ -3054,7 +3061,9 @@ static int EPDDumpPartial(OBDISP *pOBD, uint8_t *pBuffer, int x, int y, int w, i
30543061
pOBD->iOpTime = (int)lTime;
30553062
return 0;
30563063
} else { // SSD16xx
3064+
#ifndef WIMPY_MCU
30573065
EPDWriteImage(pOBD, 0x24, NULL, 0, 0, pOBD->width, pOBD->height, pOBD->iFlags & OBD_FAST_INVERTED);
3066+
#endif
30583067
EPD_CMD2(pOBD, 0x22, 0xff);
30593068
lTime = millis() - lTime;
30603069
pOBD->iDataTime = (int)lTime;
@@ -3631,8 +3640,10 @@ static int EPDDumpBuffer(OBDISP *pOBD, int bRefresh, int bWait, int bFast)
36313640
pBuf1 = pOBD->ucScreen; // B/W plane
36323641
pBuf2 = &pOBD->ucScreen[iSize]; // R plane
36333642
}
3643+
#ifndef WIMPY_MCU
36343644
EPDWriteImage(pOBD, UC8151_DTM1, pBuf1, 0, 0, pOBD->width, pOBD->height, 0); // B/W or 'old' plane
36353645
EPDWriteImage(pOBD, UC8151_DTM2, pBuf2, 0, 0, pOBD->width, pOBD->height, bInvert); // R or 'new' plane
3646+
#endif
36363647
}
36373648
lTime = millis() - lTime;
36383649
pOBD->iDataTime = (int)lTime; // record the time to xfer data
@@ -3651,13 +3662,17 @@ static int EPDDumpBuffer(OBDISP *pOBD, int bRefresh, int bWait, int bFast)
36513662
pBuf2 = &pOBD->ucScreen[iSize]; // R plane
36523663
bInvert = 1; // invert the R plane
36533664
}
3665+
#ifndef WIMPY_MCU
36543666
EPDWriteImage(pOBD, SSD1608_WRITE_ALTRAM, pBuf2, 0, 0, pOBD->width, pOBD->height, bInvert);
3667+
#endif
36553668
// need to reset the write pointer between planes
36563669
EPD_CMD2(pOBD, SSD1608_SET_RAMXCOUNT, 0x00);
36573670
ucTemp[0] = ucTemp[1] = 0;
36583671
obdWriteCommand(pOBD, SSD1608_SET_RAMYCOUNT);
36593672
RawWriteData(pOBD, ucTemp, 2);
3673+
#ifndef WIMPY_MCU
36603674
EPDWriteImage(pOBD, SSD1608_WRITE_RAM, pBuf1, 0, 0, pOBD->width, pOBD->height, 0);
3675+
#endif
36613676
}
36623677
lTime = millis() - lTime; // record data xfer time
36633678
pOBD->iDataTime = (int)lTime;
@@ -3723,7 +3738,9 @@ static int EPDDumpBuffer(OBDISP *pOBD, int bRefresh, int bWait, int bFast)
37233738
obdWriteCommand(pOBD, 0x04);
37243739
EPDWaitBusy(pOBD, 0);
37253740
}
3741+
#ifndef WIMPY_MCU
37263742
EPDWriteImage2bpp(pOBD, 0x10, 0, 0, pOBD->width, pOBD->height);
3743+
#endif
37273744
}
37283745
if (pOBD->type == EPD164_BWYR_168x168 || pOBD->type == EPD236_BWYR_168x296) {
37293746
EPD_CMD2(pOBD, 0x68, 0x00);
@@ -3732,9 +3749,11 @@ static int EPDDumpBuffer(OBDISP *pOBD, int bRefresh, int bWait, int bFast)
37323749
}
37333750
if (pOBD->type == EPD266_BWYR_184x360 || pOBD->type == EPD29_BWYR_168x384 || pOBD->type == EPD29_BWYR_128x296) {
37343751
EPDSendCMDSequence(pOBD, pOBD->pInitFull);
3752+
#ifndef WIMPY_MCU
37353753
if (pOBD->ucScreen) {
37363754
EPDWriteImage2bpp(pOBD, 0x10, 0, 0, pOBD->width, pOBD->height);
37373755
}
3756+
#endif
37383757
EPD_CMD2(pOBD, 0x12, 0x00); // display refresh
37393758
}
37403759
if (pOBD->type == EPD42R2_400x300) {

src/obd_gfx.inl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// obd_gfx.inl - graphics functions
1818
//
1919
// forward declarations
20-
void InvertBytes(uint8_t *pData, uint8_t bLen);
20+
void obdInvertBytes(uint8_t *pData, uint8_t bLen);
2121

2222
const uint8_t ucFont[]PROGMEM = {
2323
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x5f,0x5f,0x06,0x00,
@@ -985,7 +985,7 @@ void obdDrawTile(OBDISP *pOBD, const uint8_t *pTile, int x, int y, int iRotation
985985
} // for i
986986
} // for j
987987
}
988-
if (bInvert) InvertBytes(ucTemp, 32);
988+
if (bInvert) obdInvertBytes(ucTemp, 32);
989989
// Send the data to the display
990990
obdSetPosition(pOBD, x, y, bRender);
991991
obdWriteDataBlock(pOBD, ucTemp, 16, bRender); // top half
@@ -1087,15 +1087,15 @@ int iPitch, iSize;
10871087
//
10881088
// Invert font data
10891089
//
1090-
void InvertBytes(uint8_t *pData, uint8_t bLen)
1090+
void obdInvertBytes(uint8_t *pData, uint8_t bLen)
10911091
{
10921092
uint8_t i;
10931093
for (i=0; i<bLen; i++)
10941094
{
10951095
*pData = ~(*pData);
10961096
pData++;
10971097
}
1098-
} /* InvertBytes() */
1098+
} /* obdInvertBytes() */
10991099

11001100
//
11011101
// Load a 1-bpp Windows bitmap
@@ -1400,7 +1400,7 @@ int iFontWidth;
14001400
// we can't directly use the pointer to FLASH memory, so copy to a local buffer
14011401
ucTemp[0] = 0; // first column is blank
14021402
memcpy_P(&ucTemp[1], &s[iFontOff], iFontWidth-1);
1403-
// if (iColor == OBD_WHITE) InvertBytes(ucTemp, iFontWidth);
1403+
// if (iColor == OBD_WHITE) obdInvertBytes(ucTemp, iFontWidth);
14041404
col = 0;
14051405
for (tx=0; tx<(int)dx; tx++) {
14061406
row = 0;
@@ -1510,7 +1510,7 @@ int iOldFG; // old fg color to make sure red works
15101510
// we can't directly use the pointer to FLASH memory, so copy to a local buffer
15111511
u8Temp[0] = 0; // first column is blank
15121512
memcpy_P(&u8Temp[1], &ucFont[iFontOff], 7);
1513-
if (iColor == OBD_WHITE) InvertBytes(u8Temp, 8);
1513+
if (iColor == OBD_WHITE) obdInvertBytes(u8Temp, 8);
15141514
iLen = 8 - iFontSkip;
15151515
if (pOBD->iCursorX + iLen > pOBD->width) // clip right edge
15161516
iLen = pOBD->width - pOBD->iCursorX;
@@ -1549,19 +1549,19 @@ int iOldFG; // old fg color to make sure red works
15491549
// we can't directly use the pointer to FLASH memory, so copy to a local buffer
15501550
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY, bRender);
15511551
memcpy_P(u8Cache, s, 16);
1552-
if (iColor == OBD_WHITE) InvertBytes(u8Cache, 16);
1552+
if (iColor == OBD_WHITE) obdInvertBytes(u8Cache, 16);
15531553
obdWriteDataBlock(pOBD, &u8Cache[iFontSkip], iLen, bRender); // write character pattern
15541554
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+8, bRender);
15551555
memcpy_P(u8Cache, s+16, 16);
1556-
if (iColor == OBD_WHITE) InvertBytes(u8Cache, 16);
1556+
if (iColor == OBD_WHITE) obdInvertBytes(u8Cache, 16);
15571557
obdWriteDataBlock(pOBD, &u8Cache[iFontSkip], iLen, bRender); // write character pattern
15581558
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+16, bRender);
15591559
memcpy_P(u8Cache, s+32, 16);
1560-
if (iColor == OBD_WHITE) InvertBytes(u8Cache, 16);
1560+
if (iColor == OBD_WHITE) obdInvertBytes(u8Cache, 16);
15611561
obdWriteDataBlock(pOBD, &u8Cache[iFontSkip], iLen, bRender); // write character pattern
15621562
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+24, bRender);
15631563
memcpy_P(u8Cache, s+48, 16);
1564-
if (iColor == OBD_WHITE) InvertBytes(u8Cache, 16);
1564+
if (iColor == OBD_WHITE) obdInvertBytes(u8Cache, 16);
15651565
obdWriteDataBlock(pOBD, &u8Cache[iFontSkip], iLen, bRender); // write character pattern
15661566
pOBD->iCursorX += iLen;
15671567
if (pOBD->iCursorX >= pOBD->width-15 && pOBD->wrap) // word wrap enabled?
@@ -1594,7 +1594,7 @@ int iOldFG; // old fg color to make sure red works
15941594
u8Temp[0] = 0; // first column is blank
15951595
memcpy_P(&u8Temp[1], s, 7);
15961596
if (iColor == OBD_WHITE)
1597-
InvertBytes(u8Temp, 8);
1597+
obdInvertBytes(u8Temp, 8);
15981598
// Stretch the font to double width + double height
15991599
memset(&u8Temp[8], 0, 32); // write 32 new bytes
16001600
for (tx=0; tx<8; tx++)
@@ -1654,7 +1654,7 @@ int iOldFG; // old fg color to make sure red works
16541654
u8Temp[0] = 0; // first column is blank
16551655
memcpy_P(&u8Temp[1], s, 6);
16561656
if (iColor == OBD_WHITE)
1657-
InvertBytes(u8Temp, 6);
1657+
obdInvertBytes(u8Temp, 6);
16581658
// Stretch the font to double width + double height
16591659
memset(&u8Temp[6], 0, 24); // write 24 new bytes
16601660
for (tx=0; tx<6; tx++)
@@ -1788,7 +1788,7 @@ int iOldFG; // old fg color to make sure red works
17881788
// we can't directly use the pointer to FLASH memory, so copy to a local buffer
17891789
u8Temp[0] = 0; // first column is blank
17901790
memcpy_P(&u8Temp[1], &ucSmallFont[(int)c*5], 5);
1791-
if (iColor == OBD_WHITE) InvertBytes(u8Temp, 6);
1791+
if (iColor == OBD_WHITE) obdInvertBytes(u8Temp, 6);
17921792
iLen = 6 - iFontSkip;
17931793
if (pOBD->iCursorX + iLen > pOBD->width) // clip right edge
17941794
iLen = pOBD->width - pOBD->iCursorX;

0 commit comments

Comments
 (0)