Files
uv-k5-v3-emulator/tools/uvk5_keys.py
T
mckero a310429eff Correct the docs that said PTT did not exist
Three places claimed there was no PTT line, and one of them named the wrong pin
(GPIOC rather than PB10). All now say the same thing: PTT works, but not through
the key table, because the firmware reads its own pin instead of scanning it as a
matrix key.

Documents the transmit bar's two gates -- FUNCTION_TRANSMIT and gSetting_mic_bar,
the latter already on because blank flash reads 0xFF -- and why the release path
gets more attention than the press: a stuck PTT leaves every later test running
against a transmitting radio.

Also records the '.key' vs '.key[data-key]' trap for whoever adds the next
non-key button.
2026-08-29 05:18:57 +01:00

26 lines
765 B
Python

#!/usr/bin/env python3
"""Key names the keypad model accepts.
Mirrors keypad_key_names in qemu/py32f071.c. test_uvk5_keys.py parses that array
out of the model source and fails if the two drift apart.
PTT is absent on purpose, and still is now that the model supports it: the firmware
reads PB10 directly rather than scanning PTT as a matrix key, so it is exposed as its
own boolean property and its own endpoint (POST /api/ptt) instead of a name here. The
"press" property rejects "PTT".
"""
KEYS = (
"MENU", "UP", "DOWN", "EXIT", "F", "STAR",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"SIDE1", "SIDE2",
)
def normalise(name) -> str:
return (name or "").strip().upper()
def is_valid(name) -> bool:
return normalise(name) in KEYS