This commit is contained in:
kraus 2021-09-02 21:53:21 +02:00
parent 68132dbb66
commit f275963f86
4 changed files with 141 additions and 0 deletions

View File

@ -262,4 +262,6 @@ https://github.com/olikraus/u8g2 ChangeLog
* Added support for UC1638 based 196x96 display (issue 371)
* Added support for HD44102 and T7932 displays (issue 1492)
* Added support for SSD1320 (issue 1351)
* Added support for S1D15721 (issue 1473)

View File

@ -844,6 +844,7 @@ uint8_t u8x8_d_st7920_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
uint8_t u8x8_d_ssd1306_2040x16(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1306_128x32_univision(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1306_128x32_winstar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1306_102x64_ea_oleds102(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr); /* u8x8_ssd1309.c */
uint8_t u8x8_d_ssd1306_64x48_er(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1306_48x64_winstar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1306_64x32_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);

View File

@ -286,3 +286,124 @@ uint8_t u8x8_d_ssd1309_128x64_noname0(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int
}
return 1;
}
/*=================================================*/
/*
EA OLEDS102
Contributed here: https://github.com/olikraus/u8g2/pull/1497/files
Manually added here, device renamed from SSD1309 to SSD1306
*/
static const uint8_t u8x8_d_ssd1309_102x64_ea_oleds102_init_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_C(0x40), //Set Display start line
U8X8_C(0xA0), //Bottom View no Segment remap
U8X8_C(0xC0), //Bottom View COM scan direction normal
U8X8_C(0x2E), //StartColumnAddress
U8X8_CA(0x8D, 0x95), //Switch Charge Pump (9V)
U8X8_CA(0x20, 0x02), //Set Memory AddressMode
U8X8_CA(0x81, 0xFF), //Set Brightness
U8X8_CA(0xD5, 0x40), //Set Display Clock Divide
U8X8_CA(0xD9, 0xF1), //Set Precharge Periode
U8X8_CA(0xAD, 0x30), //Set Internal Ref
U8X8_CAA(0x21, 0x0D, 0x72), //Set ColumnAddress to 13x8 + 10 = 114/0x72
U8X8_CAA(0x22, 0x00, 0x3F), //Set PageAddress
U8X8_C(0xAF), //Display on
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
/* timing from SSD1306 */
static const u8x8_display_info_t u8x8_ssd1309_102x64_ea_oleds102_display_info =
{
/* chip_enable_level = */ 0,
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 20,
/* pre_chip_disable_wait_ns = */ 10,
/* reset_pulse_width_ms = */ 100, /* SSD1306: 3 us */
/* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
/* sda_setup_time_ns = */ 50, /* SSD1306: 15ns, but cycle time is 100ns, so use 100/2 */
/* sck_pulse_width_ns = */ 50, /* SSD1306: 20ns, but cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
/* 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, /* SSD1306: cycle time is 300ns, so use 300/2 = 150 */
/* tile_width = */ 13, /* width of 13*8=104 pixel */
/* tile_hight = */ 8,
/* default_x_offset = */ 13,
/* flipmode_x_offset = */ 13,
/* pixel_width = */ 102,
/* pixel_height = */ 64
};
uint8_t u8x8_d_ssd1306_102x64_ea_oleds102(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
uint8_t x, c;
uint8_t *ptr;
switch(msg)
{
case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
if ( arg_int == 0 )
{
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip0_seq);
u8x8->x_offset = u8x8->display_info->default_x_offset;
}
else
{
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_128x64_flip1_seq);
u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
}
break;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1309_102x64_ea_oleds102_init_seq);
break;
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1309_102x64_ea_oleds102_display_info);
break;
case U8X8_MSG_DISPLAY_SET_CONTRAST:
u8x8_cad_StartTransfer(u8x8);
u8x8_cad_SendCmd(u8x8, 0x081 );
u8x8_cad_SendArg(u8x8, arg_int ); /* ssd1309 has range from 0 to 255 */
u8x8_cad_EndTransfer(u8x8);
break;
case U8X8_MSG_DISPLAY_DRAW_TILE:
u8x8_cad_StartTransfer(u8x8);
x = ((u8x8_tile_t *)arg_ptr)->x_pos;
x *= 8;
x += u8x8->x_offset;
u8x8_cad_SendCmd(u8x8, 0x010 | (x>>4) );
u8x8_cad_SendCmd(u8x8, 0x000 | ((x&15)));
u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t *)arg_ptr)->y_pos));
c = ((u8x8_tile_t *)arg_ptr)->cnt;
c *= 8;
ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
if ( c + x > 115u )
{
c = 115u;
c -= x;
}
do
{
u8x8_cad_SendData(u8x8, c, 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;
}

View File

@ -328,6 +328,23 @@ struct controller controller_list[] =
}
},
{
"ssd1306", 13, 8, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080|COM_8080,
"", /* is_generate_u8g2_class= */ 1,
{
{ "102x64_ea_oleds102" },
{ NULL }
}
},
{
"ssd1306", 13, 8, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_ssd13xx_fast_i2c", "i2c", COM_I2C,
"", /* is_generate_u8g2_class= */ 1,
{
{ "102x64_ea_oleds102" },
{ NULL }
}
},
{
"sh1106", 16, 4, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080|COM_8080,