add u8g2 and ui libs (#91)
* add u8g2 and ui libs * add display driver and usage example * not init display in test mode * change todo text * fix removed code * Target f2 (#107) * add ioc for flipperzero f2 * add generated f1 files to f2 * regenerate cubemx * invert initial state of led * blink backligh * shutdown backlight on idle
This commit is contained in:
36
applications/examples/u8g2_example.c
Normal file
36
applications/examples/u8g2_example.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "u8g2/u8g2.h"
|
||||
#include "flipper.h"
|
||||
|
||||
void u8g2_example(void* p) {
|
||||
FuriRecordSubscriber* log = get_default_log();
|
||||
|
||||
// TODO try open record and retry on timeout (needs FURI behaviour change)
|
||||
delay(1000);
|
||||
|
||||
// open record
|
||||
FuriRecordSubscriber* fb_record = furi_open(
|
||||
"u8g2_fb", false, false, NULL, NULL, NULL
|
||||
);
|
||||
|
||||
if(fb_record == NULL) {
|
||||
fuprintf(log, "[widget] cannot create fb record\n");
|
||||
furiac_exit(NULL);
|
||||
}
|
||||
|
||||
while(1) {
|
||||
u8g2_t* fb = furi_take(fb_record);
|
||||
if(fb != NULL) {
|
||||
u8g2_SetFont(fb, u8g2_font_6x10_mf);
|
||||
u8g2_SetDrawColor(fb, 1);
|
||||
u8g2_SetFontMode(fb, 1);
|
||||
u8g2_DrawStr(fb, 2, 12, "hello world!");
|
||||
}
|
||||
furi_commit(fb_record);
|
||||
|
||||
if(fb != NULL) {
|
||||
furiac_exit(NULL);
|
||||
}
|
||||
|
||||
delay(1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user