Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Haun
firmware
Commits
e3902ef9
Commit
e3902ef9
authored
Aug 24, 2019
by
Stefan Haun
Browse files
Expose fullscreen handling to Python API
parent
cfeeb7a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
pycardium/modules/py/display.py
View file @
e3902ef9
...
...
@@ -42,6 +42,19 @@ class Display:
"""
return
cls
()
def
set_fullscreen
(
self
,
enable
):
"""
Enable/disable fullscreen, so that overlays are not shown.
Will fail the display can't be locked
"""
sys_display
.
set_fullscreen
(
enable
)
def
is_fullscreen
(
self
):
"""
Check if application is in fullscreen.
"""
return
sys_display
.
is_fullscreen
()
@
staticmethod
def
close
():
"""
...
...
pycardium/modules/qstrdefs.h
View file @
e3902ef9
...
...
@@ -93,6 +93,8 @@ Q(read_thermistor_voltage)
/* display */
Q
(
sys_display
)
Q
(
set_fullscreen
)
Q
(
is_fullscreen
)
Q
(
display
)
Q
(
print
)
Q
(
print_adv
)
...
...
pycardium/modules/sys_display.c
View file @
e3902ef9
...
...
@@ -242,6 +242,26 @@ static mp_obj_t mp_display_open()
}
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
;
}
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
);
}
static
MP_DEFINE_CONST_FUN_OBJ_0
(
display_is_fullscreen_obj
,
mp_display_is_fullscreen
);
/* Overlay mode is not exposed to Python apps*/
static
mp_obj_t
mp_display_close
()
{
int
res
=
epic_disp_close
();
...
...
@@ -256,6 +276,8 @@ 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_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
)
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment