issue #1873, code update

This commit is contained in:
kraus 2022-06-12 09:39:39 +02:00
parent b126be4ea7
commit 564ddd38e6
3 changed files with 65 additions and 15 deletions

View File

@ -863,8 +863,9 @@ uint8_t u8x8_d_sh1107_pimoroni_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_in
uint8_t u8x8_d_sh1107_seeed_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_sh1108_160x160(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_sh1122_256x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_256x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_160x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_192x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_256x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_st7920_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ls013b7dh03_128x128(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ls027b7dh01_400x240(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);

View File

@ -152,6 +152,51 @@ uint8_t u8x8_d_st7920_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
return 1;
}
/*=== 160x32 === */
/* https://github.com/olikraus/u8g2/issues/1873, POWERTIP PG-16032LRU-BWH-H-P2 */
static const u8x8_display_info_t u8x8_st7920_160x32_display_info =
{
/* chip_enable_level = */ 1,
/* chip_disable_level = */ 0,
/* post_chip_enable_wait_ns = */ 5,
/* pre_chip_disable_wait_ns = */ 5,
/* reset_pulse_width_ms = */ 1,
/* post_reset_wait_ms = */ 6,
/* sda_setup_time_ns = */ 20,
/* sck_pulse_width_ns = */ 140, /* datasheet ST7920 */
/* sck_clock_hz = */ 1000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
/* spi_mode = */ 3, /* old: sck_takeover_edge, new: active high (bit 1), rising edge (bit 0), 18 Aug 16: changed from 1 to 3 which works for 101 */
/* Arduino mode 3: aktive low clock, but use rising edge */
/* i2c_bus_clock_100kHz = */ 4,
/* data_setup_time_ns = */ 30,
/* write_pulse_width_ns = */ 40,
/* tile_width = */ 20,
/* tile_hight = */ 4,
/* default_x_offset = */ 0,
/* flipmode_x_offset = */ 0,
/* pixel_width = */ 160,
/* pixel_height = */ 32
};
uint8_t u8x8_d_st7920_160x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7920_160x32_display_info);
break;
default:
return u8x8_d_st7920_common(u8x8, msg, arg_int, arg_ptr);
}
return 1;
}
/*=== 192x32 === */
static const u8x8_display_info_t u8x8_st7920_192x32_display_info =
{
/* chip_enable_level = */ 1,
@ -177,6 +222,22 @@ static const u8x8_display_info_t u8x8_st7920_192x32_display_info =
/* pixel_height = */ 32
};
uint8_t u8x8_d_st7920_192x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7920_192x32_display_info);
break;
default:
return u8x8_d_st7920_common(u8x8, msg, arg_int, arg_ptr);
}
return 1;
}
/*=== 128x64 === */
static const u8x8_display_info_t u8x8_st7920_128x64_display_info =
{
/* chip_enable_level = */ 1,
@ -203,19 +264,6 @@ static const u8x8_display_info_t u8x8_st7920_128x64_display_info =
/* pixel_height = */ 64
};
uint8_t u8x8_d_st7920_192x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_st7920_192x32_display_info);
break;
default:
return u8x8_d_st7920_common(u8x8, msg, arg_int, arg_ptr);
}
return 1;
}
uint8_t u8x8_d_st7920_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
@ -229,6 +277,7 @@ uint8_t u8x8_d_st7920_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
return 1;
}
/*=== 256x32 === */
/* https://github.com/olikraus/u8g2/issues/1593 */
static const u8x8_display_info_t u8x8_st7920_256x32_display_info =

View File

@ -335,7 +335,7 @@ void setSSD1306VcomDeselect(uint8_t v)
u8g2.sendF("cac", 0x0db, v << 4, 0xaf);
}
// p1: 1..15, higher values, more darker, however almost no difference with 3 or more
// p1: 1..15, higher values, more darker, however almost no difference with 3 or more (discharge phase)
// p2: 1..15, higher values, more brighter
void setSSD1306PreChargePeriod(uint8_t p1, uint8_t p2)
{