more
This commit is contained in:
parent
9c8827cdab
commit
f2c5a6fe91
@ -17,13 +17,13 @@ hsm_active = None
|
||||
# setup by main.py, expected to always be present
|
||||
settings = None
|
||||
|
||||
# PSRAM (on Mk4 only)
|
||||
# PSRAM
|
||||
PSRAM = None
|
||||
|
||||
# Virtual Disk (Mk4)
|
||||
# Virtual Disk
|
||||
VD = None
|
||||
|
||||
# NFC interface (Mk4, and can be disabled)
|
||||
# NFC interface (Mk4, can be disabled)
|
||||
NFC = None
|
||||
|
||||
# QR scanner (Q1 only)
|
||||
|
||||
@ -115,6 +115,10 @@ class LoginUX:
|
||||
if self.pin:
|
||||
self.pin = self.pin[:-1]
|
||||
self.show_pin()
|
||||
else:
|
||||
# clear input, because they have a BS key
|
||||
self.pin = ''
|
||||
self.show_pin()
|
||||
|
||||
elif ch == KEY_SELECT:
|
||||
if len(self.pin) < MIN_PIN_PART_LEN:
|
||||
|
||||
@ -7,6 +7,7 @@ freeze_as_mpy('', [
|
||||
'scanner.py',
|
||||
'lcd_display.py',
|
||||
'st7788.py',
|
||||
'gpu.py',
|
||||
'vdisk.py',
|
||||
'nfc.py',
|
||||
'ndef.py',
|
||||
@ -17,8 +18,9 @@ freeze_as_mpy('', [
|
||||
# Optimize data-like files, since no need to debug them.
|
||||
freeze_as_mpy('', [
|
||||
'graphics.py', # TODO remove
|
||||
'graphics_mk4.py', # TODO remove
|
||||
#'graphics_mk4.py', # TODO remove
|
||||
'graphics_q1.py',
|
||||
'font_iosevka.py',
|
||||
'gpu_binary.py', # remove someday?
|
||||
], opt=3)
|
||||
|
||||
|
||||
17
shared/q1.py
17
shared/q1.py
@ -16,21 +16,24 @@ def init0():
|
||||
|
||||
mk4_init0()
|
||||
|
||||
from scanner import QRScanner
|
||||
glob.SCAN = QRScanner()
|
||||
|
||||
# XXX do not ship like this XXX
|
||||
ckcc.vcp_enabled(True)
|
||||
print("REPL enabled")
|
||||
ckcc.vcp_enabled(True); print("REPL enabled")
|
||||
|
||||
# Setup various hardware features of the Q1
|
||||
# - try to continue in case of errors/hardware faults
|
||||
try:
|
||||
from scanner import QRScanner
|
||||
glob.SCAN = QRScanner()
|
||||
except: pass
|
||||
|
||||
try:
|
||||
setup_adc()
|
||||
print('Batt volt: %s' % get_batt_level())
|
||||
#print('Batt volt: %s' % get_batt_level())
|
||||
except BaseException as exc:
|
||||
sys.print_exception(exc)
|
||||
|
||||
def setup_adc():
|
||||
# configure VREF source as internap 2.5v
|
||||
# configure VREF source as internal 2.5v
|
||||
VREF_LAYOUT = {
|
||||
"CSR": 0 | uctypes.UINT32,
|
||||
"CCR": 4 | uctypes.UINT32,
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
# DEBUG ONLY -- only installed for debug builds
|
||||
# Hack to monitor screen contents, as text.
|
||||
# Import this file to install the hacks.
|
||||
#
|
||||
import ux, version
|
||||
|
||||
global contents, full_contents, story
|
||||
|
||||
@ -15,13 +15,12 @@ CASET = const(0x2a)
|
||||
RASET = const(0x2b)
|
||||
RAMWR = const(0x2c)
|
||||
|
||||
# TODO: move fully into C code
|
||||
# - w/ zlib expansion
|
||||
# - with window control
|
||||
# - with font lookups / a text-only layer
|
||||
# - maybe: with QR module expansion?
|
||||
# Lots of drawing code now in C code:
|
||||
# - zlib expansion
|
||||
# - font lookups / a text-only layer
|
||||
# - QR module expansion
|
||||
# - clear to pixel value
|
||||
# - palette + xy/wh + nible-packed palette lookup (for font)
|
||||
# - (MAYBE NOT) palette + xy/wh + nible-packed palette lookup (for font)
|
||||
# - see stm32/COLDCARD_Q1/modlcd.c for code
|
||||
import lcd
|
||||
|
||||
@ -34,8 +33,11 @@ class ST7788():
|
||||
|
||||
self.spi = machine.SPI(1, baudrate=60_000_000, polarity=0, phase=0)
|
||||
#reset_pin = Pin('LCD_RESET', Pin.OUT) # not using
|
||||
self.dc = Pin('LCD_DATA_CMD', Pin.OUT, value=0)
|
||||
self.cs = Pin('LCD_CS', Pin.OUT, value=1)
|
||||
#self.dc = Pin('LCD_DATA_CMD', Pin.OUT, value=0)
|
||||
#self.cs = Pin('LCD_CS', Pin.OUT, value=1)
|
||||
# do not change careful GPIO setup from bootloader
|
||||
self.dc = Pin('LCD_DATA_CMD')
|
||||
self.cs = Pin('LCD_CS')
|
||||
|
||||
if 0:
|
||||
# BUST - just fades away
|
||||
|
||||
@ -199,13 +199,14 @@ async def ux_show_story(msg, title=None, escape=None, sensitive=False, strict_es
|
||||
top = max(0, len(lines)-(STORY_H//2))
|
||||
elif ch == '0' or ch == KEY_HOME:
|
||||
top = 0
|
||||
elif ch == '7' or ch == KEY_PAGE_UP:
|
||||
elif ch == '7' or ch == KEY_PAGE_UP or ch == KEY_UP:
|
||||
top = max(0, top-STORY_H)
|
||||
elif ch == '9' or ch == KEY_PAGE_DOWN:
|
||||
elif ch == '9' or ch == KEY_PAGE_DOWN or ch == KEY_DOWN:
|
||||
top = min(len(lines)-2, top+STORY_H)
|
||||
elif ch == '5' or ch == KEY_UP:
|
||||
elif ch == '5':
|
||||
# line up/down only on Mk4; too slow w/ Q1's big screen
|
||||
top = max(0, top-1)
|
||||
elif ch == '8' or ch == KEY_DOWN:
|
||||
elif ch == '8':
|
||||
top = min(len(lines)-2, top+1)
|
||||
elif not strict_escape:
|
||||
if ch in { KEY_NFC, KEY_QR }:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user