Exemple #1
0
from trezorui import Display

from trezor import io, loop, res, utils

if __debug__:
    from apps.debug import notify_layout_change

if False:
    from typing import Any, Awaitable, Generator, List, Tuple, TypeVar

    Pos = Tuple[int, int]
    Area = Tuple[int, int, int, int]
    ResultValue = TypeVar("ResultValue")

# all rendering is done through a singleton of `Display`
display = Display()

# re-export constants from modtrezorui
NORMAL = Display.FONT_NORMAL
BOLD = Display.FONT_BOLD
MONO = Display.FONT_MONO
MONO_BOLD = Display.FONT_MONO_BOLD
SIZE = Display.FONT_SIZE
WIDTH = Display.WIDTH
HEIGHT = Display.HEIGHT

# viewport margins
VIEWX = const(6)
VIEWY = const(9)

# channel used to cancel layouts, see `Cancelled` exception
Exemple #2
0
import usb

usb.bus.open()

import trezorio as io
from trezorui import Display

d = Display()

d.clear()
d.backlight(255)

i = 0

while True:
    d.print("Loop %d\n" % i)
    i += 1
    r = [0, 0]
    if io.poll([io.TOUCH], r, 1000000):
        print("TOUCH", r)
    else:
        print("NOTOUCH")
Exemple #3
0
import usb

usb.bus.open()

import trezorio as io
from trezorui import Display

d = Display()

d.clear()
d.backlight(255)

i = 0

while True:
    d.print('Loop %d\n' % i)
    i += 1
    r = [0, 0]
    if io.poll([io.TOUCH], r, 1000000):
        print('TOUCH', r)
    else:
        print('NOTOUCH')
Exemple #4
0
cache_seed = storage.cache.get(storage.cache.APP_COMMON_SEED)
print("cache seed", cache_seed)
storage.cache.set(storage.cache.APP_COMMON_SEED, 1234)
cache_seed = storage.cache.get(storage.cache.APP_COMMON_SEED)
print("cache seed", cache_seed)

res1 = storage.resident_credentials.get(1)
print("Res credential 1", res1)
res1 = storage.resident_credentials.set(1, b"0" * 31 + b"F")
res1 = storage.resident_credentials.get(1)
print("Res credential 1", res1)

i = 0

d = Display()
d.clear()
d.backlight(255)

while True:
    d.clear()
    d.text(0, 20, "Hamburgefont %d" % i, Display.FONT_NORMAL, 0xFFFF, 0x0000)
    d.text(0, 40, "Hamburgefont %d" % i, Display.FONT_BOLD, 0xFFFF, 0x0000)
    d.text(0, 60, "Hamburgefont %d" % i, Display.FONT_MONO, 0xFFFF, 0x0000)
    i += 1
    r = [0, 0]
    if io.poll([io.TOUCH], r, 1000000):
        print("TOUCH", r)
    else:
        print("NOTOUCH")
    d.refresh()