working on ssd1606

This commit is contained in:
olikraus 2016-12-28 08:02:53 +01:00
parent a034e53771
commit 232879b9cd
9 changed files with 400 additions and 1 deletions

View File

@ -75,4 +75,4 @@ 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)

View File

@ -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);

View File

@ -1133,6 +1133,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);

View File

@ -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);

View File

@ -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];

View File

@ -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)

View File

@ -532,6 +532,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 +730,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);

View File

@ -0,0 +1,263 @@
/*
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
*/
#include "u8x8.h"
/* 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*/
U8X8_A8(0x00,0x00,0x00,0x55,0x00,0x00,0x55,0x55),
U8X8_A8(0x00,0x55,0x55,0x55,0xAA,0xAA,0xAA,0xAA),
U8X8_A8(0x15,0x15,0x15,0x15,0x05,0x05,0x05,0x05),
U8X8_A8(0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00),
U8X8_A8(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
U8X8_A8(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
U8X8_A8(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
U8X8_A8(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
U8X8_A8(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
U8X8_A8(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
U8X8_A8(0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00),
U8X8_A(0x00),U8X8_A(0x00),
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_172x72_powersave0_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
//U8X8_C(0x0af), /* display on */
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_C(0x0ae), /* display off */
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_C(0x0a1), /* segment remap a0/a1*/
//U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */
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_C(0x0a0), /* segment remap a0/a1*/
//U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
static uint8_t u8x8_d_ssd1606_172x72_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
uint8_t x, c;
uint8_t *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);
u8x8_cad_SendCmd(u8x8, 0x044 );
u8x8_cad_SendArg(u8x8, 0 );
u8x8_cad_SendArg(u8x8, 31 );
u8x8_cad_SendCmd(u8x8, 0x045 );
u8x8_cad_SendArg(u8x8, 0 );
u8x8_cad_SendArg(u8x8, 179 );
u8x8_cad_SendCmd(u8x8, 0x04e );
u8x8_cad_SendArg(u8x8, 4 );
u8x8_cad_SendCmd(u8x8, 0x04f );
u8x8_cad_SendArg(u8x8, 4 );
u8x8_cad_SendCmd(u8x8, 0x024 );
u8x8_cad_SendArg(u8x8, 0xff );
u8x8_cad_SendArg(u8x8, 0xff );
u8x8_cad_SendArg(u8x8, 0xff );
u8x8_cad_SendArg(u8x8, 0xff );
u8x8_cad_SendArg(u8x8, 0xf0 );
u8x8_cad_SendArg(u8x8, 0xf0 );
u8x8_cad_SendArg(u8x8, 0xf0);
u8x8_cad_SendArg(u8x8, 0xf0);
u8x8_cad_SendCmd(u8x8, 0x022 ); /* set display update sequence */
u8x8_cad_SendArg(u8x8, 0x0c4 ); /* clk -> CP -> LUT -> initial display -> pattern display */
u8x8_cad_SendCmd(u8x8, 0x020 ); /* activate display update sequence */
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_cad_SendCmd(u8x8, 0x022 ); /* set display update sequence */
u8x8_cad_SendArg(u8x8, 0x03 ); /* disable CP and clk */
u8x8_cad_SendCmd(u8x8, 0x020 ); /* activate display update sequence */
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
u8x8_gpio_Delay(u8x8, U8X8_MSG_DELAY_MILLI, 200);
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_cad_StartTransfer(u8x8);
x = ((u8x8_tile_t *)arg_ptr)->x_pos;
x *= 8;
x += u8x8->x_offset;
// TODO Y Pos
//u8x8_cad_SendCmd(u8x8, 0x044 );
//u8x8_cad_SendArg(u8x8, y );
u8x8_cad_SendCmd(u8x8, 0x045 );
u8x8_cad_SendArg(u8x8, x );
do
{
c = ((u8x8_tile_t *)arg_ptr)->cnt;
ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */
arg_int--;
} while( arg_int > 0 );
u8x8_cad_EndTransfer(u8x8);
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);
}

View File

@ -415,6 +415,14 @@ struct controller controller_list[] =
{ NULL }
}
},
{
"ssd1606", 22, 9, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_011", "", COM_4WSPI|COM_3WSPI,
"", /* is_generate_u8g2_class= */ 1,
{
{ "172x72" },
{ NULL }
}
},
{
"sed1330", 30, 16, "u8g2_ll_hvline_horizontal_right_lsb", "u8x8_cad_100", "", COM_6800|COM_8080,
"Not tested, might work for RA8835 and SED1335 also", /* is_generate_u8g2_class= */ 1,