This commit is contained in:
kraus 2023-01-09 23:10:50 +01:00
parent cd44b05388
commit c2c83694fe
1 changed files with 74 additions and 0 deletions

View File

@ -304,3 +304,77 @@ uint8_t u8x8_d_uc1638_192x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
}
return 1;
}
/*================================================*/
/* issue https://github.com/olikraus/u8g2/issues/2075 */
static const u8x8_display_info_t u8x8_uc1638_240x128_display_info =
{
/* chip_enable_level = */ 0, /* low active CS for this display */
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 10, /* */
/* pre_chip_disable_wait_ns = */ 20, /* */
/* reset_pulse_width_ms = */ 5, /* */
/* post_reset_wait_ms = */ 150,
/* sda_setup_time_ns = */ 25, /* */
/* sck_pulse_width_ns = */ 65, /* */
/* sck_clock_hz = */ 2000000UL, /* 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 = */ 30, /* */
/* write_pulse_width_ns = */ 35, /* */
/* tile_width = */ 30, /* width of 30*8=240 pixel */
/* tile_hight = */ 16,
/* default_x_offset = */ 0*16+0, /* lower nibble: x offset, upper nibble: y offset */
/* flipmode_x_offset = */ 0*16+0, /* lower nibble: x offset, upper nibble: y offset */
/* pixel_width = */ 240,
/* pixel_height = */ 128
};
static const uint8_t u8x8_d_uc1638_240x128_init_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_CA(0x0e1, 0x0e2), /* software reset */ /* UC1638*/
U8X8_DLY(5), /* 5 ms */
U8X8_C(0x024), /* set temp comp*/
U8X8_C(0x0c2), /* mirror y and mirror x */
U8X8_C(0x0a2), /* line rate */
U8X8_C(0x02d), /* charge pump */
U8X8_C(0x0ea), /* set bias*/
U8X8_CA(0x081, 160), /* set contrast */
//U8X8_C(0x0d6), /* gray scale 2 */
U8X8_C(0x095), /* set 1 bit per pixel, pattern 0*/
U8X8_C(0x086), /* COM scan */
U8X8_CA(0x0f1, 159), /* COM End*/
U8X8_C(0x089), /* set auto increment, low bits are AC2 AC1 AC0 */ /* WAS 89 */
//U8X8_C(0x086), /* scan function 0x86 or 0x87: no effect*/
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
uint8_t u8x8_d_uc1638_240x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
/* call common procedure first and handle messages there */
if ( u8x8_d_uc1638_common(u8x8, msg, arg_int, arg_ptr) == 0 )
{
/* msg not handled, then try here */
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1638_240x128_display_info);
break;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1638_240x128_init_seq);
break;
default:
return 0; /* msg unknown */
}
}
return 1;
}