Преглед на файлове

Take the key overlay from the new radio-keyboard-tca submodule

k4be преди 2 седмици
родител
ревизия
a48b68c174
променени са 7 файла, в които са добавени 28 реда и са изтрити 29 реда
  1. 3 0
      .gitmodules
  2. 4 2
      Makefile
  3. 12 21
      README.md
  4. 4 2
      docs/REPORT.md
  5. 1 0
      keyboard
  6. 1 1
      panel
  7. 3 3
      tests/test_ui.py

+ 3 - 0
.gitmodules

@@ -1,3 +1,6 @@
 [submodule "panel"]
 	path = panel
 	url = ../s1d13700-tca
+[submodule "keyboard"]
+	path = keyboard
+	url = ../radio-keyboard-tca

+ 4 - 2
Makefile

@@ -4,13 +4,15 @@
 #   make panel-test  the panel core's own tests (in $(PANEL_DIR))
 #   make module      the DRM driver, against KDIR (for tests/hw_test.sh drm)
 #
-# PANEL_DIR is the s1d13700-tca repository: the submodule by default.
+# PANEL_DIR is the s1d13700-tca repository, KEYBOARD_DIR radio-keyboard-tca
+# (the key overlay the tests compare with): the submodules by default.
 
 BUILD     := build
 CC        ?= gcc
 CFLAGS    ?= -O2 -g
 CFLAGS    += -std=gnu11 -Wall -Wextra -MMD -MP
 PANEL_DIR ?= panel
+KEYBOARD_DIR ?= keyboard
 CFLAGS    += -I$(PANEL_DIR)/driver -I$(PANEL_DIR)/sim
 PYTHON    ?= python3
 PANEL_LIB := $(BUILD)/libradiopanel.so
@@ -18,7 +20,7 @@ PANEL_LIB := $(BUILD)/libradiopanel.so
 CORE := $(PANEL_DIR)/driver/s1d13700_core.c
 SIM  := $(PANEL_DIR)/sim/s1d13700_sim.c
 
-export PANEL_DIR
+export PANEL_DIR KEYBOARD_DIR
 
 .PHONY: all lib test pytest panel-test module clean
 all: lib

+ 12 - 21
README.md

@@ -9,7 +9,8 @@ PC with a USB I²C bridge or a simulated panel in a window.
 
 The panel core (C), its simulator and the DRM driver are a separate
 repository, [s1d13700-tca](../s1d13700-tca), included here as the git
-submodule `panel/`.
+submodule `panel/`. The keys' wiring and device tree are in
+[radio-keyboard-tca](../radio-keyboard-tca), the submodule `keyboard/`.
 
 | Path | What |
 |---|---|
@@ -18,6 +19,7 @@ submodule `panel/`.
 | `radio-ui` | Starts the application |
 | `tests/` | Application tests, a fake MPD server and `hw_test.sh` |
 | `panel/` | Submodule: s1d13700-tca (panel core, simulator, DRM driver, device tree overlay) |
+| `keyboard/` | Submodule: radio-keyboard-tca (key expander wiring, device tree overlay) |
 | `docs/REPORT.md` | The port from the LPC1114 firmware: decisions, verification, history |
 
 ## Building
@@ -33,7 +35,8 @@ submodule `panel/`.
 `PANEL_DIR=/path/to/s1d13700-tca` uses another checkout of the panel
 repository instead of the submodule (`make`, `tests/hw_test.sh` and the tests
 all read it). The key tests check `radio/keypad.py` and `radio/platform.py`
-against its `dts/radio-panel.dts`.
+against `dts/radio-keys.dts` in radio-keyboard-tca; `KEYBOARD_DIR` points
+them at another checkout of it.
 
 The application runs on Python 3.7.3 (Debian buster) to 3.14 and needs
 PyGObject with GLib, Pango and PangoCairo, pycairo and its PyGObject bridge;
@@ -116,7 +119,8 @@ U2 on the bus the DRM panel is on; `--keys-bus N` names another bus and
 autorepeat like gpio-keys (250 ms, then every 33 ms; the app's 300 ms lockout
 applies). Keys held at start are ignored until released, and a reading with
 more than 3 keys down is taken as a bus fault, so a fault cannot send player
-commands. Do not load the overlay's U2 node while doing this.
+commands. Do not load the U2 node (`keyboard/dts/radio-keys.dts`) while doing
+this.
 
 ### Test mode: real panel, PC keyboard
 
@@ -180,24 +184,11 @@ whatever `--input` names. On the PC without the U2 keypad:
 | P1.5 | CS# (held low after reset; was hardwired low on the old board) | CS0 |
 | P1.6-7 | spare | |
 
-**U2, TCA9539 at 0x76** (A1=H, A0=L): polled by `radio-ui i2c`, or stock
-`gpio-pca953x` with the device tree (`panel/dts/`)
-
-Keys are active high: each pin has a pull-down (the TCA9539 has no internal
-ones) and its key connects it to the supply. `INT` is not connected on the USB
+**U2, TCA9539 at 0x76** (A1=H, A0=L), the keys: polled by `radio-ui i2c`, or
+stock `gpio-pca953x` and `gpio-keys` with the device tree. Pin map, key codes
+and overlay are in `keyboard/README.md`. `INT` is not connected on the USB
 test board, so the keys are polled there; on the Orange Pi Zero it is on PA6.
 
-| Pin | Key | Pin | Key |
-|---|---|---|---|
-| P0.0-2 | unused (pull-down) | P1.0 | Esc |
-| P0.3 | Next | P1.1 | OK |
-| P0.4 | Left | P1.2 | Menu |
-| P0.5 | Down | P1.3 | List |
-| P0.6 | Up | P1.4 | Stop |
-| P0.7 | Right | P1.5 | Pause |
-| | | P1.6 | Play |
-| | | P1.7 | Prev |
-
 ## On the Orange Pi Zero
 
 The radio's kernel, U-Boot and board device tree are built by the OPi0
@@ -205,8 +196,8 @@ project (`build-kernel.sh`), which copies the driver from the s1d13700-tca
 repository and builds it in, together with `gpio-pca953x` and `gpio-keys`
 for U2. There `radio-ui drm` finds the panel and the `radio-keys` input
 device by itself. The backlight and input device permissions (udev rule,
-`video` and `input` groups) are described in `panel/README.md` and the OPi0
-README.
+`video` and `input` groups) are described in `panel/README.md`,
+`keyboard/README.md` and the OPi0 README.
 
 On a kernel without the driver (Armbian 4.19), use `radio-ui i2c --bus 1`;
 set the bus to 400 kHz (`clock-frequency` on i2c1), the mv64xxx default of

+ 4 - 2
docs/REPORT.md

@@ -192,10 +192,12 @@ Offers XRGB8888 and fbdev emulation, with counters in debugfs, and a
 `radio-backlight` backlight device for P1.0. Size, depth and
 TC/R are module parameters.
 
-### Device tree (`s1d13700-tca/dts/radio-panel.dts`)
+### Device tree (`s1d13700-tca/dts/radio-panel.dts`, `radio-keyboard-tca/dts/radio-keys.dts`)
 
 Binds U1 to the driver, U2 (0x76) to `gpio-pca953x`, and defines
-`radio-keys`; the backlight comes from the driver. Numeric constants are used so it works with
+`radio-keys`; the backlight comes from the driver. The U2 and `radio-keys`
+part was later moved from the panel overlay into its own repository,
+radio-keyboard-tca. Numeric constants are used so it works with
 `armbian-add-overlay`. Wiring tables are in `README.md`.
 
 ## 5. Bus cost

+ 1 - 0
keyboard

@@ -0,0 +1 @@
+Subproject commit 3047f8ab073678cb6587b6d9e8dd8fc46c20128a

+ 1 - 1
panel

@@ -1 +1 @@
-Subproject commit b3e7f6625a10d88b3217d580d25036a127e869a4
+Subproject commit ca5e029a61abb5fa78607a0778c848ce669db09c

+ 3 - 3
tests/test_ui.py

@@ -14,9 +14,9 @@ from unittest import mock
 
 HERE = os.path.dirname(os.path.abspath(__file__))
 sys.path.insert(0, os.path.join(HERE, ".."))
-# the overlay in the s1d13700-tca repository: the submodule or PANEL_DIR
-PANEL_DIR = os.environ.get("PANEL_DIR", os.path.join(HERE, "..", "panel"))
-OVERLAY = os.path.join(PANEL_DIR, "dts", "radio-panel.dts")
+# the key overlay in the radio-keyboard-tca repository: the submodule or KEYBOARD_DIR
+KEYBOARD_DIR = os.environ.get("KEYBOARD_DIR", os.path.join(HERE, "..", "keyboard"))
+OVERLAY = os.path.join(KEYBOARD_DIR, "dts", "radio-keys.dts")
 
 from gi.repository import GLib  # noqa: E402