fixed flipmode for uc1701

This commit is contained in:
olikraus 2016-05-03 22:09:15 +02:00
parent 4209ca2cdb
commit b3f11823f2
6 changed files with 76 additions and 11 deletions

View File

@ -60,7 +60,6 @@ static void u8g2_send_tile_row(u8g2_t *u8g2, uint8_t src_tile_row, uint8_t dest_
offset *= w;
offset *= 8;
ptr += offset;
u8x8_DrawTile(u8g2_GetU8x8(u8g2), 0, dest_tile_row, w, ptr);
}

View File

@ -173,11 +173,22 @@ uint8_t u8x8_d_uc1701_dogs102(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *
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;
/*
The following if condition checks the hardware limits of the uc1701
controller: It is not allowed to write beyond the display limits.
This is in fact an issue within flip mode.
*/
if ( c + x > 132u )
{
c = 132u;
c -= x;
}
do
{
c = ((u8x8_tile_t *)arg_ptr)->cnt;
ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
u8x8_cad_SendData(u8x8, c*8, ptr); /* note: SendData can not handle more than 255 bytes */
u8x8_cad_SendData(u8x8, c, ptr); /* note: SendData can not handle more than 255 bytes */
arg_int--;
} while( arg_int > 0 );

View File

@ -73,8 +73,7 @@ void loop(void) {
u8g2.firstPage();
do {
u8g2.drawStr(0,24,"Hello World!");
u8g2.drawStr(20,14,"Hello World!");
u8g2.drawPixel(u8g2.getDisplayWidth()-1, 3);
u8g2.drawFrame(0,0,u8g2.getDisplayWidth(),u8g2.getDisplayHeight() );
} while ( u8g2.nextPage() );
@ -86,6 +85,6 @@ void loop(void) {
u8g2.drawStr(0,24,"Hello World!");
u8g2.drawFrame(0,0,u8g2.getDisplayWidth(),u8g2.getDisplayHeight() );
} while ( u8g2.nextPage() );
delay(2000);
delay(400);
}

View File

@ -0,0 +1,14 @@
CC = gcc
CFLAGS = -g -W -Wall -Wextra -Wcast-qual -Wno-overlength-strings -Wno-unused-parameter -I../../../csrc/.
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
OBJ = $(SRC:.c=.o)
u8g2_utf8: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o u8g2_utf8
clean:
-rm $(OBJ) u8g2_utf8

View File

@ -0,0 +1,42 @@
/*
this example was written to debug a problem with a display width, which
is not multiple of 8.
the display width is set to 102 for this purpose
*/
#include "u8g2.h"
#include <stdio.h>
u8g2_t u8g2;
int main(void)
{
u8g2_SetupBuffer_Utf8(&u8g2, U8G2_R0);
u8g2_InitDisplay(&u8g2);
u8g2_SetPowerSave(&u8g2, 0);
u8g2_SetFont(&u8g2, u8g2_font_6x13_tf);
u8g2_SetFontDirection(&u8g2, 0);
u8g2_FirstPage(&u8g2);
do
{
u8g2_DrawHLine(&u8g2, u8g2_GetDisplayWidth(&u8g2)-1, 2, 4);
u8g2_DrawStr(&u8g2, 10, 20, "Clip");
} while( u8g2_NextPage(&u8g2) );
utf8_show();
printf("DisplayWidth = %d\n", u8g2_GetDisplayWidth(&u8g2));
return 0;
}

View File

@ -29,12 +29,12 @@ int main(void)
do
{
//u8g2_DrawFrame(&u8g2, 0, 0,
// u8g2_GetDisplayWidth(&u8g2), u8g2_GetDisplayHeight(&u8g2));
u8g2_DrawFrame(&u8g2, 0, 0,
u8g2_GetDisplayWidth(&u8g2), u8g2_GetDisplayHeight(&u8g2));
//u8g2_DrawHLine(&u8g2, 0, 0, u8g2_GetDisplayWidth(&u8g2));
u8g2_DrawHLine(&u8g2, 0, u8g2_GetDisplayHeight(&u8g2)-1, u8g2_GetDisplayWidth(&u8g2));
//u8g2_DrawHLine(&u8g2, 0, u8g2_GetDisplayHeight(&u8g2)-1, u8g2_GetDisplayWidth(&u8g2));
//u8g2_DrawHLine(&u8g2, 0, 32, 10);
// u8g2_DrawStr(&u8g2, 10, 20, "Frame");
u8g2_DrawStr(&u8g2, 10, 20, "Frame");
//u8g2_DrawStr(&u8g2, u8g2_GetDisplayWidth(&u8g2)-9, 10, "Frame");
//u8g2_DrawStr(&u8g2, u8g2_GetDisplayWidth(&u8g2)-8, 20, "Frame");
//u8g2_DrawStr(&u8g2, u8g2_GetDisplayWidth(&u8g2)-7, 30, "Frame");