Skip to content

Commit

Permalink
Compatibility with current HEAD versions of Adafruit GFX and Adafruit…
Browse files Browse the repository at this point in the history
… BusIO.
  • Loading branch information
kiki-lamb committed Nov 25, 2020
1 parent 194a45a commit d9adc52
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
32 changes: 16 additions & 16 deletions STM32F1/libraries/Adafruit_GFX_AS/Adafruit_GFX_AS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ byte line = 0;
for(int16_t i=0; i<height; i++)
{
if (textcolor != textbgcolor) {
if (textsize == 1) drawFastHLine(x, pY, width+gap, textbgcolor);
else fillRect(x, pY, (width+gap)*textsize, textsize, textbgcolor);
if (textsize_x == 1) drawFastHLine(x, pY, width+gap, textbgcolor);
else fillRect(x, pY, (width+gap)*textsize_x, textsize_x, textbgcolor);
}
for (int16_t k = 0;k < w; k++)
{
line = pgm_read_byte(flash_address+w*i+k);
if(line) {
if (textsize==1){
if (textsize_x==1){
pX = x + k*8;
if(line & 0x80) drawPixel(pX, pY, textcolor);
if(line & 0x40) drawPixel(pX+1, pY, textcolor);
Expand All @@ -158,21 +158,21 @@ for(int16_t i=0; i<height; i++)
if(line & 0x1) drawPixel(pX+7, pY, textcolor);
}
else {
pX = x + k*8*textsize;
if(line & 0x80) fillRect(pX, pY, textsize, textsize, textcolor);
if(line & 0x40) fillRect(pX+textsize, pY, textsize, textsize, textcolor);
if(line & 0x20) fillRect(pX+2*textsize, pY, textsize, textsize, textcolor);
if(line & 0x10) fillRect(pX+3*textsize, pY, textsize, textsize, textcolor);
if(line & 0x8) fillRect(pX+4*textsize, pY, textsize, textsize, textcolor);
if(line & 0x4) fillRect(pX+5*textsize, pY, textsize, textsize, textcolor);
if(line & 0x2) fillRect(pX+6*textsize, pY, textsize, textsize, textcolor);
if(line & 0x1) fillRect(pX+7*textsize, pY, textsize, textsize, textcolor);
pX = x + k*8*textsize_x;
if(line & 0x80) fillRect(pX, pY, textsize_x, textsize_x, textcolor);
if(line & 0x40) fillRect(pX+textsize_x, pY, textsize_x, textsize_x, textcolor);
if(line & 0x20) fillRect(pX+2*textsize_x, pY, textsize_x, textsize_x, textcolor);
if(line & 0x10) fillRect(pX+3*textsize_x, pY, textsize_x, textsize_x, textcolor);
if(line & 0x8) fillRect(pX+4*textsize_x, pY, textsize_x, textsize_x, textcolor);
if(line & 0x4) fillRect(pX+5*textsize_x, pY, textsize_x, textsize_x, textcolor);
if(line & 0x2) fillRect(pX+6*textsize_x, pY, textsize_x, textsize_x, textcolor);
if(line & 0x1) fillRect(pX+7*textsize_x, pY, textsize_x, textsize_x, textcolor);
}
}
}
pY+=textsize;
pY+=textsize_x;
}
return (width+gap)*textsize; // x +
return (width+gap)*textsize_x; // x +
}

/***************************************************************************************
Expand Down Expand Up @@ -246,7 +246,7 @@ int16_t Adafruit_GFX_AS::drawCentreString(char *string, int16_t dX, int16_t poY,
#endif
*pointer++;
}
len = len*textsize;
len = len*textsize_x;
int16_t poX = dX - len/2;

if (poX < 0) poX = 0;
Expand Down Expand Up @@ -297,7 +297,7 @@ int16_t Adafruit_GFX_AS::drawRightString(char *string, int16_t dX, int16_t poY,
*pointer++;
}

len = len*textsize;
len = len*textsize_x;
int16_t poX = dX - len;

if (poX < 0) poX = 0;
Expand Down
6 changes: 6 additions & 0 deletions STM32F1/libraries/SPI/src/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ class SPIClass {
*/
void write(const void * buffer, uint32 length);

// Some libraries (like recent Adafruit graphics libraries) require
// the write function be availabe under the name transfer, so here it is:
inline void transfer(const void * buffer, size_t length) {
write((uint32_t)buffer, length);
}

/**
* @brief Transmit a byte, then return the next unread byte.
*
Expand Down

0 comments on commit d9adc52

Please sign in to comment.