Skip to content

Commit

Permalink
Update lcd.c
Browse files Browse the repository at this point in the history
add draw bitmap
  • Loading branch information
Sylaina committed Feb 18, 2018
1 parent a9caa93 commit 709cc1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lcd.c
Expand Up @@ -547,6 +547,16 @@ void lcd_fillCircle(uint8_t center_x, uint8_t center_y, uint8_t radius, uint8_t
lcd_drawCircle(center_x, center_y, i, color);
}
}
void lcd_drawBitmap(uint8_t x, uint8_t y, const uint8_t *picture, uint8_t width, uint8_t height, uint8_t color){
uint8_t i,j, byteWidth = (width+7)/8;
for (j = 0; j < height; j++) {
for(i=0; i < width;i++){
if(pgm_read_byte(picture + j * byteWidth + i / 8) & (128 >> (i & 7))){
lcd_drawPixel(x+i, y+j, color);
}
}
}
}
void lcd_display() {
#if defined SSD1306
lcd_gotoxy(0,0);
Expand Down

0 comments on commit 709cc1f

Please sign in to comment.