Commit 7a4dcfbf authored by Stefan Haun's avatar Stefan Haun
Browse files

Fix code formatting

parent e3902ef9
Pipeline #4139 passed with stages
in 46 seconds
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
static TaskHandle_t lock = NULL; static TaskHandle_t lock = NULL;
static struct gfx_region *current_fb = &application_screen; static struct gfx_region *current_fb = &application_screen;
static bool fullscreen = false; static bool fullscreen = false;
static int check_lock() static int check_lock()
{ {
...@@ -74,7 +74,7 @@ int epic_disp_clear(uint16_t color) ...@@ -74,7 +74,7 @@ int epic_disp_clear(uint16_t color)
if (cl < 0) { if (cl < 0) {
return cl; return cl;
} else { } else {
gfx_clear_to_color(current_fb, color); gfx_clear_to_color(current_fb, color);
return 0; return 0;
} }
} }
...@@ -85,7 +85,7 @@ int epic_disp_pixel(int16_t x, int16_t y, uint16_t color) ...@@ -85,7 +85,7 @@ int epic_disp_pixel(int16_t x, int16_t y, uint16_t color)
if (cl < 0) { if (cl < 0) {
return cl; return cl;
} else { } else {
gfx_setpixel(current_fb, x, y, color); gfx_setpixel(current_fb, x, y, color);
return 0; return 0;
} }
} }
...@@ -105,7 +105,7 @@ int epic_disp_line( ...@@ -105,7 +105,7 @@ int epic_disp_line(
} else { } else {
/* TODO add linestyle support to gfx code */ /* TODO add linestyle support to gfx code */
gfx_line( gfx_line(
current_fb, current_fb,
xstart, xstart,
ystart, ystart,
xend, xend,
...@@ -133,7 +133,7 @@ int epic_disp_rect( ...@@ -133,7 +133,7 @@ int epic_disp_rect(
switch (fillstyle) { switch (fillstyle) {
case FILLSTYLE_EMPTY: case FILLSTYLE_EMPTY:
gfx_rectangle( gfx_rectangle(
current_fb, current_fb,
xstart, xstart,
ystart, ystart,
xend - xstart, xend - xstart,
...@@ -144,7 +144,7 @@ int epic_disp_rect( ...@@ -144,7 +144,7 @@ int epic_disp_rect(
break; break;
case FILLSTYLE_FILLED: case FILLSTYLE_FILLED:
gfx_rectangle_fill( gfx_rectangle_fill(
current_fb, current_fb,
xstart, xstart,
ystart, ystart,
xend - xstart, xend - xstart,
...@@ -170,10 +170,10 @@ int epic_disp_circ( ...@@ -170,10 +170,10 @@ int epic_disp_circ(
switch (fillstyle) { switch (fillstyle) {
case FILLSTYLE_EMPTY: case FILLSTYLE_EMPTY:
gfx_circle(current_fb, x, y, rad, pixelsize, color); gfx_circle(current_fb, x, y, rad, pixelsize, color);
break; break;
case FILLSTYLE_FILLED: case FILLSTYLE_FILLED:
gfx_circle_fill(current_fb, x, y, rad, color); gfx_circle_fill(current_fb, x, y, rad, color);
break; break;
} }
...@@ -188,12 +188,13 @@ void compositor() ...@@ -188,12 +188,13 @@ void compositor()
fb_pixel(overlay_screen.fb, x, y); fb_pixel(overlay_screen.fb, x, y);
uint8_t *target = fb_pixel(display_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 = uint8_t *app_pixel =
fb_pixel(application_screen.fb, x, y); fb_pixel(application_screen.fb, x, y);
target[0] = app_pixel[0]; target[0] = app_pixel[0];
target[1] = app_pixel[1]; target[1] = app_pixel[1];
} else { } else {
target[0] = overlay_pixel[0]; target[0] = overlay_pixel[0];
target[1] = overlay_pixel[1]; target[1] = overlay_pixel[1];
} }
...@@ -209,8 +210,8 @@ int epic_disp_update() ...@@ -209,8 +210,8 @@ int epic_disp_update()
} }
if (!fullscreen) { if (!fullscreen) {
compositor(); compositor();
} }
gfx_update(&display_screen); gfx_update(&display_screen);
return 0; return 0;
...@@ -238,12 +239,12 @@ int epic_disp_open() ...@@ -238,12 +239,12 @@ int epic_disp_open()
{ {
TaskHandle_t task = xTaskGetCurrentTaskHandle(); TaskHandle_t task = xTaskGetCurrentTaskHandle();
if (lock == task) { if (lock == task) {
current_fb = fullscreen ? &display_screen : &application_screen; current_fb = fullscreen ? &display_screen : &application_screen;
return 0; return 0;
} else if (lock == NULL) { } else if (lock == NULL) {
lock = task; lock = task;
current_fb = fullscreen ? &display_screen : &application_screen; current_fb = fullscreen ? &display_screen : &application_screen;
return 0; return 0;
} else { } else {
return -EBUSY; return -EBUSY;
} }
...@@ -251,33 +252,33 @@ int epic_disp_open() ...@@ -251,33 +252,33 @@ int epic_disp_open()
int epic_disp_set_fullscreen(bool enable) int epic_disp_set_fullscreen(bool enable)
{ {
int cl = check_lock(); int cl = check_lock();
if (cl < 0) { if (cl < 0) {
return cl; 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() bool epic_disp_is_fullscreen()
{ {
return fullscreen; return fullscreen;
} }
int epic_disp_overlay() int epic_disp_overlay()
{ {
int cl = check_lock(); int cl = check_lock();
if (cl < 0) { if (cl < 0) {
return cl; return cl;
} }
current_fb = &overlay_screen; current_fb = &overlay_screen;
return 0; return 0;
} }
int epic_disp_close() int epic_disp_close()
......
...@@ -18,26 +18,26 @@ struct txt_buffer display_textb; ...@@ -18,26 +18,26 @@ struct txt_buffer display_textb;
/***** Virtual framebuffers *****/ /***** Virtual framebuffers *****/
static uint8_t app_buffer[LCD_HEIGHT][LCD_WIDTH][2]; static uint8_t app_buffer[LCD_HEIGHT][LCD_WIDTH][2];
static struct framebuffer app_framebuffer = { static struct framebuffer app_framebuffer = { .data = app_buffer,
.data = app_buffer, .width = LCD_WIDTH,
.width = LCD_WIDTH, .height = LCD_HEIGHT,
.height = LCD_HEIGHT, .stride = LCD_WIDTH * LCD_HEIGHT *
.stride = LCD_WIDTH * LCD_HEIGHT * 2, 2,
.orientation = FB_O_180, .orientation = FB_O_180,
.update = NULL }; .update = NULL };
struct gfx_region application_screen; struct gfx_region application_screen;
static uint8_t ovl_buffer[LCD_HEIGHT][LCD_WIDTH][2]; static uint8_t ovl_buffer[LCD_HEIGHT][LCD_WIDTH][2];
static struct framebuffer ovl_framebuffer = { static struct framebuffer ovl_framebuffer = { .data = ovl_buffer,
.data = ovl_buffer, .width = LCD_WIDTH,
.width = LCD_WIDTH, .height = LCD_HEIGHT,
.height = LCD_HEIGHT, .stride = LCD_WIDTH * LCD_HEIGHT *
.stride = LCD_WIDTH * LCD_HEIGHT * 2, 2,
.orientation = FB_O_180, .orientation = FB_O_180,
.update = NULL }; .update = NULL };
struct gfx_region overlay_screen; struct gfx_region overlay_screen;
...@@ -69,13 +69,13 @@ void display_init(void) ...@@ -69,13 +69,13 @@ void display_init(void)
txt_init(&display_textb, &display_screen, &Font12); txt_init(&display_textb, &display_screen, &Font12);
gfx_clear(&display_screen); gfx_clear(&display_screen);
app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb; app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
application_screen = gfx_screen(&app_framebuffer); application_screen = gfx_screen(&app_framebuffer);
gfx_clear(&application_screen); gfx_clear(&application_screen);
ovl_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb; ovl_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
overlay_screen = gfx_screen(&ovl_framebuffer); overlay_screen = gfx_screen(&ovl_framebuffer);
gfx_clear(&overlay_screen); gfx_clear(&overlay_screen);
} }
void display_init_slim(void) void display_init_slim(void)
...@@ -92,12 +92,11 @@ void display_init_slim(void) ...@@ -92,12 +92,11 @@ void display_init_slim(void)
display_screen = gfx_screen(LCD_framebuffer()); display_screen = gfx_screen(LCD_framebuffer());
txt_init(&display_textb, &display_screen, &Font12); txt_init(&display_textb, &display_screen, &Font12);
app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb; app_framebuffer.encode_color_rgb = display_screen.fb->encode_color_rgb;
application_screen = gfx_screen(&app_framebuffer); application_screen = gfx_screen(&app_framebuffer);
gfx_clear(&application_screen); 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);
} }
...@@ -244,21 +244,24 @@ static MP_DEFINE_CONST_FUN_OBJ_0(display_open_obj, mp_display_open); ...@@ -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) 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)); int res = epic_disp_set_fullscreen(mp_obj_is_true(enable_obj));
if (res < 0) { if (res < 0) {
mp_raise_OSError(-res); mp_raise_OSError(-res);
} }
return mp_const_none; 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() static mp_obj_t mp_display_is_fullscreen()
{ {
bool res = epic_disp_is_fullscreen(); bool res = epic_disp_is_fullscreen();
return mp_obj_new_bool(res); 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*/ /* 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); ...@@ -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[] = { 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___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_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_set_fullscreen),
{ MP_ROM_QSTR(MP_QSTR_is_fullscreen), MP_ROM_PTR(&display_is_fullscreen_obj) }, 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_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), MP_ROM_PTR(&display_print_obj) },
{ MP_ROM_QSTR(MP_QSTR_print_adv), MP_ROM_PTR(&display_print_adv_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