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.
Diff: SSD1606/ssd1606.cpp
- Revision:
- 3:1fa000d4da94
- Parent:
- 2:bb9f154ea2f4
diff -r bb9f154ea2f4 -r 1fa000d4da94 SSD1606/ssd1606.cpp --- a/SSD1606/ssd1606.cpp Mon Jun 09 11:01:38 2014 +0000 +++ b/SSD1606/ssd1606.cpp Wed Jun 11 09:12:36 2014 +0000 @@ -49,21 +49,23 @@ _reset = 1; wait_ms(1); _reset = 0; - wait_ms(5); + wait_ms(1); _reset = 1; - wait_ms(5); + wait_ms(1); } void SSD1606::read_busy() { - while(_busy==1){ - wait_ms(1); + while(1) + { + asm("nop"); + if(_busy==0) + break; } } void SSD1606::initialize() { - reset(); _send_command(0x10); _send_data(0x00); #ifdef MODE3 @@ -196,7 +198,7 @@ void SSD1606::clear() { - for (int i=0; i<FRAMEBUF_SIZE; i++) + for (int i=0; i<3096; i++) _send_data(0xFF); _cursor_x = 0; _cursor_y = 0; @@ -204,18 +206,21 @@ void SSD1606::_vspi_write(unsigned char value) { + unsigned char tmp; + tmp = value; + for (int i=0; i<8; i++) { - if(value & 0x80) + if(tmp & 0x80) { _data = 1; }else{ _data = 0; } - _data = _data<<1; _clk = 1; wait_us(SPI_BUS_DELAY); _clk = 0; + tmp = tmp<<1; } } @@ -258,9 +263,9 @@ { int i = 0; unsigned char x, y; - for (x=0; x<SSD1606_LCDHEIGHT; x++) + for (x=0; x<SSD1606_WIDTH; x++) { - for (y=0; y<SSD1606_LCDWIDTH; y++) + for (y=0; y<COLBUF_SIZE; y++) { i++; if (i<pix) @@ -298,3 +303,12 @@ void SSD1606::set_font(unsigned char *font, unsigned char width) { } + +void SSD1606::_send_data_1bpp(unsigned char value) +{ + unsigned char temp; + temp = EPD_2bpp_LUT[value & 0x0F]; + _send_data(temp); + temp = EPD_2bpp_LUT[value>>4 & 0x0F]; + _send_data(temp); +}