Skip to content

Commit 709cc1f

Browse files
authored
Update lcd.c
add draw bitmap
1 parent a9caa93 commit 709cc1f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lcd.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,16 @@ void lcd_fillCircle(uint8_t center_x, uint8_t center_y, uint8_t radius, uint8_t
547547
lcd_drawCircle(center_x, center_y, i, color);
548548
}
549549
}
550+
void lcd_drawBitmap(uint8_t x, uint8_t y, const uint8_t *picture, uint8_t width, uint8_t height, uint8_t color){
551+
uint8_t i,j, byteWidth = (width+7)/8;
552+
for (j = 0; j < height; j++) {
553+
for(i=0; i < width;i++){
554+
if(pgm_read_byte(picture + j * byteWidth + i / 8) & (128 >> (i & 7))){
555+
lcd_drawPixel(x+i, y+j, color);
556+
}
557+
}
558+
}
559+
}
550560
void lcd_display() {
551561
#if defined SSD1306
552562
lcd_gotoxy(0,0);

0 commit comments

Comments
 (0)