Commit b15d6e79 authored by Stefan Haun's avatar Stefan Haun
Browse files

Fix code formatting

parent 5cbcd7e5
Pipeline #4140 passed with stages
in 49 seconds
......@@ -13,7 +13,7 @@
static TaskHandle_t lock = NULL;
static struct gfx_region *current_fb = &application_screen;
static bool fullscreen = false;
static bool fullscreen = false;
static int check_lock()
{
......@@ -75,7 +75,7 @@ int epic_disp_clear(uint16_t color)
if (cl < 0) {
return cl;
} else {
gfx_clear_to_color(current_fb, color);
gfx_clear_to_color(current_fb, color);
return 0;
}
}
......@@ -86,7 +86,7 @@ int epic_disp_pixel(int16_t x, int16_t y, uint16_t color)
if (cl < 0) {
return cl;
} else {
gfx_setpixel(current_fb, x, y, color);
gfx_setpixel(current_fb, x, y, color);
return 0;
}
}
......@@ -106,7 +106,7 @@ int epic_disp_line(
} else {
/* TODO add linestyle support to gfx code */
gfx_line(
current_fb,
current_fb,
xstart,
ystart,
xend,
......@@ -134,7 +134,7 @@ int epic_disp_rect(
switch (fillstyle) {
case FILLSTYLE_EMPTY:
gfx_rectangle(
current_fb,
current_fb,
xstart,
ystart,
xend - xstart,
......@@ -145,7 +145,7 @@ int epic_disp_rect(
break;
case FILLSTYLE_FILLED:
gfx_rectangle_fill(
current_fb,
current_fb,
xstart,
ystart,
xend - xstart,
......@@ -171,10 +171,10 @@ int epic_disp_circ(
switch (fillstyle) {
case FILLSTYLE_EMPTY:
gfx_circle(current_fb, x, y, rad, pixelsize, color);
gfx_circle(current_fb, x, y, rad, pixelsize, color);
break;
case FILLSTYLE_FILLED:
gfx_circle_fill(current_fb, x, y, rad, color);
gfx_circle_fill(current_fb, x, y, rad, color);
break;
}
......@@ -198,12 +198,13 @@ void compositor()
fb_pixel(overlay_screen.fb, x, y);
uint8_t *target = fb_pixel(display_screen.fb, x, y);
if ((overlay_pixel[0] == 0) && (overlay_pixel[1] == 0)) {
if ((overlay_pixel[0] == 0) &&
(overlay_pixel[1] == 0)) {
uint8_t *app_pixel =
fb_pixel(application_screen.fb, x, y);
target[0] = app_pixel[0];
target[1] = app_pixel[1];
} else {
target[0] = app_pixel[0];
target[1] = app_pixel[1];
} else {
target[0] = overlay_pixel[0];
target[1] = overlay_pixel[1];
}
......@@ -219,8 +220,8 @@ int epic_disp_update()
}
if (!fullscreen) {
compositor();
}
compositor();
}
gfx_update(&display_screen);
return 0;
......@@ -248,12 +249,12 @@ int epic_disp_open()
{
TaskHandle_t task = xTaskGetCurrentTaskHandle();
if (lock == task) {
current_fb = fullscreen ? &display_screen : &application_screen;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
} else if (lock == NULL) {
lock = task;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
lock = task;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
} else {
return -EBUSY;
}
......@@ -261,33 +262,33 @@ int epic_disp_open()
int epic_disp_set_fullscreen(bool enable)
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
int cl = check_lock();
if (cl < 0) {
return cl;
}
fullscreen = enable;
fullscreen = enable;
current_fb = fullscreen ? &display_screen : &application_screen;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
return 0;
}
bool epic_disp_is_fullscreen()
{
return fullscreen;
return fullscreen;
}
int epic_disp_overlay()
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
int cl = check_lock();
if (cl < 0) {
return cl;
}
current_fb = &overlay_screen;
current_fb = &overlay_screen;
return 0;
return 0;
}
int epic_disp_close()
......
......@@ -18,26 +18,26 @@ struct txt_buffer display_textb;
/***** Virtual framebuffers *****/
static uint8_t app_buffer[LCD_HEIGHT][LCD_WIDTH][2];
static struct framebuffer app_framebuffer = {
.data = app_buffer,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.stride = LCD_WIDTH * LCD_HEIGHT * 2,
.orientation = FB_O_180,
static struct framebuffer app_framebuffer = { .data = app_buffer,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.stride = LCD_WIDTH * LCD_HEIGHT *
2,
.orientation = FB_O_180,
.update = NULL };
.update = NULL };
struct gfx_region application_screen;
static uint8_t ovl_buffer[LCD_HEIGHT][LCD_WIDTH][2];
static struct framebuffer ovl_framebuffer = {
.data = ovl_buffer,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.stride = LCD_WIDTH * LCD_HEIGHT * 2,
.orientation = FB_O_180,
static struct framebuffer ovl_framebuffer = { .data = ovl_buffer,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.stride = LCD_WIDTH * LCD_HEIGHT *
2,
.orientation = FB_O_180,
.update = NULL };
.update = NULL };
struct gfx_region overlay_screen;
......@@ -69,13 +69,13 @@ void display_init(void)
txt_init(&display_textb, &display_screen, &Font12);
gfx_clear(&display_screen);
app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
application_screen = gfx_screen(&app_framebuffer);
gfx_clear(&application_screen);
app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
application_screen = gfx_screen(&app_framebuffer);
gfx_clear(&application_screen);
ovl_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
overlay_screen = gfx_screen(&ovl_framebuffer);
gfx_clear(&overlay_screen);
ovl_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
overlay_screen = gfx_screen(&ovl_framebuffer);
gfx_clear(&overlay_screen);
}
void display_init_slim(void)
......@@ -92,12 +92,11 @@ void display_init_slim(void)
display_screen = gfx_screen(LCD_framebuffer());
txt_init(&display_textb, &display_screen, &Font12);
app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
application_screen = gfx_screen(&app_framebuffer);
gfx_clear(&application_screen);
ovl_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
overlay_screen = gfx_screen(&ovl_framebuffer);
gfx_clear(&overlay_screen);
app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
application_screen = gfx_screen(&app_framebuffer);
gfx_clear(&application_screen);
ovl_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
overlay_screen = gfx_screen(&ovl_framebuffer);
gfx_clear(&overlay_screen);
}
......@@ -244,21 +244,24 @@ static MP_DEFINE_CONST_FUN_OBJ_0(display_open_obj, mp_display_open);
static mp_obj_t mp_display_set_fullscreen(mp_obj_t enable_obj)
{
int res = epic_disp_set_fullscreen(mp_obj_is_true(enable_obj));
if (res < 0) {
mp_raise_OSError(-res);
}
return mp_const_none;
int res = epic_disp_set_fullscreen(mp_obj_is_true(enable_obj));
if (res < 0) {
mp_raise_OSError(-res);
}
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_1(display_set_fullscreen_obj, mp_display_set_fullscreen);
static MP_DEFINE_CONST_FUN_OBJ_1(
display_set_fullscreen_obj, mp_display_set_fullscreen
);
static mp_obj_t mp_display_is_fullscreen()
{
bool res = epic_disp_is_fullscreen();
return mp_obj_new_bool(res);
bool res = epic_disp_is_fullscreen();
return mp_obj_new_bool(res);
}
static MP_DEFINE_CONST_FUN_OBJ_0(display_is_fullscreen_obj, mp_display_is_fullscreen);
static MP_DEFINE_CONST_FUN_OBJ_0(
display_is_fullscreen_obj, mp_display_is_fullscreen
);
/* Overlay mode is not exposed to Python apps*/
......@@ -276,8 +279,10 @@ static MP_DEFINE_CONST_FUN_OBJ_0(display_close_obj, mp_display_close);
static const mp_rom_map_elem_t display_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys_display) },
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&display_open_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_fullscreen), MP_ROM_PTR(&display_set_fullscreen_obj) },
{ MP_ROM_QSTR(MP_QSTR_is_fullscreen), MP_ROM_PTR(&display_is_fullscreen_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_fullscreen),
MP_ROM_PTR(&display_set_fullscreen_obj) },
{ MP_ROM_QSTR(MP_QSTR_is_fullscreen),
MP_ROM_PTR(&display_is_fullscreen_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&display_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_print), MP_ROM_PTR(&display_print_obj) },
{ MP_ROM_QSTR(MP_QSTR_print_adv), MP_ROM_PTR(&display_print_adv_obj) },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment