From 73e15b2ff7e4b38d8bac6f30811c9cc5e8d001ef Mon Sep 17 00:00:00 2001 From: olikraus Date: Fri, 30 Dec 2016 11:40:54 +0100 Subject: [PATCH] 2.10.1 --- examples/full_buffer/FPS/FPS.ino | 1 + .../full_buffer/GraphicsTest/GraphicsTest.ino | 1 + .../full_buffer/HelloWorld/HelloWorld.ino | 1 + examples/full_buffer/PrintUTF8/PrintUTF8.ino | 1 + .../SelectionList/SelectionList.ino | 1 + examples/full_buffer/U8g2Logo/U8g2Logo.ino | 1 + .../page_buffer/ContrastTest/ContrastTest.ino | 2 + .../page_buffer/DirectAccess/DirectAccess.ino | 2 + examples/page_buffer/ExtUTF8/ExtUTF8.ino | 2 + examples/page_buffer/FPS/FPS.ino | 2 + examples/page_buffer/FlipMode/FlipMode.ino | 7 +- .../page_buffer/GraphicsTest/GraphicsTest.ino | 2 + .../page_buffer/HelloWorld/HelloWorld.ino | 2 + .../PrintHelloWorld/PrintHelloWorld.ino | 2 + examples/page_buffer/PrintUTF8/PrintUTF8.ino | 2 + .../ScrollingText/ScrollingText.ino | 2 + .../SelectionList/SelectionList.ino | 2 + examples/page_buffer/U8g2Logo/U8g2Logo.ino | 2 + examples/u8x8/FlipMode/FlipMode.ino | 1 + examples/u8x8/GraphicsTest/GraphicsTest.ino | 18 +- examples/u8x8/HelloWorld/HelloWorld.ino | 4 + examples/u8x8/MessageBox/MessageBox.ino | 1 + extras/ChangeLog | 3 +- library.properties | 4 +- src/U8g2lib.h | 54 +++ src/U8x8lib.h | 21 + src/clib/u8g2.h | 6 + src/clib/u8g2_buffer.c | 24 +- src/clib/u8g2_d_memory.c | 18 + src/clib/u8g2_d_setup.c | 28 ++ src/clib/u8x8.h | 26 +- src/clib/u8x8_d_ssd1606_172x72.c | 387 ++++++++++++++++++ src/clib/u8x8_display.c | 20 +- 33 files changed, 632 insertions(+), 18 deletions(-) create mode 100644 src/clib/u8x8_d_ssd1606_172x72.c diff --git a/examples/full_buffer/FPS/FPS.ino b/examples/full_buffer/FPS/FPS.ino index 149a193e..82657368 100644 --- a/examples/full_buffer/FPS/FPS.ino +++ b/examples/full_buffer/FPS/FPS.ino @@ -229,6 +229,7 @@ //U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board +//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/full_buffer/GraphicsTest/GraphicsTest.ino b/examples/full_buffer/GraphicsTest/GraphicsTest.ino index ffcc10dc..0c5f6c53 100644 --- a/examples/full_buffer/GraphicsTest/GraphicsTest.ino +++ b/examples/full_buffer/GraphicsTest/GraphicsTest.ino @@ -113,6 +113,7 @@ //U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board +//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/full_buffer/HelloWorld/HelloWorld.ino b/examples/full_buffer/HelloWorld/HelloWorld.ino index 458c1cf8..1d3f0abb 100644 --- a/examples/full_buffer/HelloWorld/HelloWorld.ino +++ b/examples/full_buffer/HelloWorld/HelloWorld.ino @@ -112,6 +112,7 @@ //U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board +//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/full_buffer/PrintUTF8/PrintUTF8.ino b/examples/full_buffer/PrintUTF8/PrintUTF8.ino index 9e6d78ee..0b06f388 100644 --- a/examples/full_buffer/PrintUTF8/PrintUTF8.ino +++ b/examples/full_buffer/PrintUTF8/PrintUTF8.ino @@ -115,6 +115,7 @@ //U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board +//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/full_buffer/SelectionList/SelectionList.ino b/examples/full_buffer/SelectionList/SelectionList.ino index 5241a6ac..0a4f3d45 100644 --- a/examples/full_buffer/SelectionList/SelectionList.ino +++ b/examples/full_buffer/SelectionList/SelectionList.ino @@ -112,6 +112,7 @@ //U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board +//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/full_buffer/U8g2Logo/U8g2Logo.ino b/examples/full_buffer/U8g2Logo/U8g2Logo.ino index 4176033c..b680ffc7 100644 --- a/examples/full_buffer/U8g2Logo/U8g2Logo.ino +++ b/examples/full_buffer/U8g2Logo/U8g2Logo.ino @@ -113,6 +113,7 @@ //U8G2_UC1611_EA_DOGM240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // Due, SW SPI, DOGXL240 Test Board +//U8G2_SSD1606_172X72_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/page_buffer/ContrastTest/ContrastTest.ino b/examples/page_buffer/ContrastTest/ContrastTest.ino index 757825aa..5cf16707 100644 --- a/examples/page_buffer/ContrastTest/ContrastTest.ino +++ b/examples/page_buffer/ContrastTest/ContrastTest.ino @@ -114,6 +114,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/DirectAccess/DirectAccess.ino b/examples/page_buffer/DirectAccess/DirectAccess.ino index 6cacfe01..b640bdb1 100644 --- a/examples/page_buffer/DirectAccess/DirectAccess.ino +++ b/examples/page_buffer/DirectAccess/DirectAccess.ino @@ -118,6 +118,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/ExtUTF8/ExtUTF8.ino b/examples/page_buffer/ExtUTF8/ExtUTF8.ino index d0dadcc3..e5bcfa5b 100644 --- a/examples/page_buffer/ExtUTF8/ExtUTF8.ino +++ b/examples/page_buffer/ExtUTF8/ExtUTF8.ino @@ -114,6 +114,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/FPS/FPS.ino b/examples/page_buffer/FPS/FPS.ino index 1e17e19b..138e415f 100644 --- a/examples/page_buffer/FPS/FPS.ino +++ b/examples/page_buffer/FPS/FPS.ino @@ -258,6 +258,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/FlipMode/FlipMode.ino b/examples/page_buffer/FlipMode/FlipMode.ino index fc128171..2dea3e1c 100644 --- a/examples/page_buffer/FlipMode/FlipMode.ino +++ b/examples/page_buffer/FlipMode/FlipMode.ino @@ -109,6 +109,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + @@ -117,11 +119,6 @@ // End of constructor list - - - - - void setup(void) { u8g2.begin(); u8g2.setFont(u8g2_font_6x10_tr); diff --git a/examples/page_buffer/GraphicsTest/GraphicsTest.ino b/examples/page_buffer/GraphicsTest/GraphicsTest.ino index a7449812..843dd55f 100644 --- a/examples/page_buffer/GraphicsTest/GraphicsTest.ino +++ b/examples/page_buffer/GraphicsTest/GraphicsTest.ino @@ -114,6 +114,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/HelloWorld/HelloWorld.ino b/examples/page_buffer/HelloWorld/HelloWorld.ino index f1162717..70733d58 100644 --- a/examples/page_buffer/HelloWorld/HelloWorld.ino +++ b/examples/page_buffer/HelloWorld/HelloWorld.ino @@ -114,6 +114,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/PrintHelloWorld/PrintHelloWorld.ino b/examples/page_buffer/PrintHelloWorld/PrintHelloWorld.ino index 56e9da71..f214595a 100644 --- a/examples/page_buffer/PrintHelloWorld/PrintHelloWorld.ino +++ b/examples/page_buffer/PrintHelloWorld/PrintHelloWorld.ino @@ -115,6 +115,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/PrintUTF8/PrintUTF8.ino b/examples/page_buffer/PrintUTF8/PrintUTF8.ino index 0f522db5..fb093767 100644 --- a/examples/page_buffer/PrintUTF8/PrintUTF8.ino +++ b/examples/page_buffer/PrintUTF8/PrintUTF8.ino @@ -115,6 +115,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/ScrollingText/ScrollingText.ino b/examples/page_buffer/ScrollingText/ScrollingText.ino index cd6b10c4..35b41f12 100644 --- a/examples/page_buffer/ScrollingText/ScrollingText.ino +++ b/examples/page_buffer/ScrollingText/ScrollingText.ino @@ -115,6 +115,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/SelectionList/SelectionList.ino b/examples/page_buffer/SelectionList/SelectionList.ino index 115bc999..1ead050d 100644 --- a/examples/page_buffer/SelectionList/SelectionList.ino +++ b/examples/page_buffer/SelectionList/SelectionList.ino @@ -104,6 +104,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/page_buffer/U8g2Logo/U8g2Logo.ino b/examples/page_buffer/U8g2Logo/U8g2Logo.ino index 2177daa5..97d9367b 100644 --- a/examples/page_buffer/U8g2Logo/U8g2Logo.ino +++ b/examples/page_buffer/U8g2Logo/U8g2Logo.ino @@ -113,6 +113,8 @@ //U8G2_UC1611_EA_DOGM240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8G2_UC1611_EA_DOGXL240_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8G2_SSD1606_172X72_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display + diff --git a/examples/u8x8/FlipMode/FlipMode.ino b/examples/u8x8/FlipMode/FlipMode.ino index 46aa0476..5e5331b7 100644 --- a/examples/u8x8/FlipMode/FlipMode.ino +++ b/examples/u8x8/FlipMode/FlipMode.ino @@ -91,6 +91,7 @@ //U8X8_UC1611_EA_DOGM240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_2ND_HW_I2C u8x8(/* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8X8_SSD1606_172X72_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/examples/u8x8/GraphicsTest/GraphicsTest.ino b/examples/u8x8/GraphicsTest/GraphicsTest.ino index 1cd2466d..f24cccd5 100644 --- a/examples/u8x8/GraphicsTest/GraphicsTest.ino +++ b/examples/u8x8/GraphicsTest/GraphicsTest.ino @@ -93,11 +93,17 @@ //U8X8_UC1611_EA_DOGM240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_2ND_HW_I2C u8x8(/* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8X8_SSD1606_172X72_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list +/* + This example will probably not work with the SSD1606, because of the + internal buffer swapping +*/ + void setup(void) { /* U8g2 Project: KS0108 Test Board */ @@ -151,6 +157,7 @@ void loop(void) u8x8.print("github.com/"); u8x8.setCursor(0,2); u8x8.print("olikraus/u8g2"); + u8x8.refreshDisplay(); // for SSD1606 delay(2000); u8x8.setCursor(0,3); u8x8.print("Tile size:"); @@ -158,14 +165,16 @@ void loop(void) u8x8.print("x"); u8x8.print((int)u8x8.getRows()); + u8x8.refreshDisplay(); // for SSD1606 delay(2000); - pre(); for( i = 19; i > 0; i-- ) { + pre(); u8x8.setCursor(3,2); u8x8.print(i); u8x8.print(" "); + u8x8.refreshDisplay(); // for SSD1606 delay(200); } @@ -174,6 +183,7 @@ void loop(void) { draw_bar(c, 1); draw_bar(c-1, 0); + u8x8.refreshDisplay(); // for SSD1606 delay(50); } draw_bar(u8x8.getCols()-1, 0); @@ -186,7 +196,8 @@ void loop(void) { draw_ascii_row(r, (r-1+d)*u8x8.getCols() + 32); } - delay(1000); + u8x8.refreshDisplay(); // for SSD1606 + delay(800); } draw_bar(u8x8.getCols()-1, 1); @@ -194,6 +205,7 @@ void loop(void) { draw_bar(c-1, 1); draw_bar(c, 0); + u8x8.refreshDisplay(); // for SSD1606 delay(50); } draw_bar(0, 0); @@ -201,6 +213,7 @@ void loop(void) pre(); u8x8.drawString(0, 2, "Small"); u8x8.draw2x2String(0, 5, "Big"); + u8x8.refreshDisplay(); // for SSD1606 delay(3000); pre(); @@ -209,6 +222,7 @@ void loop(void) u8x8.println("println"); delay(500); u8x8.println("done"); + u8x8.refreshDisplay(); // for SSD1606 delay(1500); } diff --git a/examples/u8x8/HelloWorld/HelloWorld.ino b/examples/u8x8/HelloWorld/HelloWorld.ino index 5f13fef9..d635a807 100644 --- a/examples/u8x8/HelloWorld/HelloWorld.ino +++ b/examples/u8x8/HelloWorld/HelloWorld.ino @@ -90,6 +90,7 @@ //U8X8_UC1611_EA_DOGM240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_2ND_HW_I2C u8x8(/* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8X8_SSD1606_172X72_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list @@ -116,6 +117,9 @@ void loop(void) { u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.drawString(0,1,"Hello World!"); + u8x8.refreshDisplay(); // for SSD1606 + delay(1000); + /* delay(1000); u8x8.setPowerSave(1); diff --git a/examples/u8x8/MessageBox/MessageBox.ino b/examples/u8x8/MessageBox/MessageBox.ino index 0499c162..529b8278 100644 --- a/examples/u8x8/MessageBox/MessageBox.ino +++ b/examples/u8x8/MessageBox/MessageBox.ino @@ -90,6 +90,7 @@ //U8X8_UC1611_EA_DOGM240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_2ND_HW_I2C u8x8(/* reset=*/ 8); // Due, 2nd I2C, DOGXL240 Test Board //U8X8_UC1611_EA_DOGXL240_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due DOGXL240 Test Board +//U8X8_SSD1606_172X72_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // eInk/ePaper Display // End of constructor list diff --git a/extras/ChangeLog b/extras/ChangeLog index ebf6c5ec..f7558740 100644 --- a/extras/ChangeLog +++ b/extras/ChangeLog @@ -75,4 +75,5 @@ https://github.com/olikraus/u8g2 ChangeLog * Reverted the setup for SSD1306_NONAME to the original setup (undo issue 98) * Introduced SSD1306_VCOMH0 for the max range setup (issue 116) 2016-12-xx v2.10.x olikraus@gmail.com - * ST7565 LM6059 Display + * ST7565 LM6059 Display (issue 123) + * SSD1606 eInk/ePaper Display (issue 100) diff --git a/library.properties b/library.properties index fb5bc251..36252cce 100644 --- a/library.properties +++ b/library.properties @@ -1,8 +1,8 @@ name=U8g2 -version=2.10.0 +version=2.10.1 author=oliver maintainer=oliver -sentence=Library for monochrome LCDs and OLEDs. Controller: SSD1306, SSD1322, SSD1325, SH1106, T6963, RA8835, PCD8544, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7920, LD7032, KS0108. Interfaces: I2C, SPI, Parallel. +sentence=Monochrome LCD, OLED and eInk Library. Display controller: SSD1306, SSD1322, SSD1325, SSD1606, SH1106, T6963, RA8835, PCD8544, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7920, LD7032, KS0108. Interfaces: I2C, SPI, Parallel. paragraph=Successor of U8glib. Features: UTF8, >700 fonts, U8x8 char output, all Arduino Boards supported. category=Display url=https://github.com/olikraus/u8g2 diff --git a/src/U8g2lib.h b/src/U8g2lib.h index 3efcc702..bee771e0 100644 --- a/src/U8g2lib.h +++ b/src/U8g2lib.h @@ -2988,6 +2988,60 @@ class U8G2_SSD1322_NHD_256X64_F_8080 : public U8G2 { u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); } }; +class U8G2_SSD1606_172X72_1_4W_SW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_1_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_1(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8G2_SSD1606_172X72_1_4W_HW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_1_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_1(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_SSD1606_172X72_1_3W_SW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_1_3W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_1(&u8g2, rotation, u8x8_byte_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; +class U8G2_SSD1606_172X72_2_4W_SW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_2_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_2(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8G2_SSD1606_172X72_2_4W_HW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_2_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_2(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_SSD1606_172X72_2_3W_SW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_2_3W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_2(&u8g2, rotation, u8x8_byte_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; +class U8G2_SSD1606_172X72_F_4W_SW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_F_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_f(&u8g2, rotation, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8G2_SSD1606_172X72_F_4W_HW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_F_4W_HW_SPI(const u8g2_cb_t *rotation, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_f(&u8g2, rotation, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8G2_SSD1606_172X72_F_3W_SW_SPI : public U8G2 { + public: U8G2_SSD1606_172X72_F_3W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8G2() { + u8g2_Setup_ssd1606_172x72_f(&u8g2, rotation, u8x8_byte_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; class U8G2_SED1330_240X128_1_6800 : public U8G2 { public: U8G2_SED1330_240X128_1_6800(const u8g2_cb_t *rotation, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() { u8g2_Setup_sed1330_240x128_1(&u8g2, rotation, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino); diff --git a/src/U8x8lib.h b/src/U8x8lib.h index 219a83e5..d769ab45 100644 --- a/src/U8x8lib.h +++ b/src/U8x8lib.h @@ -164,6 +164,9 @@ class U8X8 : public Print void setFlipMode(uint8_t mode) { u8x8_SetFlipMode(&u8x8, mode); } + void refreshDisplay(void) { // Dec 16: Only required for SSD1606 + u8x8_RefreshDisplay(&u8x8); } + void setContrast(uint8_t value) { u8x8_SetContrast(&u8x8, value); } @@ -1133,6 +1136,24 @@ class U8X8_SSD1322_NHD_256X64_8080 : public U8X8 { u8x8_SetPin_8Bit_8080(getU8x8(), d0, d1, d2, d3, d4, d5, d6, d7, enable, cs, dc, reset); } }; +class U8X8_SSD1606_172X72_4W_SW_SPI : public U8X8 { + public: U8X8_SSD1606_172X72_4W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_ssd1606_172x72, u8x8_cad_011, u8x8_byte_arduino_4wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_SW_SPI(getU8x8(), clock, data, cs, dc, reset); + } +}; +class U8X8_SSD1606_172X72_4W_HW_SPI : public U8X8 { + public: U8X8_SSD1606_172X72_4W_HW_SPI(uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_ssd1606_172x72, u8x8_cad_011, u8x8_byte_arduino_hw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_4Wire_HW_SPI(getU8x8(), cs, dc, reset); + } +}; +class U8X8_SSD1606_172X72_3W_SW_SPI : public U8X8 { + public: U8X8_SSD1606_172X72_3W_SW_SPI(uint8_t clock, uint8_t data, uint8_t cs, uint8_t reset = U8X8_PIN_NONE) : U8X8() { + u8x8_Setup(getU8x8(), u8x8_d_ssd1606_172x72, u8x8_cad_011, u8x8_byte_3wire_sw_spi, u8x8_gpio_and_delay_arduino); + u8x8_SetPin_3Wire_SW_SPI(getU8x8(), clock, data, cs, reset); + } +}; class U8X8_SED1330_240X128_6800 : public U8X8 { public: U8X8_SED1330_240X128_6800(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, uint8_t enable, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8X8() { u8x8_Setup(getU8x8(), u8x8_d_sed1330_240x128, u8x8_cad_100, u8x8_byte_8bit_6800mode, u8x8_gpio_and_delay_arduino); diff --git a/src/clib/u8g2.h b/src/clib/u8g2.h index e9d59a63..fbb08ebd 100644 --- a/src/clib/u8g2.h +++ b/src/clib/u8g2.h @@ -471,6 +471,9 @@ uint8_t *u8g2_m_t6963_16_f(uint8_t *page_cnt); uint8_t *u8g2_m_ssd1322_32_1(uint8_t *page_cnt); uint8_t *u8g2_m_ssd1322_32_2(uint8_t *page_cnt); uint8_t *u8g2_m_ssd1322_32_f(uint8_t *page_cnt); +uint8_t *u8g2_m_ssd1606_22_1(uint8_t *page_cnt); +uint8_t *u8g2_m_ssd1606_22_2(uint8_t *page_cnt); +uint8_t *u8g2_m_ssd1606_22_f(uint8_t *page_cnt); uint8_t *u8g2_m_sed1330_30_1(uint8_t *page_cnt); uint8_t *u8g2_m_sed1330_30_2(uint8_t *page_cnt); uint8_t *u8g2_m_sed1330_30_f(uint8_t *page_cnt); @@ -629,6 +632,9 @@ void u8g2_Setup_t6963_128x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg void u8g2_Setup_ssd1322_nhd_256x64_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_ssd1322_nhd_256x64_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_ssd1322_nhd_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_ssd1606_172x72_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_ssd1606_172x72_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); +void u8g2_Setup_ssd1606_172x72_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sed1330_240x128_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sed1330_240x128_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); void u8g2_Setup_sed1330_240x128_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb); diff --git a/src/clib/u8g2_buffer.c b/src/clib/u8g2_buffer.c index c1b463eb..f8b71f01 100644 --- a/src/clib/u8g2_buffer.c +++ b/src/clib/u8g2_buffer.c @@ -63,7 +63,13 @@ static void u8g2_send_tile_row(u8g2_t *u8g2, uint8_t src_tile_row, uint8_t dest_ u8x8_DrawTile(u8g2_GetU8x8(u8g2), 0, dest_tile_row, w, ptr); } -void u8g2_SendBuffer(u8g2_t *u8g2) +/* + write the buffer to the display RAM. + For most displays, this will make the content visible to the user. + Some displays (like the SSD1606) require a u8x8_RefreshDisplay() +*/ +static void u8g2_send_buffer(u8g2_t *u8g2) U8X8_NOINLINE; +static void u8g2_send_buffer(u8g2_t *u8g2) { uint8_t src_row; uint8_t src_max; @@ -83,6 +89,13 @@ void u8g2_SendBuffer(u8g2_t *u8g2) } while( src_row < src_max && dest_row < dest_max ); } +/* same as u8g2_send_buffer but also send the DISPLAY_REFRESH message (used by SSD1606) */ +void u8g2_SendBuffer(u8g2_t *u8g2) +{ + u8g2_send_buffer(u8g2); + u8x8_RefreshDisplay( u8g2_GetU8x8(u8g2) ); +} + /*============================================*/ void u8g2_SetBufferCurrTileRow(u8g2_t *u8g2, uint8_t row) { @@ -93,20 +106,27 @@ void u8g2_SetBufferCurrTileRow(u8g2_t *u8g2, uint8_t row) void u8g2_FirstPage(u8g2_t *u8g2) { if ( u8g2->is_auto_page_clear ) + { u8g2_ClearBuffer(u8g2); + } u8g2_SetBufferCurrTileRow(u8g2, 0); } uint8_t u8g2_NextPage(u8g2_t *u8g2) { uint8_t row; - u8g2_SendBuffer(u8g2); + u8g2_send_buffer(u8g2); row = u8g2->tile_curr_row; row += u8g2->tile_buf_height; if ( row >= u8g2_GetU8x8(u8g2)->display_info->tile_height ) + { + u8x8_RefreshDisplay( u8g2_GetU8x8(u8g2) ); return 0; + } if ( u8g2->is_auto_page_clear ) + { u8g2_ClearBuffer(u8g2); + } u8g2_SetBufferCurrTileRow(u8g2, row); return 1; } diff --git a/src/clib/u8g2_d_memory.c b/src/clib/u8g2_d_memory.c index e3c3196c..e807dc6b 100644 --- a/src/clib/u8g2_d_memory.c +++ b/src/clib/u8g2_d_memory.c @@ -399,6 +399,24 @@ uint8_t *u8g2_m_ssd1322_32_f(uint8_t *page_cnt) *page_cnt = 8; return buf; } +uint8_t *u8g2_m_ssd1606_22_1(uint8_t *page_cnt) +{ + static uint8_t buf[176]; + *page_cnt = 1; + return buf; +} +uint8_t *u8g2_m_ssd1606_22_2(uint8_t *page_cnt) +{ + static uint8_t buf[352]; + *page_cnt = 2; + return buf; +} +uint8_t *u8g2_m_ssd1606_22_f(uint8_t *page_cnt) +{ + static uint8_t buf[1584]; + *page_cnt = 9; + return buf; +} uint8_t *u8g2_m_sed1330_30_1(uint8_t *page_cnt) { static uint8_t buf[240]; diff --git a/src/clib/u8g2_d_setup.c b/src/clib/u8g2_d_setup.c index d5805f5f..896c15a7 100644 --- a/src/clib/u8g2_d_setup.c +++ b/src/clib/u8g2_d_setup.c @@ -1323,6 +1323,34 @@ void u8g2_Setup_ssd1322_nhd_256x64_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8 buf = u8g2_m_ssd1322_32_f(&tile_buf_height); u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); } +/* ssd1606 */ +/* ssd1606 1 */ +void u8g2_Setup_ssd1606_172x72_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +{ + uint8_t tile_buf_height; + uint8_t *buf; + u8g2_SetupDisplay(u8g2, u8x8_d_ssd1606_172x72, u8x8_cad_011, byte_cb, gpio_and_delay_cb); + buf = u8g2_m_ssd1606_22_1(&tile_buf_height); + u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); +} +/* ssd1606 2 */ +void u8g2_Setup_ssd1606_172x72_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +{ + uint8_t tile_buf_height; + uint8_t *buf; + u8g2_SetupDisplay(u8g2, u8x8_d_ssd1606_172x72, u8x8_cad_011, byte_cb, gpio_and_delay_cb); + buf = u8g2_m_ssd1606_22_2(&tile_buf_height); + u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); +} +/* ssd1606 f */ +void u8g2_Setup_ssd1606_172x72_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) +{ + uint8_t tile_buf_height; + uint8_t *buf; + u8g2_SetupDisplay(u8g2, u8x8_d_ssd1606_172x72, u8x8_cad_011, byte_cb, gpio_and_delay_cb); + buf = u8g2_m_ssd1606_22_f(&tile_buf_height); + u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation); +} /* sed1330 */ /* sed1330 1 */ void u8g2_Setup_sed1330_240x128_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) diff --git a/src/clib/u8x8.h b/src/clib/u8x8.h index 94e5c957..9d6b6f30 100644 --- a/src/clib/u8x8.h +++ b/src/clib/u8x8.h @@ -188,7 +188,7 @@ typedef uint16_t (*u8x8_char_cb)(u8x8_t *u8x8, uint8_t b); struct u8x8_tile_struct { - uint8_t *tile_ptr; /* pointer to one or more tiles */ + uint8_t *tile_ptr; /* pointer to one or more tiles... should be "const" */ uint8_t cnt; /* number of tiles */ uint8_t x_pos; /* tile x position */ uint8_t y_pos; /* tile x position */ @@ -436,9 +436,22 @@ void u8x8_d_helper_display_init(u8x8_t *u8g2); */ #define U8X8_MSG_DISPLAY_DRAW_TILE 15 -/* arg_ptr: layout struct */ -//#define U8X8_MSG_DISPLAY_GET_LAYOUT 16 +/* + Name: U8X8_MSG_DISPLAY_REFRESH + Args: + arg_int: - + arg_ptr: - + + This was introduced for the SSD1606 eInk display. + The problem is, that all RAM access will not appear on the screen + unless a special command is executed. With this message, this command + sequence is executed. + Use + void u8x8_RefreshDisplay(u8x8_t *u8x8) + to send the message to the display handler. +*/ +#define U8X8_MSG_DISPLAY_REFRESH 16 /*==========================================*/ /* u8x8_setup.c */ @@ -476,7 +489,10 @@ void u8x8_InitDisplay(u8x8_t *u8x8); void u8x8_SetPowerSave(u8x8_t *u8x8, uint8_t is_enable); void u8x8_SetFlipMode(u8x8_t *u8x8, uint8_t mode); void u8x8_SetContrast(u8x8_t *u8x8, uint8_t value); +void u8x8_ClearDisplayWithTile(u8x8_t *u8x8, const uint8_t *buf) U8X8_NOINLINE; void u8x8_ClearDisplay(u8x8_t *u8x8); // this does not work for u8g2 in some cases +void u8x8_FillDisplay(u8x8_t *u8x8); +void u8x8_RefreshDisplay(u8x8_t *u8x8); // make RAM content visible on the display (Dec 16: SSD1606 only) @@ -532,6 +548,9 @@ uint8_t u8x8_cad_EndTransfer(u8x8_t *u8x8) U8X8_NOINLINE; #define U8X8_AAC(a0,a1,c0) (U8X8_MSG_CAD_SEND_ARG), (a0), (U8X8_MSG_CAD_SEND_ARG), (a1), (U8X8_MSG_CAD_SEND_CMD), (c0) #define U8X8_D1(d0) (U8X8_MSG_CAD_SEND_DATA), (d0) +#define U8X8_A4(a0,a1,a2,a3) U8X8_A(a0), U8X8_A(a1), U8X8_A(a2), U8X8_A(a3) +#define U8X8_A8(a0,a1,a2,a3,a4,a5,a6,a7) U8X8_A4((a0), (a1), (a2), (a3)), U8X8_A4((a4), (a5), (a6), (a7)) + #define U8X8_START_TRANSFER() (U8X8_MSG_CAD_START_TRANSFER) #define U8X8_END_TRANSFER() (U8X8_MSG_CAD_END_TRANSFER) @@ -727,6 +746,7 @@ uint8_t u8x8_d_uc1611_ea_dogxl240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, vo uint8_t u8x8_d_ks0108_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_ks0108_erm19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); uint8_t u8x8_d_pcd8544_84x48(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); +uint8_t u8x8_d_ssd1606_172x72(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); diff --git a/src/clib/u8x8_d_ssd1606_172x72.c b/src/clib/u8x8_d_ssd1606_172x72.c new file mode 100644 index 00000000..1c5b16c4 --- /dev/null +++ b/src/clib/u8x8_d_ssd1606_172x72.c @@ -0,0 +1,387 @@ +/* + + u8x8_d_ssd1606_172x72.c + + Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) + + Copyright (c) 2016, olikraus@gmail.com + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + SSD1606: 128x180x2 + command + 0x22: assign actions + 0x20: execute actions + + action for command 0x022 are (more or less guessed) + bit 7: Enable Clock + bit 6: Enable Charge Pump + bit 5: Load Temparture Value (???) + bit 4: Load LUT (???) + bit 3: Initial Display (???) + bit 2: Pattern Display --> Requires about 945ms with the LUT from below + bit 1: Disable Charge Pump + bit 0: Disable Clock + + Disable Charge Pump and Clock require about 267ms + Enable Charge Pump and Clock require about 10ms + + Notes: + - Introduced a refresh display message, which copies RAM to display + - Charge pump and clock are only enabled for the transfer RAM to display + - U8x8 will not really work because of the two buffers in the SSD1606, however U8g2 should be ok. + +*/ + + +#include "u8x8.h" + + +#define L(a,b,c,d) (((a)<<6)|((b)<<4)|((c)<<2)|(d)) + + +/* GDE021A1, 2.1" EPD */ +static const uint8_t u8x8_d_ssd1606_172x72_gde021a1_init_seq[] = { + + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + + U8X8_CA(0x10, 0x00), /* Deep Sleep mode Control: Disable */ + U8X8_CA(0x11, 0x03), /* Define data entry mode, x&y inc, x first */ + U8X8_CAA(0x44, 0, 31), /* RAM x start & end, each byte has 4 pixel, 32*4=128 */ + U8X8_CAA(0x45, 0, 179), /* RAM y start & end, 179 MAX */ + + U8X8_CA(0x4e, 0), /* set x pos, 0..31 */ + U8X8_CA(0x4f, 0), /* set y pos, 0...179 */ + + U8X8_CA(0xf0, 0x1f), /* set booster feedback to internal */ + U8X8_CA(0x22, 0xc0), /* display update seq. option: enable clk, enable CP, .... todo: this is never activated */ + + U8X8_C(0x32), /* write LUT register*/ + +#ifdef ORIGINAL_LUT + + /* wavefrom part of the LUT: absolute LUT... this will always force the destination color */ + U8X8_A4(0x00,0x00,0x00,0x55), /* step 0 */ + U8X8_A4(0x00,0x00,0x55,0x55), /* step 1 */ + U8X8_A4(0x00,0x55,0x55,0x55), + U8X8_A4(0xAA,0xAA,0xAA,0xAA), + U8X8_A4(0x15,0x15,0x15,0x15), + U8X8_A4(0x05,0x05,0x05,0x05), + U8X8_A4(0x01,0x01,0x01,0x01), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), /* step 19 */ + + /* timing part of the LUT */ + U8X8_A8(0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00), + U8X8_A(0x00),U8X8_A(0x00), + +#else + + /* the following LUT will not change anything if the old and the new values are the same */ + /* 03 02 01 00 13 12 11 10 23 22 21 20 33 32 31 30 original */ + U8X8_A4(L(0, 0, 0, 0), L(0, 0, 0, 0), L(0, 0, 0, 0), L(0, 1, 1, 1)), // 0x00,0x00,0x00,0x55, step 0 + U8X8_A4(L(0, 0, 0, 0), L(0, 0, 0, 0), L(1, 0, 1, 1), L(0, 1, 1, 1)), // 0x00,0x00,0x55,0x55, step 1 + U8X8_A4(L(0, 0, 0, 0), L(1, 1, 0, 1), L(1, 0, 1, 1), L(0, 1, 1, 1)), // 0x00,0x55,0x55,0x55, step 2 + U8X8_A4(L(2, 2, 2, 0), L(2, 2, 0, 2), L(2, 0, 2, 2), L(0, 2, 2, 2)), // 0xAA,0xAA,0xAA,0xAA, step 3 + U8X8_A4(L(0, 1, 1, 0), L(0, 1, 0, 1), L(0, 0, 1, 1), L(0, 1, 1, 1)), // 0x15,0x15,0x15,0x15, step 4 + U8X8_A4(L(0, 0, 1, 0), L(0, 0, 0, 1), L(0, 0, 1, 1), L(0, 0, 1, 1)), // 0x05,0x05,0x05,0x05, step 5 + U8X8_A4(L(0, 0, 0, 0), L(0, 0, 0, 1), L(0, 0, 0, 1), L(0, 0, 0, 1)), // 0x01,0x01,0x01,0x01, step 6 + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), + U8X8_A4(0x00,0x00,0x00,0x00), /* step 19 */ + + /* timing part of the LUT */ + U8X8_A8(0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00), + U8X8_A(0x00),U8X8_A(0x00), + +#endif + + U8X8_CA(0x2c, 0xa0), /* write vcom value*/ + U8X8_CA(0x3c, 0x63), /* select boarder waveform */ + U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ + /* 0x0c4 is mentioned in chapter 9.2 of the GDE021A1 data sheet */ + + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + +static const uint8_t u8x8_d_ssd1606_to_display_seq[] = { + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + + + //U8X8_CA(0x22, 0xc0), /* display update seq. option: Enable clock and charge pump */ + //U8X8_C(0x20), /* execute sequence */ + //U8X8_DLY(10), + /* strange, splitting 0x0c0 does not work reliable */ + + U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */ + U8X8_C(0x20), /* execute sequence */ + U8X8_DLY(250), /* the sequence above requires about 970ms */ + U8X8_DLY(250), + U8X8_DLY(250), + U8X8_DLY(230), + + U8X8_CA(0x22, 0x03), /* disable clock and charge pump */ + U8X8_DLY(200), /* this requres about 270ms */ + U8X8_DLY(90), + + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + +static const uint8_t u8x8_d_ssd1606_172x72_powersave0_seq[] = { + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + +static const uint8_t u8x8_d_ssd1606_172x72_powersave1_seq[] = { + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + +static const uint8_t u8x8_d_ssd1606_172x72_flip0_seq[] = { + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + +static const uint8_t u8x8_d_ssd1606_172x72_flip1_seq[] = { + U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */ + U8X8_END_TRANSFER(), /* disable chip */ + U8X8_END() /* end of sequence */ +}; + + +static uint8_t *u8x8_convert_tile_for_ssd1606(uint8_t *t) +{ + uint8_t i; + uint16_t r; + static uint8_t buf[16]; + uint8_t *pbuf = buf; + + for( i = 0; i < 8; i++ ) + { + r = u8x8_upscale_byte(~(*t++)); + *pbuf++ = (r>>8) & 255; + *pbuf++ = r & 255; + } + return buf; +} + +static void u8x8_d_ssd1606_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) U8X8_NOINLINE; +static void u8x8_d_ssd1606_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_ptr) +{ + uint8_t x, c, page; + uint8_t *ptr; + u8x8_cad_StartTransfer(u8x8); + + page = u8x8->display_info->tile_height; + page --; + page -= (((u8x8_tile_t *)arg_ptr)->y_pos); + page *= 2; + + + x = ((u8x8_tile_t *)arg_ptr)->x_pos; + x *= 8; + x += u8x8->x_offset; + + u8x8_cad_SendCmd(u8x8, 0x00f ); /* scan start */ + u8x8_cad_SendArg(u8x8, 0); + + u8x8_cad_SendCmd(u8x8, 0x011 ); /* cursor increment mode */ + u8x8_cad_SendArg(u8x8, 3); + + u8x8_cad_SendCmd(u8x8, 0x045 ); /* window start column */ + u8x8_cad_SendArg(u8x8, 0); + u8x8_cad_SendArg(u8x8, 179); /* end of display */ + + u8x8_cad_SendCmd(u8x8, 0x044 ); /* window end page */ + u8x8_cad_SendArg(u8x8, page); + u8x8_cad_SendArg(u8x8, page+1); + + u8x8_cad_SendCmd(u8x8, 0x04f ); /* window column */ + u8x8_cad_SendArg(u8x8, x); + + u8x8_cad_SendCmd(u8x8, 0x04e ); /* window row */ + u8x8_cad_SendArg(u8x8, page); + + u8x8_cad_SendCmd(u8x8, 0x024 ); + + do + { + c = ((u8x8_tile_t *)arg_ptr)->cnt; + ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; + do + { + u8x8_cad_SendData(u8x8, 16, u8x8_convert_tile_for_ssd1606(ptr)); + ptr += 8; + x += 8; + c--; + } while( c > 0 ); + + arg_int--; + } while( arg_int > 0 ); + + u8x8_cad_EndTransfer(u8x8); +} + + +static uint8_t u8x8_d_ssd1606_172x72_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + switch(msg) + { + /* handled by the calling function + case U8X8_MSG_DISPLAY_SETUP_MEMORY: + u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1606_172x72_display_info); + break; + */ + case U8X8_MSG_DISPLAY_INIT: + + u8x8_d_helper_display_init(u8x8); + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_gde021a1_init_seq); + + /* special code for the SSD1606... */ + /* ensure that the initial buffer is clear and all eInk is set to white */ + /* this is done here, because the LUT will be of that kind, that it uses the previous color */ + /* make everything black */ + u8x8_FillDisplay(u8x8); + /* write content to the display */ + u8x8_RefreshDisplay(u8x8); + /* now make everything clear */ + u8x8_FillDisplay(u8x8); + /* write content to the display */ + u8x8_RefreshDisplay(u8x8); + /* now make everything clear */ + u8x8_ClearDisplay(u8x8); + /* write content to the display */ + u8x8_RefreshDisplay(u8x8); + + u8x8_ClearDisplay(u8x8); + /* write content to the display */ + u8x8_RefreshDisplay(u8x8); + + break; + case U8X8_MSG_DISPLAY_SET_POWER_SAVE: +/* + if ( arg_int == 0 ) + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_powersave0_seq); + else + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_powersave1_seq); +*/ + break; + case U8X8_MSG_DISPLAY_SET_FLIP_MODE: +/* + if ( arg_int == 0 ) + { + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_flip0_seq); + u8x8->x_offset = u8x8->display_info->default_x_offset; + } + else + { + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_172x72_flip1_seq); + u8x8->x_offset = u8x8->display_info->flipmode_x_offset; + } +*/ + break; +#ifdef U8X8_WITH_SET_CONTRAST + case U8X8_MSG_DISPLAY_SET_CONTRAST: + u8x8_cad_StartTransfer(u8x8); + u8x8_cad_SendCmd(u8x8, 0x081 ); + u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1306 has range from 0 to 255 */ + u8x8_cad_EndTransfer(u8x8); + break; +#endif + case U8X8_MSG_DISPLAY_DRAW_TILE: + u8x8_d_ssd1606_draw_tile(u8x8, arg_int, arg_ptr); + break; + case U8X8_MSG_DISPLAY_REFRESH: + u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1606_to_display_seq); + break; + default: + return 0; + } + return 1; +} + + +static const u8x8_display_info_t u8x8_ssd1606_172x72_display_info = +{ + /* chip_enable_level = */ 0, + /* chip_disable_level = */ 1, + + /* post_chip_enable_wait_ns = */ 120, + /* pre_chip_disable_wait_ns = */ 60, + /* reset_pulse_width_ms = */ 100, + /* post_reset_wait_ms = */ 100, + /* sda_setup_time_ns = */ 50, /* SSD1606: */ + /* sck_pulse_width_ns = */ 100, /* SSD1606: 100ns */ + /* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */ + /* spi_mode = */ 0, /* active high, rising edge */ + /* i2c_bus_clock_100kHz = */ 4, + /* data_setup_time_ns = */ 40, + /* write_pulse_width_ns = */ 150, + /* tile_width = */ 22, /* 22*8 = 176 */ + /* tile_hight = */ 9, /* 9*8 = 72 */ + /* default_x_offset = */ 0, + /* flipmode_x_offset = */ 0, + /* pixel_width = */ 172, + /* pixel_height = */ 72 +}; + +uint8_t u8x8_d_ssd1606_172x72(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) +{ + if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY ) + { + u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1606_172x72_display_info); + return 1; + } + return u8x8_d_ssd1606_172x72_generic(u8x8, msg, arg_int, arg_ptr); +} + + diff --git a/src/clib/u8x8_display.c b/src/clib/u8x8_display.c index e7f7116a..3ec68ee3 100644 --- a/src/clib/u8x8_display.c +++ b/src/clib/u8x8_display.c @@ -115,16 +115,19 @@ void u8x8_SetContrast(u8x8_t *u8x8, uint8_t value) u8x8->display_cb(u8x8, U8X8_MSG_DISPLAY_SET_CONTRAST, value, NULL); } +void u8x8_RefreshDisplay(u8x8_t *u8x8) +{ + u8x8->display_cb(u8x8, U8X8_MSG_DISPLAY_REFRESH, 0, NULL); +} -void u8x8_ClearDisplay(u8x8_t *u8x8) +void u8x8_ClearDisplayWithTile(u8x8_t *u8x8, const uint8_t *buf) { - uint8_t buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; u8x8_tile_t tile; uint8_t h; tile.x_pos = 0; tile.cnt = 1; - tile.tile_ptr = buf; + tile.tile_ptr = (uint8_t *)buf; /* tile_ptr should be const, but isn't */ h = u8x8->display_info->tile_height; tile.y_pos = 0; @@ -135,3 +138,14 @@ void u8x8_ClearDisplay(u8x8_t *u8x8) } while( tile.y_pos < h ); } +void u8x8_ClearDisplay(u8x8_t *u8x8) +{ + uint8_t buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + u8x8_ClearDisplayWithTile(u8x8, buf); +} + +void u8x8_FillDisplay(u8x8_t *u8x8) +{ + uint8_t buf[8] = { 255, 255, 255, 255, 255, 255, 255, 255 }; + u8x8_ClearDisplayWithTile(u8x8, buf); +}