mirror of
https://github.com/Valeh2012/PersonalVotingMachine
synced 2025-12-08 10:05:12 +02:00
first commit
This commit is contained in:
12
basic-setup/components/u8g2/sys/sdl/u8log_u8x8/Makefile
Normal file
12
basic-setup/components/u8g2/sys/sdl/u8log_u8x8/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl2-config --cflags`
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
helloworld: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) `sdl2-config --libs` -o u8g2_sdl
|
||||
|
||||
clean:
|
||||
-rm $(OBJ) u8g2_sdl
|
||||
|
||||
50
basic-setup/components/u8g2/sys/sdl/u8log_u8x8/main.c
Normal file
50
basic-setup/components/u8g2/sys/sdl/u8log_u8x8/main.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "u8x8.h"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
u8x8_t u8x8;
|
||||
u8log_t u8log;
|
||||
|
||||
#define U8LOG_WIDTH 16
|
||||
#define U8LOG_HEIGHT 8
|
||||
|
||||
uint8_t u8log_buf[U8LOG_WIDTH*U8LOG_HEIGHT];
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int k;
|
||||
clock_t t;
|
||||
uint8_t c;
|
||||
|
||||
u8x8_Setup_SDL_128x64(&u8x8);
|
||||
u8x8_InitDisplay(&u8x8);
|
||||
|
||||
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_extended_f);
|
||||
|
||||
u8log_Init(&u8log, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buf);
|
||||
u8log_SetCallback(&u8log, u8log_u8x8_cb, &u8x8);
|
||||
//u8log_SetRedrawMode(&u8log, /* is_redraw_line_for_each_char = */ 1);
|
||||
u8log_SetRedrawMode(&u8log, /* is_redraw_line_for_each_char = */ 0);
|
||||
|
||||
t = clock()+CLOCKS_PER_SEC/10;
|
||||
for(;;)
|
||||
{
|
||||
|
||||
if ( t < clock() )
|
||||
{
|
||||
c = (t % 10) + '0';
|
||||
if ( c == '0' )
|
||||
c = '\n';
|
||||
u8log_WriteChar(&u8log, c);
|
||||
t = clock()+CLOCKS_PER_SEC/10;
|
||||
}
|
||||
|
||||
k = u8g_sdl_get_key();
|
||||
|
||||
if ( k == 'q' ) break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user