issue #1501 code update

This commit is contained in:
kraus 2021-05-24 22:17:19 +02:00
parent 19929687e2
commit b3ef657d1f
5 changed files with 128 additions and 0 deletions

View File

@ -909,6 +909,7 @@ uint8_t u8x8_d_ssd1327_visionox_128x96(u8x8_t *u8x8, uint8_t msg, uint8_t arg_in
uint8_t u8x8_d_ssd1326_er_256x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8x8_d_ssd1329_128x96_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_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

@ -185,4 +185,96 @@ uint8_t u8x8_d_uc1601_128x32(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
return 1;
}
/* issue https://github.com/olikraus/u8g2/issues/1501 */
static const u8x8_display_info_t u8x8_uc1601_128x64_display_info =
{
/* chip_enable_level = */ 0,
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 1, /* uc1601 datasheet, page 46 */
/* pre_chip_disable_wait_ns = */ 5, /* uc1601 datasheet, page 46 */
/* reset_pulse_width_ms = */ 1,
/* post_reset_wait_ms = */ 6,
/* sda_setup_time_ns = */ 12, /* uc1601 datasheet, page 44 */
/* sck_pulse_width_ns = */ 15, /* uc1601 datasheet, page 44 */
/* sck_clock_hz = */ 2000000UL, /* */
/* spi_mode = */ 0, /* active high, rising edge */
/* i2c_bus_clock_100kHz = */ 1,
/* data_setup_time_ns = */ 60, /* uc1601 datasheet, page 43 */
/* write_pulse_width_ns = */ 80, /* uc1601 datasheet, page 43 */
/* tile_width = */ 16,
/* tile_hight = */ 8,
/* default_x_offset = */ 0,
/* flipmode_x_offset = */ 4,
/* pixel_width = */ 128,
/* pixel_height = */ 64
};
uint8_t u8x8_d_uc1601_128x64(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_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_uc1601_128x64_display_info);
break;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_init_seq);
break;
case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
if ( arg_int == 0 )
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_powersave0_seq);
else
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_powersave1_seq);
break;
case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
if ( arg_int == 0 )
{
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_flip0_seq);
u8x8->x_offset = u8x8->display_info->default_x_offset;
}
else
{
u8x8_cad_SendSequence(u8x8, u8x8_d_uc1601_128x32_flip1_seq);
u8x8->x_offset = u8x8->display_info->flipmode_x_offset;
}
break;
#ifdef U8X8_WITH_SET_CONTRAST
case U8X8_MSG_DISPLAY_SET_CONTRAST:
u8x8_cad_StartTransfer(u8x8);
u8x8_cad_SendCmd(u8x8, 0x081 );
u8x8_cad_SendArg(u8x8, arg_int ); /* uc1601 has range from 0 to 255 */
u8x8_cad_EndTransfer(u8x8);
break;
#endif
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;
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

@ -168,6 +168,18 @@ in "u8g2.h". Uncomment this line:
The file "u8g2.h" is located in "/libraries/U8g2_Arduino/src/clib" inside your default
sketch folder.
Q: What will change in 16 Bit mode?
A: U8x8 is unaffected: U8x8 will use a "tile" coordinate system (1 tile = 8x8 pixel).
As a result u8x8 can work with display dimensions of up to 2040x2040
In U8g2 8 bit mode all pixel related calculations are done in 8 bit, which is faster
and produces smaller code on 8 bit architectures like ATMega AVR.
This will however restrict the display size to 255x255 (which is actually clipped at 240x240)
In U8g2 16 bit mode the pixel related calculations are done in 16 bit. For 32 bit systems like ARM,
there will be not much a difference between 16 bit mode and 8 bit mode, this is also why
16 bit mode is now default on ARMs. The maximum display dimension is then 65000x65000,
however, because u8g2 just calls u8x8, the actual limit in 16 bit mode is 2040x2040 pixel.
Q: U8g2 requires a lot of memory. How to reduce this?
- Visit https://github.com/olikraus/u8g2/wiki/u8g2optimization
- Disable U8g2 features if possible (see u8g2.h)

View File

@ -1066,6 +1066,23 @@ struct controller controller_list[] =
{ NULL }
}
},
{
"uc1601", 16, 8, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080,
"", /* is_generate_u8g2_class= */ 1,
{
{ "128x64" },
{ NULL }
}
},
{
"uc1601", 16, 8, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_uc16xx_i2c", "i2c", COM_I2C,
"", /* is_generate_u8g2_class= */ 1,
{
{ "128x64" },
{ NULL }
}
},
{
"st7565", 17, 4, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080,

View File

@ -130,6 +130,12 @@ old16x16: bdfconv
./bdfconv -y 0 -th 8 -tv 8 -v -f 2 -m '32-127' ../bdf/open_iconic_weather_8x.bdf -o u8x8_font_open_iconic_weather_8x8.c -n u8x8_font_open_iconic_weather_8x8
falconded: bdfconv
-../otf2bdf/otf2bdf -n -p 12 -o falconded.bdf falconded.ttf
./bdfconv -v -f 1 -b 2 -a -m '32-96' falconded.bdf -o u8g2_font_falconded_mr.c -n u8g2_font_falconded_mr -d ../bdf/helvR12.bdf
-../otf2bdf/otf2bdf -n -p 12 -o falconded.bdf falconded.ttf
./bdfconv -v -f 1 -b 1 -a -m '32-96' falconded.bdf -o u8g2_font_falconded_hr.c -n u8g2_font_falconded_hr -d ../bdf/helvR12.bdf
analecta: bdfconv
-../otf2bdf/otf2bdf -a -p 20 -o analecta.bdf Analecta.otf