mirror of
https://github.com/Valeh2012/PersonalVotingMachine
synced 2025-12-08 18:15:11 +02:00
first commit
This commit is contained in:
12
basic-setup/components/u8g2/sys/bitmap/hello_world/Makefile
Normal file
12
basic-setup/components/u8g2/sys/bitmap/hello_world/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
CFLAGS = -g -Wall -I../../../csrc/.
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/u8x8_d_bitmap.c ) main.c
|
||||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
hello_world: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJ) hello_world *.tga
|
||||
|
||||
40
basic-setup/components/u8g2/sys/bitmap/hello_world/main.c
Normal file
40
basic-setup/components/u8g2/sys/bitmap/hello_world/main.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* This example uses the Bitmap device to draw to an in-memory buffer
|
||||
* and writes the result to a TGA file. This can for example be used to
|
||||
* make screenshots of an application normally running on an Arduino.
|
||||
*/
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
u8g2_SetupBitmap(&u8g2, &u8g2_cb_r0, 128, 64);
|
||||
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
||||
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_helvB08_tr);
|
||||
|
||||
u8g2_ClearBuffer(&u8g2);
|
||||
// Here, you can call other code to actually draw things, such as
|
||||
// existing application code to generate a screenshot
|
||||
u8g2_DrawStr(&u8g2, 10, 30, "Hello, world!");
|
||||
u8g2_SendBuffer(&u8g2);
|
||||
u8x8_SaveBitmapTGA(u8g2_GetU8x8(&u8g2), "small.tga");
|
||||
|
||||
// This changes size, but also resets other stuff like font
|
||||
u8g2_SetupBitmap(&u8g2, &u8g2_cb_r0, 128, 128);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_helvB08_tr);
|
||||
|
||||
u8g2_ClearBuffer(&u8g2);
|
||||
// Here, you can call other code to actually draw things, such as
|
||||
// existing application code to generate a screenshot
|
||||
u8g2_DrawStr(&u8g2, 10, 30, "Hello, world!");
|
||||
u8g2_DrawStr(&u8g2, 10, 100, "Hello, larger world!");
|
||||
u8g2_SendBuffer(&u8g2);
|
||||
u8x8_SaveBitmapTGA(u8g2_GetU8x8(&u8g2), "large.tga");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user