Arduino style GUI
Diff: Drivers/SSD1353_SPI.cpp
- Revision:
- 3:b5409826d05f
- Parent:
- 2:3d959bc7d64d
diff -r 3d959bc7d64d -r b5409826d05f Drivers/SSD1353_SPI.cpp --- a/Drivers/SSD1353_SPI.cpp Thu Dec 01 13:54:38 2016 +0000 +++ b/Drivers/SSD1353_SPI.cpp Wed Feb 27 22:23:34 2019 +0000 @@ -16,7 +16,7 @@ #include "SSD1353_SPI.h" -SSD1353_SPI::SSD1353_SPI(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName dc) : Display(162, 132), m_SPI(mosi, miso, sclk), m_CS(cs), m_DC(dc) +SSD1353_SPI::SSD1353_SPI(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName dc) : Display(162, 132 ), m_SPI(mosi, miso, sclk), m_CS(cs), m_DC(dc) { //Deselect the display m_CS = 1; @@ -24,8 +24,8 @@ //Set the SPI format to 8 bit data, high steady state clock, second edge capture m_SPI.format(8, 3); - //Set the SPI frequency to 20MHz - m_SPI.frequency(10000000); + //Set the SPI frequency to 4MHz + m_SPI.frequency(4000000); } bool SSD1353_SPI::open() @@ -39,8 +39,8 @@ writeCommand(0xF1); writeCommand(CMD_MUXRATIO); writeData(0x83); - writeCommand(CMD_SETREMAP); - writeData(0xB4); + writeCommand(CMD_SETREMAP); // 0xA0 + writeData(0xB4); // B4 writeCommand(CMD_SETCOLUMN); writeData(0x00); writeData(0x9F); @@ -52,21 +52,21 @@ writeCommand(CMD_DISPLAYOFFSET); writeData(0x0); writeCommand(CMD_VCOMH); - writeCommand(0x05); + writeData(0x3C); // 2A writeCommand(CMD_NORMALDISPLAY); writeCommand(CMD_CONTRASTA); - writeData(0xC8); // C8 + writeData(0xc8); // C8 writeCommand(CMD_CONTRASTB); - writeData(0x80); // 80 + writeData(0xe8); // 80 writeCommand(CMD_CONTRASTC); - writeData(0xC8); // C8 + writeData(0xe8); // C8 writeCommand(CMD_MASTERCURRENT); - writeData(0x0B); + writeData(0x0F); // 0x0E writeCommand(CMD_PRECHARGESPEED2); writeData(0x02); - writeCommand(CMD_PHASE12PERIOD); - writeData(0x21); - + writeCommand(CMD_PHASE12PERIOD); // 0xB1 + writeData(0x21); // 0x21 + //Return success return true; } @@ -119,7 +119,7 @@ writeData(current); } } - + void SSD1353_SPI::drawPixel(int x, int y, unsigned int c) { //Range check the pixel