This commit is contained in:
kraus 2019-01-20 08:57:03 +01:00
parent 9c9bc27f4e
commit 8303b0e207
1 changed files with 32 additions and 19 deletions

View File

@ -49,14 +49,23 @@ static const uint8_t u8x8_d_ssd1318_128x96_init_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_CA(0x0fd, 0x012), /* unlock */
U8X8_C(0x0ae), /* display off */
U8X8_CA(0x0d5, 0x080), /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
U8X8_CA(0x0a8, 0x03f), /* multiplex ratio */
U8X8_CA(0x0ad, 0x0d0), /* external or internal IREF selection */
U8X8_CA(0x0a8, 0x05f), /* multiplex ratio, 96 duty */
U8X8_CA(0x0d3, 0x000), /* display offset */
U8X8_C(0x040), /* set display start line to 0 */
U8X8_CA(0x08d, 0x014), /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable, SSD1306 only, should be removed for SH1106 */
U8X8_CA(0x020, 0x000), /* page addressing mode */
U8X8_CA(0x0a2, 0x000), /* start line */
// four possible charge pump setting from as per sec 6.8.2 of the ssd1318 datasheet
// uncomment only one of the below for lines
// U8X8_CA(0x08d, 0x004), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */
// U8X8_CA(0x08d, 0x044), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */
// U8X8_CA(0x08d, 0x084), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */
// U8X8_CA(0x08d, 0x0c4), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */
U8X8_CA(0x0ac, 0x001), /* Charge pump setting from sec 6.8.2 of SSD1318 datasheet */
U8X8_C(0x0a1), /* segment remap a0/a1*/
U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */
// Flipmode
@ -65,13 +74,17 @@ static const uint8_t u8x8_d_ssd1318_128x96_init_seq[] = {
U8X8_CA(0x0da, 0x012), /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
U8X8_CA(0x081, 0x0cf), /* [2] set contrast control */
U8X8_CA(0x0d9, 0x0f1), /* [2] pre-charge period 0x022/f1*/
U8X8_CA(0x0db, 0x040), /* vcomh deselect level */
// if vcomh is 0, then this will give the biggest range for contrast control issue #98
// restored the old values for the noname constructor, because vcomh=0 will not work for all OLEDs, #116
U8X8_CA(0x081, 0x00f), /* value from issue 784, seems to be a little bit low... */
U8X8_CA(0x0d5, 0x0d1), /* clock divide ratio (0x00=1) and oscillator frequency (0x8), value from issue 784 example code */
U8X8_CA(0x0d9, 0x022), /* [2] pre-charge period 0x022/f1, value from issue 784 example code */
U8X8_CA(0x0db, 0x030), /* vcomh deselect level, value from issue 784 example code */
//U8X8_CA(0x020, 0x000), /* page addressing mode */
//U8X8_C(0x02e), /* Deactivate scroll */
U8X8_C(0x02e), /* Deactivate scroll */
U8X8_C(0x0a4), /* output ram to display */
U8X8_C(0x0a6), /* none inverted normal display mode */
@ -81,21 +94,21 @@ static const uint8_t u8x8_d_ssd1318_128x96_init_seq[] = {
static const uint8_t u8x8_d_ssd1318_96x96_powersave0_seq[] = {
static const uint8_t u8x8_d_ssd1318_128x96_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_ssd1318_96x96_powersave1_seq[] = {
static const uint8_t u8x8_d_ssd1318_128x96_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_ssd1318_96x96_flip0_seq[] = {
static const uint8_t u8x8_d_ssd1318_128x96_flip0_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_C(0x0a1), /* segment remap a0/a1*/
U8X8_C(0x0c0), /* c0: scan dir normal, c8: reverse */
@ -103,7 +116,7 @@ static const uint8_t u8x8_d_ssd1318_96x96_flip0_seq[] = {
U8X8_END() /* end of sequence */
};
static const uint8_t u8x8_d_ssd1318_96x96_flip1_seq[] = {
static const uint8_t u8x8_d_ssd1318_128x96_flip1_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_C(0x0a0), /* segment remap a0/a1*/
U8X8_C(0x0c8), /* c0: scan dir normal, c8: reverse */
@ -131,19 +144,19 @@ static uint8_t u8x8_d_ssd1318_generic(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int
*/
case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
if ( arg_int == 0 )
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_96x96_powersave0_seq);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_powersave0_seq);
else
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_96x96_powersave1_seq);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_powersave1_seq);
break;
case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
if ( arg_int == 0 )
{
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_96x96_flip0_seq);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_flip0_seq);
u8x8->x_offset = u8x8->display_info->default_x_offset;
}
else
{
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_96x96_flip1_seq);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1318_128x96_flip1_seq);
u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
}
break;