diff --git a/docs/api.md b/docs/api.md index c3c485d011..d34914b9ea 100644 --- a/docs/api.md +++ b/docs/api.md @@ -276,6 +276,9 @@ Function returns None if timeout specified in microseconds is reached. def trezor.ui.rgbcolor(r: int, g: int, b: int) -> int ``` ``` python +def trezor.ui.in_area(pos: tuple, area: tuple) -> bool +``` +``` python def trezor.ui.lerpi(a: int, b: int, t: float) -> int ``` ``` python @@ -359,17 +362,19 @@ When icon and iconfgcolor are provided, an icon is drawn in the middle using the Icon needs to be of exaclty 96x96 pixels size. ``` python -def trezor.ui.display.orientation(degrees: int) -> None +def trezor.ui.display.orientation(degrees: int=None) -> int ``` Sets display orientation to 0, 90, 180 or 270 degrees. Everything needs to be redrawn again when this function is used. +Call without the degrees parameter to just perform the read of the value. ``` python -def trezor.ui.display.backlight(val: int) -> None +def trezor.ui.display.backlight(val: int=None) -> int ``` Sets backlight intensity to the value specified in val. +Call without the val parameter to just perform the read of the value. ``` python def trezor.ui.display.raw(reg: int, data: bytes) -> None diff --git a/docs/api.py b/docs/api.py index dd16acb964..04fd219dff 100755 --- a/docs/api.py +++ b/docs/api.py @@ -20,6 +20,8 @@ def process_file(fn): r.append('') elif ext == '.py': mod = mod[4:].replace('/', '.') + if mod.endswith('.__init__'): + mod = mod[:-9] for l in src: l = l.rstrip() if l.startswith('def '): diff --git a/docs/api.template.md b/docs/api.template.md index 5b4a94c03b..1b96918070 100644 --- a/docs/api.template.md +++ b/docs/api.template.md @@ -58,7 +58,7 @@ Syntax used below is a valid Python function declaration with type hints defined ##trezor.ui -@src/trezor/ui.py +@src/trezor/ui/__init__.py ###trezor.ui.display diff --git a/src/trezor/ui/__init__.py b/src/trezor/ui/__init__.py index c4482de159..cddf161d21 100644 --- a/src/trezor/ui/__init__.py +++ b/src/trezor/ui/__init__.py @@ -39,7 +39,7 @@ NORMAL = const(1) BOLD = const(2) -def in_area(pos, area): +def in_area(pos: tuple, area: tuple) -> bool: x, y = pos ax, ay, aw, ah = area return ax <= x <= ax + aw and ay <= y <= ay + ah