You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
191 lines
8.2 KiB
191 lines
8.2 KiB
|
|
#include "u8g2.h" |
|
#include <stdio.h> |
|
|
|
|
|
u8g2_t u8g2; |
|
|
|
|
|
#define u8g2_logo_97x51_width 97 |
|
#define u8g2_logo_97x51_height 51 |
|
static unsigned char u8g2_logo_97x51_bits[] = { |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x3c, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, |
|
0x00, 0x00, 0x3c, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, |
|
0x03, 0x00, 0x00, 0x3c, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0xff, 0x03, 0x00, 0x00, 0x3c, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x80, 0xcf, 0x07, 0x00, 0x00, 0x3c, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x80, 0x83, 0x07, 0x00, 0x00, 0x3c, 0x80, 0x07, 0xf8, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x81, 0x07, 0x00, 0x00, 0x3c, 0x80, 0x07, 0xfc, 0x03, |
|
0x1c, 0x00, 0x3e, 0x1c, 0xc0, 0x03, 0x00, 0x00, 0x3c, 0x80, 0x07, 0xff, |
|
0x07, 0x7f, 0x80, 0xff, 0x3f, 0xe0, 0x01, 0x00, 0x00, 0x3c, 0x80, 0x07, |
|
0xff, 0x8f, 0xff, 0xc1, 0xff, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x80, |
|
0x87, 0xff, 0xdf, 0xff, 0xc1, 0xc3, 0x07, 0x7c, 0x00, 0x00, 0x00, 0x3c, |
|
0x80, 0x87, 0x0f, 0xfe, 0xff, 0xe3, 0x81, 0x03, 0x1e, 0x00, 0x00, 0x00, |
|
0x3c, 0x80, 0xc7, 0x07, 0xfc, 0xe3, 0xe3, 0x81, 0x07, 0x0f, 0x00, 0x00, |
|
0x00, 0x3c, 0x80, 0xc7, 0x07, 0xf8, 0xc1, 0xe7, 0x81, 0x87, 0xff, 0x07, |
|
0x00, 0x00, 0x3c, 0x80, 0xc7, 0x03, 0xf0, 0x80, 0xe7, 0xc3, 0x87, 0xff, |
|
0x07, 0x00, 0x00, 0x3c, 0x80, 0xc7, 0x03, 0x70, 0x80, 0xc7, 0xe7, 0x83, |
|
0xff, 0x07, 0x00, 0x00, 0x3c, 0x80, 0xc7, 0x03, 0x78, 0x80, 0xc7, 0xff, |
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x80, 0xc7, 0x03, 0xf8, 0xc0, 0x87, |
|
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x80, 0xc7, 0x07, 0xfc, 0xc1, |
|
0xc7, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xc0, 0x87, 0x0f, 0xfe, |
|
0xff, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xc0, 0x83, 0xff, |
|
0xdf, 0xff, 0xe3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf1, 0x03, |
|
0xff, 0x8f, 0xff, 0xe1, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, |
|
0x01, 0xfe, 0x0f, 0xff, 0xc0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, |
|
0xff, 0x00, 0xfc, 0x03, 0x7c, 0xc0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, |
|
0x80, 0x3f, 0x00, 0xf8, 0x01, 0x00, 0xe0, 0x01, 0x1e, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x1e, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x1e, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf0, 0xc7, 0x0f, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xe0, 0xff, |
|
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, |
|
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, |
|
0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, |
|
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x20, 0x00, |
|
0x00, 0x08, 0x46, 0x02, 0x00, 0x80, 0xc0, 0x40, 0x00, 0x0c, 0x6e, 0x6a, |
|
0xc0, 0xa4, 0x48, 0x04, 0xaa, 0xac, 0x8c, 0xaa, 0xac, 0x00, 0x6a, 0xa4, |
|
0xaa, 0x20, 0xea, 0xa4, 0x64, 0x66, 0xaa, 0x46, 0x4a, 0x8a, 0x00, 0x4c, |
|
0xa4, 0xaa, 0x20, 0xaa, 0xa2, 0x44, 0x2a, 0xaa, 0x28, 0xaa, 0x4c, 0x00, |
|
0xe8, 0xa8, 0x6c, 0xc4, 0xa4, 0x42, 0xee, 0x2a, 0xcc, 0x26, 0x6c, 0xe8, |
|
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00 }; |
|
|
|
|
|
// picture from issue 60 |
|
const unsigned char FESTO[330]= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xfc, 0xff, |
|
0xff, 0xfe, 0x7f, 0xff, 0xfc, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xfc, 0x7f, 0xff, 0xfc, 0xff, |
|
0xff, 0xfe, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xfc, 0x7f, 0xff, 0xfc, 0xff, |
|
0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xfe, 0x7f, 0xff, 0xfc, 0xff, |
|
0xff, 0xfc, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xfe, 0x7f, 0xff, 0xfe, 0x7e, 0x00, 0x00, |
|
0xfc, 0x00, 0x00, 0xfc, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x7c, 0x00, 0x7e, 0x7e, |
|
0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0x00, |
|
0x3e, 0x7e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x7c, 0x00, |
|
0x7c, 0x00, 0x3e, 0x7e, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, |
|
0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, |
|
0x00, 0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0xff, 0xff, |
|
0xfc, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7f, |
|
0xff, 0xfe, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf8, |
|
0x3f, 0xff, 0xfe, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7e, 0x00, 0x00, 0xfc, |
|
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7e, |
|
0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7c, 0x00, 0x7c, |
|
0x00, 0x3e, 0x7e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, |
|
0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, |
|
0x00, 0x7e, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x3e, 0x7e, 0x00, 0x00, 0xff, |
|
0xff, 0xfc, 0xff, 0xff, 0xfe, 0x00, 0x7c, 0x00, 0x7f, 0xff, 0xfe, 0x7e, 0x00, |
|
0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0x00, 0x7c, 0x00, 0x7f, 0xff, 0xfe, |
|
0x7e, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x00, 0x7c, 0x00, 0x7f, |
|
0xff, 0xfc, 0x7e, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xfc, 0x00, 0x7c, |
|
0x00, 0x3f, 0xff, 0xfc, 0x7e, 0x00, 0x00, 0xff, |
|
0xff, 0xfe, 0x1f, 0xff, 0xf0, 0x00, 0x7c, 0x00, 0x1f, 0xff, 0xf8, }; |
|
|
|
|
|
int main(void) |
|
{ |
|
int x, y; |
|
int k; |
|
int i; |
|
|
|
u8g2_SetupBuffer_SDL_128x64_4(&u8g2, &u8g2_cb_r0); |
|
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2)); |
|
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0); |
|
|
|
u8g2_SetFont(&u8g2, u8g2_font_6x10_tf); |
|
|
|
x = 30; |
|
y = 31-7; |
|
|
|
|
|
for(;;) |
|
{ |
|
#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_DrawXBMP(&u8g2, x, y, u8g2_logo_97x51_width, u8g2_logo_97x51_height, u8g2_logo_97x51_bits); |
|
//u8g2_DrawXBM(&u8g2, x, y, 120, 22, FESTO); |
|
|
|
|
|
|
|
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 */ |
|
|
|
do |
|
{ |
|
k = u8g_sdl_get_key(); |
|
} while( k < 0 ); |
|
|
|
if ( k == 273 ) y -= 1; |
|
if ( k == 274 ) y += 1; |
|
if ( k == 276 ) x -= 1; |
|
if ( k == 275 ) x += 1; |
|
|
|
if ( k == 'e' ) y -= 1; |
|
if ( k == 'x' ) y += 1; |
|
if ( k == 's' ) x -= 1; |
|
if ( k == 'd' ) x += 1; |
|
if ( k == 'q' ) break; |
|
|
|
} |
|
|
|
//u8x8_Set8x8Font(u8g2_GetU8x8(&u8g2), bdf_font); |
|
//u8x8_Draw8x8String(u8g2_GetU8x8(&u8g2), 0, 0, "Hello World!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
} |
|
|
|
|