mirror of
https://github.com/adafruit/Adafruit_SSD1306.git
synced 2026-07-27 20:05:50 +00:00
Fixed double writes; tested on 128x64 and 128x32 SPI displays
This commit is contained in:
+7
-24
@@ -383,9 +383,13 @@ void Adafruit_SSD1306::ssd1306_data(uint8_t c) {
|
||||
}
|
||||
|
||||
void Adafruit_SSD1306::display(void) {
|
||||
ssd1306_command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0
|
||||
ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
|
||||
ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
|
||||
ssd1306_command(SSD1306_COLUMNADDR);
|
||||
ssd1306_command(0); // Column start address (0 = reset)
|
||||
ssd1306_command(127); // Column end address (127 = reset)
|
||||
|
||||
ssd1306_command(SSD1306_PAGEADDR);
|
||||
ssd1306_command(0); // Page start address (0 = reset)
|
||||
ssd1306_command((SSD1306_LCDHEIGHT == 64) ? 7 : 3); // Page end address
|
||||
|
||||
if (sid != -1)
|
||||
{
|
||||
@@ -398,13 +402,6 @@ void Adafruit_SSD1306::display(void) {
|
||||
fastSPIwrite(buffer[i]);
|
||||
//ssd1306_data(buffer[i]);
|
||||
}
|
||||
// i wonder why we have to do this (check datasheet)
|
||||
if (SSD1306_LCDHEIGHT == 32) {
|
||||
for (uint16_t i=0; i<(SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT/8); i++) {
|
||||
//ssd1306_data(0);
|
||||
fastSPIwrite(0);
|
||||
}
|
||||
}
|
||||
*csport |= cspinmask;
|
||||
}
|
||||
else
|
||||
@@ -428,20 +425,6 @@ void Adafruit_SSD1306::display(void) {
|
||||
i--;
|
||||
Wire.endTransmission();
|
||||
}
|
||||
// i wonder why we have to do this (check datasheet)
|
||||
if (SSD1306_LCDHEIGHT == 32) {
|
||||
for (uint16_t i=0; i<(SSD1306_LCDWIDTH*SSD1306_LCDHEIGHT/8); i++) {
|
||||
// send a bunch of data in one xmission
|
||||
Wire.beginTransmission(_i2caddr);
|
||||
Wire.write(0x40);
|
||||
for (uint8_t x=0; x<16; x++) {
|
||||
Wire.write((uint8_t)0x00);
|
||||
i++;
|
||||
}
|
||||
i--;
|
||||
Wire.endTransmission();
|
||||
}
|
||||
}
|
||||
TWBR = twbrbackup;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -42,9 +42,6 @@ All text above, and the splash screen must be included in any redistribution
|
||||
|
||||
SSD1306_128_32 128x32 pixel display
|
||||
|
||||
You also need to set the LCDWIDTH and LCDHEIGHT defines to an
|
||||
appropriate size
|
||||
|
||||
-----------------------------------------------------------------------*/
|
||||
#define SSD1306_128_64
|
||||
// #define SSD1306_128_32
|
||||
@@ -90,6 +87,8 @@ All text above, and the splash screen must be included in any redistribution
|
||||
#define SSD1306_SETSTARTLINE 0x40
|
||||
|
||||
#define SSD1306_MEMORYMODE 0x20
|
||||
#define SSD1306_COLUMNADDR 0x21
|
||||
#define SSD1306_PAGEADDR 0x22
|
||||
|
||||
#define SSD1306_COMSCANINC 0xC0
|
||||
#define SSD1306_COMSCANDEC 0xC8
|
||||
|
||||
Reference in New Issue
Block a user