issue #88, speed improvements
This commit is contained in:
parent
a666e0637d
commit
792a129ed2
|
@ -62,3 +62,4 @@ https://github.com/olikraus/u8g2 ChangeLog
|
|||
2016-xx-xx v2.8.x olikraus@gmail.com
|
||||
* Increased contrast range for SSD1306 (issue 98)
|
||||
* Support for KS0108 (issue 88)
|
||||
* Support for UC1608 240x128 (issue 101)
|
||||
|
|
|
@ -56,28 +56,50 @@ static const uint8_t u8x8_d_ks0108_powersave1_seq[] = {
|
|||
};
|
||||
|
||||
|
||||
static void u8x8_ks0108_out(u8x8_t *u8x8, uint8_t *x, uint8_t *c, uint8_t **ptr, uint8_t *arg_int, void *arg_ptr)
|
||||
struct u8x8_ks0108_vars
|
||||
{
|
||||
u8x8_cad_SendCmd(u8x8, 0x040 | ((*x) & 63) );
|
||||
uint8_t *ptr;
|
||||
uint8_t x;
|
||||
uint8_t c;
|
||||
uint8_t arg_int;
|
||||
};
|
||||
|
||||
static void u8x8_ks0108_out(u8x8_t *u8x8, struct u8x8_ks0108_vars *v, void *arg_ptr)
|
||||
{
|
||||
uint8_t cnt;
|
||||
u8x8_cad_SendCmd(u8x8, 0x040 | ((v->x << 3) & 63) );
|
||||
u8x8_cad_SendCmd(u8x8, 0x0b8 | (((u8x8_tile_t *)arg_ptr)->y_pos));
|
||||
|
||||
while( *arg_int > 0 )
|
||||
while( v->arg_int > 0 )
|
||||
{
|
||||
u8x8_cad_SendData(u8x8, 8, *ptr); /* note: SendData can not handle more than 255 bytes */
|
||||
(*ptr) += 8;
|
||||
(*x)+= 8;
|
||||
(*c)--;
|
||||
if ( *c == 0 )
|
||||
/* calculate tiles to next boundary (end or chip limit) */
|
||||
cnt = v->x;
|
||||
cnt += 8;
|
||||
cnt &= 0x0f8;
|
||||
cnt -= v->x;
|
||||
|
||||
if ( cnt > v->c )
|
||||
cnt = v->c;
|
||||
|
||||
/* of cours we still could use cnt=1 here... */
|
||||
/* but setting cnt to 1 is not very efficient */
|
||||
//cnt = 1;
|
||||
|
||||
v->x +=cnt;
|
||||
v->c-=cnt;
|
||||
cnt<<=3;
|
||||
u8x8_cad_SendData(u8x8, cnt, v->ptr); /* note: SendData can not handle more than 255 bytes */
|
||||
v->ptr += cnt;
|
||||
|
||||
if ( v->c == 0 )
|
||||
{
|
||||
*ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
|
||||
*c = ((u8x8_tile_t *)arg_ptr)->cnt;
|
||||
(*arg_int)--;
|
||||
v->ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
|
||||
v->c = ((u8x8_tile_t *)arg_ptr)->cnt;
|
||||
v->arg_int--;
|
||||
}
|
||||
if ( ((*x) & 63) == 0 )
|
||||
break;
|
||||
|
||||
if ( ((v->x) & 7) == 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,8 +129,7 @@ static const u8x8_display_info_t u8x8_ks0108_128x64_display_info =
|
|||
|
||||
uint8_t u8x8_d_ks0108_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
|
||||
{
|
||||
uint8_t x, c;
|
||||
uint8_t *ptr;
|
||||
struct u8x8_ks0108_vars v;
|
||||
switch(msg)
|
||||
{
|
||||
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
|
||||
|
@ -158,49 +179,30 @@ uint8_t u8x8_d_ks0108_128x64(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *a
|
|||
// break;
|
||||
case U8X8_MSG_DISPLAY_DRAW_TILE:
|
||||
|
||||
x = ((u8x8_tile_t *)arg_ptr)->x_pos;
|
||||
x *= 8;
|
||||
ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
|
||||
c = ((u8x8_tile_t *)arg_ptr)->cnt;
|
||||
v.ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
|
||||
v.x = ((u8x8_tile_t *)arg_ptr)->x_pos;
|
||||
v.c = ((u8x8_tile_t *)arg_ptr)->cnt;
|
||||
v.arg_int = arg_int;
|
||||
|
||||
if ( x < 64 )
|
||||
|
||||
if ( v.x < 8 )
|
||||
{
|
||||
u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 1, NULL);
|
||||
u8x8_ks0108_out(u8x8, &x, &c, &ptr, &arg_int, arg_ptr);
|
||||
u8x8_ks0108_out(u8x8, &v, arg_ptr);
|
||||
u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL);
|
||||
}
|
||||
if ( x < 128 )
|
||||
if ( v.x < 16 )
|
||||
{
|
||||
u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 2, NULL);
|
||||
u8x8_ks0108_out(u8x8, &x, &c, &ptr, &arg_int, arg_ptr);
|
||||
u8x8_ks0108_out(u8x8, &v, arg_ptr);
|
||||
u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL);
|
||||
}
|
||||
//if ( x < 192 )
|
||||
//if ( v.x < 24 )
|
||||
//{
|
||||
//u8x8->cad_cb(u8x8, U8X8_MSG_CAD_START_TRANSFER, 4, NULL);
|
||||
//u8x8_ks0108_out(u8x8, &x, &c, &ptr, &arg_int, arg_ptr);
|
||||
//u8x8_ks0108_out(u8x8, &v, arg_ptr);
|
||||
//u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL);
|
||||
//}
|
||||
|
||||
#ifdef old
|
||||
u8x8_cad_SendCmd(u8x8, 0x040 | (x) );
|
||||
u8x8_cad_SendCmd(u8x8, 0x0b8 | (((u8x8_tile_t *)arg_ptr)->y_pos));
|
||||
do
|
||||
{
|
||||
ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
|
||||
c = ((u8x8_tile_t *)arg_ptr)->cnt;
|
||||
while( c > 0 )
|
||||
{
|
||||
u8x8_cad_SendData(u8x8, 8, ptr); /* note: SendData can not handle more than 255 bytes */
|
||||
ptr += 8;
|
||||
x+= 8;
|
||||
c--;
|
||||
}
|
||||
arg_int--;
|
||||
} while( arg_int > 0 );
|
||||
u8x8->cad_cb(u8x8, U8X8_MSG_CAD_END_TRANSFER, 0, NULL);
|
||||
#endif
|
||||
|
||||
//}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
//U8G2_RA8835_NHD_240X128_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // Connect /RD = E with +5V, enable is /WR = RW, FG with GND, 14=Uno Pin A0
|
||||
//U8G2_RA8835_NHD_240X128_1_6800 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 17, /*cs=*/ 14, /*dc=*/ 15, /*reset=*/ 16); // A0 is dc pin, /WR = RW = GND, enable is /RD = E
|
||||
//U8G2_UC1608_ERC24064_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due ERC24064-1 Test Setup
|
||||
U8G2_UC1608_240X128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due ERC24064-1 Test Setup
|
||||
//U8G2_UC1608_240X128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); // SW SPI, Due ERC24064-1 Test Setup
|
||||
//U8G2_UC1610_EA_DOGXL160_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE);
|
||||
//U8G2_UC1610_EA_DOGXL160_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ U8X8_PIN_NONE);
|
||||
//U8G2_UC1611_EA_DOGM240_1_2ND_HW_I2C u8g2(U8G2_R0, /* reset=*/ 8); // Due, 2nd I2C, DOGM240 Test Board
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
//U8X8_SSD1322_NHD_256X64_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8X8_SSD1325_NHD_128X64_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8X8_SSD1325_NHD_128X64_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8X8_KS0108_128X64 u8x8(8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*dc=*/ 17, /*cs0=*/ 14, /*cs1=*/ 15, /*cs2=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE); // Set R/W to low!
|
||||
U8X8_KS0108_128X64 u8x8(8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*dc=*/ 17, /*cs0=*/ 14, /*cs1=*/ 15, /*cs2=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE); // Set R/W to low!
|
||||
//U8X8_UC1701_EA_DOGS102_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8X8_UC1701_EA_DOGS102_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8X8_ST7565_EA_DOGM128_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# without 'v' prefix
|
||||
echo -n "2.8.0"
|
||||
echo -n "2.8.1"
|
||||
|
|
Loading…
Reference in New Issue