From 709cc1f78e6be7343f6ed00badb873a9616b66dc Mon Sep 17 00:00:00 2001 From: Sylaina Date: Sun, 18 Feb 2018 06:59:48 +0100 Subject: [PATCH] Update lcd.c add draw bitmap --- lcd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lcd.c b/lcd.c index ec8f370..57ef68c 100644 --- a/lcd.c +++ b/lcd.c @@ -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);