mirror of
https://github.com/Valeh2012/PersonalVotingMachine
synced 2025-12-08 18:15:11 +02:00
first commit
This commit is contained in:
@@ -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
|
||||
|
||||
37
basic-setup/components/u8g2/sys/utf8/box_picture_loop/main.c
Normal file
37
basic-setup/components/u8g2/sys/utf8/box_picture_loop/main.c
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
#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_DrawBox(&u8g2, 2, 3, 7, 9);
|
||||
u8g2_DrawBox(&u8g2, 12, 3, 2, 13);
|
||||
u8g2_DrawBox(&u8g2, 12,17, 13, 2);
|
||||
u8g2_DrawFrame(&u8g2, 2,21, 11, 7);
|
||||
u8g2_DrawFrame(&u8g2, 25,24, 27, 5);
|
||||
u8g2_DrawStr(&u8g2, 30, 10, "DrawBox");
|
||||
u8g2_DrawStr(&u8g2, 30, 20, "DrawFrame");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -Wall -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
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
u8g2_SetupBuffer_Utf8(&u8g2, &u8g2_cb_r0);
|
||||
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
||||
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_unifont_t_chinese2);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
u8g2_DrawUTF8(&u8g2, 2, 15, "你好世界");
|
||||
u8g2_DrawStr(&u8g2, 2, 30, "Hello World");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#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_DrawCircle(&u8g2, 7, 11, 5, U8G2_DRAW_ALL);
|
||||
u8g2_DrawEllipse(&u8g2, 19, 11, 5, 5, U8G2_DRAW_ALL);
|
||||
u8g2_DrawDisc(&u8g2, 7, 11+14, 5, U8G2_DRAW_ALL);
|
||||
u8g2_DrawFilledEllipse(&u8g2, 19, 11+14, 5, 5, U8G2_DRAW_ALL);
|
||||
u8g2_DrawEllipse(&u8g2, 60, 11+12, 17, 5, U8G2_DRAW_ALL);
|
||||
u8g2_DrawStr(&u8g2, 30, 10, "Circle&Disk");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
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
|
||||
|
||||
this is also used to do more clip testing.
|
||||
any assertion indicates a bug.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
void draw(void)
|
||||
{
|
||||
u8g2_SetFont(&u8g2, u8g2_font_ncenB24_tf);
|
||||
u8g2_DrawHLine(&u8g2, u8g2_GetDisplayWidth(&u8g2)-1, 2, 4);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_DrawStr(&u8g2, -4, 20, "Clip/////");
|
||||
u8g2_DrawStr(&u8g2, -5, 50, "Clip/////");
|
||||
u8g2_DrawStr(&u8g2, -6, 80, "Clip/////");
|
||||
u8g2_DrawStr(&u8g2, -6, 110, "Clip/////");
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_ncenB12_tf);
|
||||
|
||||
u8g2_DrawStr(&u8g2, 40, 40, "F");
|
||||
u8g2_SetFontDirection(&u8g2, 1);
|
||||
u8g2_DrawStr(&u8g2, 40, 40, "F");
|
||||
u8g2_SetFontDirection(&u8g2, 2);
|
||||
u8g2_DrawStr(&u8g2, 40, 40, "F");
|
||||
u8g2_SetFontDirection(&u8g2, 3);
|
||||
u8g2_DrawStr(&u8g2, 40, 40, "F");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
u8g2_SetupBuffer_Utf8(&u8g2, U8G2_R0);
|
||||
|
||||
|
||||
u8g2_InitDisplay(&u8g2);
|
||||
u8g2_SetPowerSave(&u8g2, 0);
|
||||
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
//u8g2_SetClipWindow(&u8g2, 10, 10, 50, 60 );
|
||||
|
||||
|
||||
u8g2_SetDisplayRotation(&u8g2, U8G2_R0);
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
draw();
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
puts("=======================================");
|
||||
utf8_show();
|
||||
|
||||
u8g2_SetDisplayRotation(&u8g2, U8G2_R1);
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
draw();
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
puts("=======================================");
|
||||
utf8_show();
|
||||
|
||||
u8g2_SetDisplayRotation(&u8g2, U8G2_R2);
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
draw();
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
puts("=======================================");
|
||||
utf8_show();
|
||||
|
||||
u8g2_SetDisplayRotation(&u8g2, U8G2_R3);
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
draw();
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
puts("=======================================");
|
||||
utf8_show();
|
||||
|
||||
u8g2_SetDisplayRotation(&u8g2, U8G2_MIRROR);
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
draw();
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
puts("=======================================");
|
||||
utf8_show();
|
||||
|
||||
printf("DisplayWidth = %d\n", u8g2_GetDisplayWidth(&u8g2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
235
basic-setup/components/u8g2/sys/utf8/common/u8x8_d_utf8.c
Normal file
235
basic-setup/components/u8g2/sys/utf8/common/u8x8_d_utf8.c
Normal file
@@ -0,0 +1,235 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CHGR_WIDTH 96
|
||||
//#define CHGR_WIDTH 102
|
||||
//#define CHGR_HEIGHT 32
|
||||
#define CHGR_HEIGHT 68
|
||||
unsigned char chgr_bitmap[CHGR_HEIGHT/2][CHGR_WIDTH/2];
|
||||
|
||||
unsigned char *chgr_bitmap_pos(unsigned x, unsigned y)
|
||||
{
|
||||
if ( x >= CHGR_WIDTH )
|
||||
return NULL;
|
||||
if ( y >= CHGR_HEIGHT )
|
||||
return NULL;
|
||||
return &(chgr_bitmap[y/2][x/2]);
|
||||
}
|
||||
|
||||
void chgr_set_pixel(unsigned x, unsigned y)
|
||||
{
|
||||
unsigned char *p;
|
||||
p = chgr_bitmap_pos(x, y);
|
||||
if ( p == NULL )
|
||||
return;
|
||||
*p |= 1<<(((y&1)<<1) + (1-(x&1)));
|
||||
//printf("x=%d y=%d *p=%d\n", x, y, *p);
|
||||
}
|
||||
|
||||
void chgr_clr_pixel(unsigned x, unsigned y)
|
||||
{
|
||||
unsigned char *p;
|
||||
p = chgr_bitmap_pos(x, y);
|
||||
if ( p == NULL )
|
||||
return;
|
||||
*p &= ~ (1<<(((y&1)<<1) + (1-(x&1))));
|
||||
//printf("x=%d y=%d *p=%d\n", x, y, *p);
|
||||
}
|
||||
|
||||
void chgr_clear(void)
|
||||
{
|
||||
unsigned x, y;
|
||||
for( y = 0; y < CHGR_HEIGHT/2; y++)
|
||||
{
|
||||
for( x = 0; x < CHGR_WIDTH/2; x++)
|
||||
{
|
||||
chgr_bitmap[y][x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *chgr_to_str(unsigned v)
|
||||
{
|
||||
switch(v)
|
||||
{
|
||||
case 0: return " "; //
|
||||
//case 0: return "\xE2\x96\x91"; // light shade
|
||||
case 1: return "\xE2\x96\x9d"; // QUADRANT UPPER RIGHT
|
||||
case 2: return "\xE2\x96\x98"; // QUADRANT UPPER LEFT
|
||||
case 3: return "\xE2\x96\x80"; // UPPER HALF
|
||||
|
||||
case 4: return "\xE2\x96\x97"; // QUADRANT LOWER RIGHT
|
||||
case 5: return "\xE2\x96\x90"; // RIGHT BAR
|
||||
case 6: return "\xE2\x96\x9A"; //
|
||||
case 7: return "\xE2\x96\x9C"; //
|
||||
|
||||
case 8: return "\xE2\x96\x96"; // QUADRANT LOWER LEFT
|
||||
case 9: return "\xE2\x96\x9E"; //
|
||||
case 10: return "\xE2\x96\x8B"; //
|
||||
case 11: return "\xE2\x96\x9B"; //
|
||||
|
||||
case 12: return "\xE2\x96\x84"; // LOWER HALF
|
||||
case 13: return "\xE2\x96\x9F"; //
|
||||
case 14: return "\xE2\x96\x99"; //
|
||||
case 15: return "\xE2\x96\x88"; //
|
||||
}
|
||||
return "\xE2\x96\x88 "; // full block
|
||||
}
|
||||
|
||||
void chgr_show(void)
|
||||
{
|
||||
unsigned x, y;
|
||||
for( y = 0; y < CHGR_HEIGHT/2; y++)
|
||||
{
|
||||
printf("%02d|", y*2);
|
||||
for( x = 0; x < CHGR_WIDTH/2; x++)
|
||||
{
|
||||
//printf("%x", chgr_bitmap[y][x]);
|
||||
printf("%s", chgr_to_str(chgr_bitmap[y][x]));
|
||||
}
|
||||
printf("|\n");
|
||||
}
|
||||
}
|
||||
|
||||
void chgr_set_8pixel(unsigned x, unsigned y, uint8_t pixel, uint16_t f)
|
||||
{
|
||||
int cnt = 8;
|
||||
while( cnt > 0 )
|
||||
{
|
||||
if ( (pixel & 1) != 0 )
|
||||
{
|
||||
chgr_set_pixel(x,y);
|
||||
}
|
||||
else
|
||||
{
|
||||
chgr_clr_pixel(x,y);
|
||||
}
|
||||
pixel >>= 1;
|
||||
y+=f;
|
||||
cnt--;
|
||||
}
|
||||
}
|
||||
|
||||
void chgr_set_multiple_8pixel(int x, int y, int cnt, uint8_t *pixel, uint16_t f)
|
||||
{
|
||||
uint8_t b;
|
||||
while( cnt > 0 )
|
||||
{
|
||||
b = *pixel;
|
||||
chgr_set_8pixel(x, y, b, f);
|
||||
x+=f;
|
||||
pixel++;
|
||||
cnt--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*==========================================*/
|
||||
/* tga description procedures */
|
||||
|
||||
|
||||
static const u8x8_display_info_t u8x8_utf8_info =
|
||||
{
|
||||
/* chip_enable_level = */ 0,
|
||||
/* chip_disable_level = */ 1,
|
||||
|
||||
/* post_chip_enable_wait_ns = */ 0,
|
||||
/* pre_chip_disable_wait_ns = */ 0,
|
||||
/* reset_pulse_width_ms = */ 0,
|
||||
/* post_reset_wait_ms = */ 0,
|
||||
/* sda_setup_time_ns = */ 0,
|
||||
/* sck_pulse_width_ns = */ 0,
|
||||
/* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
|
||||
/* spi_mode = */ 1,
|
||||
/* i2c_bus_clock_100kHz = */ 0,
|
||||
/* data_setup_time_ns = */ 0,
|
||||
/* write_pulse_width_ns = */ 0,
|
||||
/* tile_width = */ (CHGR_WIDTH+7)/8,
|
||||
/* tile_hight = */ (CHGR_HEIGHT+7)/8,
|
||||
/* default_x_offset = */ 0,
|
||||
/* flipmode_x_offset = */ 0,
|
||||
/* pixel_width = */ CHGR_WIDTH,
|
||||
/* pixel_height = */ CHGR_HEIGHT
|
||||
};
|
||||
|
||||
|
||||
uint8_t u8x8_d_utf8(u8x8_t *u8g2, uint8_t msg, uint8_t arg_int, void *arg_ptr)
|
||||
{
|
||||
u8g2_uint_t x, y, c;
|
||||
uint8_t *ptr;
|
||||
switch(msg)
|
||||
{
|
||||
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
|
||||
u8x8_d_helper_display_setup_memory(u8g2, &u8x8_utf8_info);
|
||||
break;
|
||||
case U8X8_MSG_DISPLAY_INIT:
|
||||
u8x8_d_helper_display_init(u8g2);
|
||||
chgr_clear();
|
||||
break;
|
||||
case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
|
||||
break;
|
||||
case U8X8_MSG_DISPLAY_SET_FLIP_MODE:
|
||||
break;
|
||||
case U8X8_MSG_DISPLAY_SET_CONTRAST:
|
||||
break;
|
||||
case U8X8_MSG_DISPLAY_DRAW_TILE:
|
||||
|
||||
x = ((u8x8_tile_t *)arg_ptr)->x_pos;
|
||||
//printf("U8X8_MSG_DISPLAY_DRAW_TILE x=%d, ", x);
|
||||
x *= 8;
|
||||
x += u8g2->x_offset;
|
||||
|
||||
y = ((u8x8_tile_t *)arg_ptr)->y_pos;
|
||||
//printf("y=%d, c=%d\n", y, ((u8x8_tile_t *)arg_ptr)->cnt);
|
||||
y *= 8;
|
||||
|
||||
do
|
||||
{
|
||||
c = ((u8x8_tile_t *)arg_ptr)->cnt;
|
||||
ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr;
|
||||
chgr_set_multiple_8pixel(x, y, c*8, ptr, 1);
|
||||
arg_int--;
|
||||
x += c*8;
|
||||
} while( arg_int > 0 );
|
||||
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void u8x8_Setup_Utf8(u8x8_t *u8x8)
|
||||
{
|
||||
/* setup defaults */
|
||||
u8x8_SetupDefaults(u8x8);
|
||||
|
||||
/* setup specific callbacks */
|
||||
u8x8->display_cb = u8x8_d_utf8;
|
||||
|
||||
/* setup display info */
|
||||
u8x8_SetupMemory(u8x8);
|
||||
}
|
||||
|
||||
void u8g2_SetupBuffer_Utf8(u8g2_t *u8g2, const u8g2_cb_t *u8g2_cb)
|
||||
{
|
||||
static uint8_t buf[CHGR_WIDTH*8]; // i guess this is to big. it should be (CHGR_WIDTH+7)/8
|
||||
|
||||
u8x8_Setup_Utf8(u8g2_GetU8x8(u8g2));
|
||||
|
||||
// u8g2_ll_hvline_vertical_top_lsb
|
||||
// u8g2_ll_hvline_horizontal_right_lsb
|
||||
|
||||
u8g2_SetupBuffer(u8g2, buf, 1, u8g2_ll_hvline_vertical_top_lsb, u8g2_cb);
|
||||
}
|
||||
|
||||
void utf8_show(void)
|
||||
{
|
||||
chgr_show();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
#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_DrawUTF8Line(&u8g2, 5, 15, 10, "Agile", 2,1);
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#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_DrawFilledEllipse(&u8g2, 30, 28, 23, 27, U8G2_DRAW_ALL);
|
||||
u8g2_DrawStr(&u8g2, 50, 10, "Ellipse");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
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_R3);
|
||||
|
||||
|
||||
u8g2_InitDisplay(&u8g2);
|
||||
u8g2_SetPowerSave(&u8g2, 0);
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_6x13_tf);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
printf("u8g2.tile_curr_row=%d\n", u8g2.tile_curr_row);
|
||||
printf("u8g2.pixel_curr_row=%d\n", u8g2.pixel_curr_row);
|
||||
printf("u8g2.buf_y0=%d\n", u8g2.buf_y0);
|
||||
printf("u8g2.buf_y1=%d\n", u8g2.buf_y1);
|
||||
printf("u8g2.user_x0=%d\n", u8g2.user_x0);
|
||||
printf("u8g2.user_x1=%d\n", u8g2.user_x1);
|
||||
printf("u8g2.user_y0=%d\n", u8g2.user_y0);
|
||||
printf("u8g2.user_y1=%d\n", u8g2.user_y1);
|
||||
u8g2_DrawFrame(&u8g2, 0, 0,
|
||||
u8g2_GetDisplayWidth(&u8g2), u8g2_GetDisplayHeight(&u8g2));
|
||||
u8g2_DrawPixel(&u8g2, 3, 3);
|
||||
//u8g2_DrawHLine(&u8g2, 0, 0, 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, u8g2_GetDisplayWidth(&u8g2)-9, 10, "Frame");
|
||||
//u8g2_DrawStr(&u8g2, u8g2_GetDisplayWidth(&u8g2)-8, 20, "Frame");
|
||||
//u8g2_DrawStr(&u8g2, u8g2_GetDisplayWidth(&u8g2)-7, 30, "Frame");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
printf("DisplayWidth = %d\n", u8g2_GetDisplayWidth(&u8g2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
uint8_t b[2] = { 0x55, 0x55 };
|
||||
|
||||
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_DrawHorizontalBitmap(&u8g2, 0, 0, 10, b);
|
||||
u8g2_DrawStr(&u8g2, 1, 20, "HorizontalBitmap");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -Wall -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
|
||||
|
||||
19
basic-setup/components/u8g2/sys/utf8/hello_world_8x8/main.c
Normal file
19
basic-setup/components/u8g2/sys/utf8/hello_world_8x8/main.c
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
#include "u8x8.h"
|
||||
|
||||
u8x8_t u8x8;
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
u8x8_Setup_Utf8(&u8x8);
|
||||
u8x8_InitDisplay(&u8x8);
|
||||
u8x8_SetPowerSave(&u8x8, 0);
|
||||
|
||||
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_extended_r );
|
||||
u8x8_DrawString(&u8x8, 0, 0, "Hello World!");
|
||||
|
||||
utf8_show();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -Wall -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
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int y;
|
||||
|
||||
u8g2_SetupBuffer_Utf8(&u8g2, &u8g2_cb_r0);
|
||||
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
||||
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
||||
|
||||
u8g2_SetFont(&u8g2, u8g2_font_5x7_tr);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
|
||||
#ifdef U8G2_WITH_HVLINE_COUNT
|
||||
u8g2.hv_cnt = 0UL;
|
||||
#endif /* U8G2_WITH_HVLINE_COUNT */
|
||||
|
||||
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
for( y = 3; y < 21; y++ )
|
||||
{
|
||||
u8g2_DrawHLine(&u8g2, 3, y, 11);
|
||||
}
|
||||
|
||||
u8g2_DrawStr(&u8g2, 17, 8, "Test Inter-");
|
||||
u8g2_DrawStr(&u8g2, 17, 16, "section:");
|
||||
u8g2_DrawStr(&u8g2, 17, 24, "One Block");
|
||||
|
||||
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
#ifdef U8G2_WITH_HVLINE_COUNT
|
||||
printf("hv cnt: %ld\n", u8g2.hv_cnt);
|
||||
#endif /* U8G2_WITH_HVLINE_COUNT */
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#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_mf);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
u8g2_FirstPage(&u8g2);
|
||||
do
|
||||
{
|
||||
u8g2.draw_color = 1;
|
||||
u8g2_DrawBox(&u8g2, 2, 8, 70, 20);
|
||||
u8g2.draw_color = 0;
|
||||
u8g2_DrawStr(&u8g2, 10, 14, "Hello World!");
|
||||
u8g2.draw_color = 0;
|
||||
u8g2_DrawBox(&u8g2, 9, 15, 31, 2);
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#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_DrawLine(&u8g2, 2, 3, 7, 9);
|
||||
u8g2_DrawStr(&u8g2, 30, 10, "DrawLine");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#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_DrawTriangle(&u8g2, 2, 2, 17, 9, 7, 21);
|
||||
u8g2_DrawStr(&u8g2, 22, 10, "DrawTriangle");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
#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_DrawRBox(&u8g2, 2, 3, 8, 9, 3);
|
||||
u8g2_DrawRBox(&u8g2, 12, 3, 5, 13, 2);
|
||||
u8g2_DrawRBox(&u8g2, 12,17, 13, 3, 1);
|
||||
|
||||
u8g2_DrawRFrame(&u8g2, 2,21, 11, 7, 3);
|
||||
u8g2_DrawRFrame(&u8g2, 25,24, 27, 5, 2);
|
||||
u8g2_DrawRFrame(&u8g2, 23,22, 31, 9, 3);
|
||||
u8g2_DrawStr(&u8g2, 30, 10, "RBox");
|
||||
u8g2_DrawStr(&u8g2, 30, 20, "RFrame");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#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_mf);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_5x7_mf);
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
|
||||
u8g2_UserInterfaceSelectionList(&u8g2, "Title", 0, "abc\ndef\nghi\njkl");
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -Wall -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
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
const char *str = "abc\ndef";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint8_t i, cnt;
|
||||
|
||||
u8g2_SetupBuffer_Utf8(&u8g2, &u8g2_cb_r0);
|
||||
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
||||
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_helvB10_tr);
|
||||
|
||||
|
||||
#ifdef U8G2_WITH_HVLINE_COUNT
|
||||
u8g2.hv_cnt = 0UL;
|
||||
#endif /* U8G2_WITH_HVLINE_COUNT */
|
||||
|
||||
u8g2_FirstPage(&u8g2);
|
||||
i = 0;
|
||||
cnt = u8x8_GetStringLineCnt(str);
|
||||
|
||||
do
|
||||
{
|
||||
for( i = 0; i < cnt; i++ )
|
||||
{
|
||||
u8g2_DrawStr(&u8g2, 0, i*12+11, u8x8_GetStringLine(i, str));
|
||||
}
|
||||
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
#ifdef U8G2_WITH_HVLINE_COUNT
|
||||
printf("hv cnt: %ld\n", u8g2.hv_cnt);
|
||||
#endif /* U8G2_WITH_HVLINE_COUNT */
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -Wall -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
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int x, y;
|
||||
int k;
|
||||
int i;
|
||||
|
||||
u8g2_SetupBuffer_Utf8(&u8g2, &u8g2_cb_r0);
|
||||
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
||||
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_helvB18_tr);
|
||||
|
||||
x = 50;
|
||||
y = 30+0;
|
||||
|
||||
|
||||
#ifdef U8G2_WITH_HVLINE_COUNT
|
||||
u8g2.hv_cnt = 0UL;
|
||||
#endif /* U8G2_WITH_HVLINE_COUNT */
|
||||
|
||||
/*
|
||||
u8g2_ClearBuffer(&u8g2);
|
||||
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_DrawStr(&u8g2, x, y, "ABC");
|
||||
u8g2_SetFontDirection(&u8g2, 1);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
u8g2_SetFontDirection(&u8g2, 2);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
u8g2_SetFontDirection(&u8g2, 3);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
|
||||
u8g2_SendBuffer(&u8g2);
|
||||
*/
|
||||
|
||||
u8g2_FirstPage(&u8g2);
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_DrawStr(&u8g2, x, y, "ABC");
|
||||
u8g2_SetFontDirection(&u8g2, 1);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
u8g2_SetFontDirection(&u8g2, 2);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
u8g2_SetFontDirection(&u8g2, 3);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
if ( i == 1 )
|
||||
{
|
||||
u8g2_DrawHVLine(&u8g2, u8g2.user_x0, u8g2.user_y0, 1, 0);
|
||||
u8g2_DrawHVLine(&u8g2, u8g2.user_x0, u8g2.user_y1-1, 1, 0);
|
||||
u8g2_DrawHVLine(&u8g2, u8g2.user_x1-1, u8g2.user_y1-1, 1, 0);
|
||||
u8g2_DrawHVLine(&u8g2, u8g2.user_x1-1, u8g2.user_y0, 1, 0);
|
||||
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
#ifdef U8G2_WITH_HVLINE_COUNT
|
||||
printf("hv cnt: %ld\n", u8g2.hv_cnt);
|
||||
#endif /* U8G2_WITH_HVLINE_COUNT */
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
44
basic-setup/components/u8g2/sys/utf8/xbm_picture_loop/main.c
Normal file
44
basic-setup/components/u8g2/sys/utf8/xbm_picture_loop/main.c
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
static unsigned char b[] = {
|
||||
0xff, 0xff, 0x07, 0x01, 0x00, 0x04, 0x01, 0x00, 0x04, 0x01, 0x08, 0x04,
|
||||
0xe1, 0x1e, 0x04, 0xb1, 0x13, 0x04, 0x11, 0x11, 0x04, 0x11, 0x79, 0x04,
|
||||
0xf1, 0x4f, 0x04, 0x99, 0xc4, 0x04, 0x89, 0x7f, 0x04, 0xc9, 0x38, 0x04,
|
||||
0xf1, 0x08, 0x04, 0x81, 0x08, 0x04, 0x81, 0x0f, 0x04, 0x01, 0xe2, 0x04,
|
||||
0x01, 0xda, 0x04, 0x01, 0xba, 0x04, 0x01, 0x9e, 0x04, 0x01, 0x4e, 0x04,
|
||||
0x01, 0x7e, 0x04, 0x01, 0x1e, 0x04, 0x01, 0x06, 0x04, 0x01, 0x06, 0x04,
|
||||
0x01, 0x06, 0x04, 0x01, 0x02, 0x04, 0x01, 0x00, 0x04, 0x01, 0x00, 0x04,
|
||||
0xff, 0xff, 0x07 };
|
||||
|
||||
|
||||
|
||||
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_DrawXBM(&u8g2, 1, 1, 19, 29, b);
|
||||
u8g2_DrawStr(&u8g2, 30, 20, "XBM");
|
||||
} while( u8g2_NextPage(&u8g2) );
|
||||
|
||||
utf8_show();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user