mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 11:28:14 +00:00
add trezor.utils (pure python)
This commit is contained in:
parent
4ff68e7494
commit
e88cd6f20d
@ -3,7 +3,7 @@ from TrezorUi import Display, Touch
|
||||
display = Display()
|
||||
touch = Touch()
|
||||
|
||||
def rgbcolor(r, g, b):
|
||||
def rgbcolor(r: int, g: int, b: int) -> int:
|
||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)
|
||||
|
||||
RED = rgbcolor(0xF4, 0x43, 0x36)
|
||||
|
5
src/trezor/utils.py
Normal file
5
src/trezor/utils.py
Normal file
@ -0,0 +1,5 @@
|
||||
def hexlify(data: bytes) -> str:
|
||||
return ''.join(['%02x' % b for b in data])
|
||||
|
||||
def unhexlify(data: str) -> bytes:
|
||||
return bytes([int(data[i:i+2], 16) for i in range(0, len(data), 2)])
|
Loading…
Reference in New Issue
Block a user