Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:4b5e234b4f3e, committed 2019-06-13
- Comitter:
- TurkishP
- Date:
- Thu Jun 13 01:08:01 2019 +0000
- Parent:
- 3:1d9df877c90a
- Commit message:
- trying to publish
Changed in this revision
--- a/bold_font.h Sat Feb 09 16:43:49 2013 +0000 +++ b/bold_font.h Thu Jun 13 01:08:01 2019 +0000 @@ -102,7 +102,7 @@ 0x0, 0x0, 0x80, 0xE0, 0x60, 0x0, 0x0, 0x0, // [0x82] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x83] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x84] '' - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x85] ' ' + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x85] ' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x86] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x87] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x88] ''
--- a/ssd1306.cpp Sat Feb 09 16:43:49 2013 +0000 +++ b/ssd1306.cpp Thu Jun 13 01:08:01 2019 +0000 @@ -4,6 +4,8 @@ #include <stdarg.h> +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) + SSD1306::SSD1306(PinName cs, PinName rs, PinName dc, PinName clk, PinName data) : _spi(data, NC, clk), _cs(cs), @@ -243,6 +245,19 @@ _send_data(_screen[i]); } +void SSD1306::drawBitmap(int x, int y, + const unsigned char *bitmap, int w, int h, int color) { + int16_t i, j, byteWidth = (w + 7) / 8; + + for(j=0; j<h; j++) { + for(i=0; i<w; i++ ) { + if(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) { + color? set_pixel(x+i, y+j): clear_pixel(x+i, y+j); + } + } + } +} + void SSD1306::set_pixel(int x, int y) { if (x >= SSD1306_LCDWIDTH || y >= SSD1306_LCDHEIGHT) return;
--- a/ssd1306.h Sat Feb 09 16:43:49 2013 +0000 +++ b/ssd1306.h Thu Jun 13 01:08:01 2019 +0000 @@ -181,7 +181,8 @@ // ----- BUFFER EDITING ----- - void clear(); + void clear(); + void drawBitmap(int x, int y, const unsigned char *bitmap, int w, int h, int color = 1); void set_pixel(int x, int y); void clear_pixel(int x, int y); void line(int x0, int y0, int x1, int y1);
--- a/standard_font.h Sat Feb 09 16:43:49 2013 +0000 +++ b/standard_font.h Thu Jun 13 01:08:01 2019 +0000 @@ -102,7 +102,7 @@ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x82] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x83] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x84] '' - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x85] ' ' + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x85] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x86] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x87] '' 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // [0x88] ''