Add JLX12864G support

This commit is contained in:
liangzohar 2024-08-29 20:31:44 +08:00
parent 0924dd6bf4
commit 3feda6dc90
3 changed files with 118 additions and 0 deletions

View File

@ -3973,6 +3973,14 @@ void u8g2_Setup_hx1230_96x68_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg
}
/* uc1604 */
/* uc1604 1 */
void u8g2_Setup_uc1604_jlx12864_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_uc1604_jlx12864, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_16_8_1(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
void u8g2_Setup_uc1604_jlx19264_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;
@ -3982,6 +3990,14 @@ void u8g2_Setup_uc1604_jlx19264_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
/* uc1604 2 */
void u8g2_Setup_uc1604_jlx12864_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_uc1604_jlx12864, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_16_8_2(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
void u8g2_Setup_uc1604_jlx19264_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;
@ -3991,6 +4007,14 @@ void u8g2_Setup_uc1604_jlx19264_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
/* uc1604 f */
void u8g2_Setup_uc1604_jlx12864_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_uc1604_jlx12864, u8x8_cad_001, byte_cb, gpio_and_delay_cb);
buf = u8g2_m_16_8_f(&tile_buf_height);
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
void u8g2_Setup_uc1604_jlx19264_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;

View File

@ -984,6 +984,7 @@ uint8_t u8x8_d_ssd1329_128x96_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int,
uint8_t u8x8_d_ssd1329_96x96_noname(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1601_128x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1601_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1604_jlx12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1604_jlx19264(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1608_erc24064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_uc1608_dem240064(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);

View File

@ -144,6 +144,99 @@ uint8_t u8x8_d_uc1604_common(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
return 1;
}
/*================================================*/
/* JLX12864 */
/*
timings from uc1604
UC1604 has two chip select inputs (CS0 and CS1).
CS0 is low active, CS1 is high active. It will depend on the display
module whether the display has a is low or high active chip select.
*/
static const u8x8_display_info_t u8x8_uc1604_128x64_display_info =
{
/* chip_enable_level = */ 0, /* JLX12864G uses CS0, which is low active CS*/
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 20,
/* pre_chip_disable_wait_ns = */ 20,
/* reset_pulse_width_ms = */ 1,
/* post_reset_wait_ms = */ 10,
/* sda_setup_time_ns = */ 30,
/* sck_pulse_width_ns = */ 65, /* half of cycle time */
/* sck_clock_hz = */ 8000000UL, /* 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 = */ 16, /* width of 24*8=192 pixel */
/* tile_height = */ 8,
/* default_x_offset = */ 0, /* reused as y page offset */
/* flipmode_x_offset = */ 0, /* reused as y page offset */
/* pixel_width = */ 128,
/* pixel_height = */ 64
};
static const uint8_t u8x8_d_uc1604_jlx12864_init_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_C(0x0e2), /* soft reset */
U8X8_DLY(200),
U8X8_DLY(200),
U8X8_C(0x02f), /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */
U8X8_DLY(200),
U8X8_DLY(200),
U8X8_CA(0x081, 0x038), /* set contrast, JLX19264G suggestion: 0x045 */
U8X8_C(0x0eb), /* LCD bias Bits 0/1: 00=6 01=7, 10=8, 11=9 */
//U8X8_C(0x023), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */
//U8X8_C(0x027), /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */
U8X8_C(0x0c2), /* Map control, Bit 2: MY=1, Bit 1: MX=0 */
U8X8_C(0x0a0), /* 0xa0: 76Hz FPS, controller default: 0x0a1: 95Hz FPS */
U8X8_C(0x040), /* set scroll line to 0 */
U8X8_C(0x089), /* RAM access control (controller default: 0x089)*/
U8X8_C(0x000), /* column low nibble */
U8X8_C(0x010), /* column high nibble */
U8X8_C(0x0b0), /* page adr */
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
uint8_t u8x8_d_uc1604_jlx12864(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
/* call common procedure first and handle messages there */
if ( u8x8_d_uc1604_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_uc1604_128x64_display_info);
break;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1604_jlx12864_init_seq);
break;
default:
return 0; /* msg unknown */
}
}
return 1;
}
/*================================================*/
/* JLX19264 */