mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 06:18:07 +00:00
use python implementation for backlight (for now)
This commit is contained in:
parent
92f95d9521
commit
0f24eb2e0e
@ -7,6 +7,17 @@ from trezor import loop
|
||||
|
||||
display = Display()
|
||||
|
||||
# workaround for missing display.backlight in stmhal
|
||||
def backlight(val: int):
|
||||
import sys
|
||||
if sys.platform == 'trezor':
|
||||
import pyb
|
||||
timer = pyb.Timer(1, freq=1000)
|
||||
val = max(0, min(100, val * 100 // 255))
|
||||
timer.channel(1, pyb.Timer.PWM_INVERTED, pin=pyb.Pin.board.LCD_PWM, pulse_width_percent=val)
|
||||
else:
|
||||
display.backlight(val)
|
||||
|
||||
|
||||
def rgbcolor(r: int, g: int, b: int) -> int:
|
||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)
|
||||
|
Loading…
Reference in New Issue
Block a user