|
|
@@ -1,28 +1,39 @@
|
|
|
-# Linux port
|
|
|
+# radio-ui: MPD front panel on an S1D13700 LCD
|
|
|
|
|
|
-Replaces the LPC1114 firmware: the panel and keys hang off I²C expanders on the
|
|
|
-Linux board. The panel runs on real hardware through `radio-ui i2c` and
|
|
|
-`radio-ui drm`. All 13 keys read correctly through the key expander on the test
|
|
|
-rig. The overlay has not run.
|
|
|
+The front panel of an internet radio: an MPD client that shows the current
|
|
|
+song, time, volume and playlist on a 240×160 S1D13700 graphic LCD and takes 13
|
|
|
+keys. The LCD and the keys hang off two TCA9539 I²C expanders on the Linux
|
|
|
+board (an Orange Pi Zero); this replaces an earlier LPC1114 microcontroller
|
|
|
+firmware. It runs on the radio, through the DRM driver or i2c-dev, and on a
|
|
|
+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/`.
|
|
|
|
|
|
| Path | What |
|
|
|
|---|---|
|
|
|
-| `driver/s1d13700_core.*` | Panel core, used by everything: init, 2 bpp conversion, write planner, TCA9539 stream |
|
|
|
-| `driver/s1d13700_drm.c` | DRM driver (6.x kernels) |
|
|
|
-| `sim/` | Model of the TCA9539 and S1D13700: decodes the I²C bytes and flags bus faults |
|
|
|
| `radio/` | The application, in Python: UI, MPD client, I²C key polling and the `sim`, `i2c`, `drm` and `keytest` frontends |
|
|
|
| `radio/libpanel.c` | The panel core and simulator as a library for the application |
|
|
|
| `radio-ui` | Starts the application |
|
|
|
-| `dts/radio-panel.dts` | Overlay for the keys, backlight and panel |
|
|
|
-| `tests/` | Panel core tests, application tests, a fake MPD server and `hw_test.sh` |
|
|
|
+| `tests/` | Application tests, a fake MPD server and `hw_test.sh` |
|
|
|
+| `panel/` | Submodule: s1d13700-tca (panel core, simulator, DRM driver, device tree overlay) |
|
|
|
+| `docs/REPORT.md` | The port from the LPC1114 firmware: decisions, verification, history |
|
|
|
|
|
|
## Building
|
|
|
|
|
|
- make test # panel core tests, no hardware or libraries
|
|
|
+ git clone --recurse-submodules <url>/radio-ui.git
|
|
|
+ # or, in an existing clone: git submodule update --init
|
|
|
+
|
|
|
make lib # build/libradiopanel.so, needed by the application
|
|
|
- make pytest # application tests, no hardware or display
|
|
|
- make dtbo
|
|
|
- make module KDIR=/path/to/kernel
|
|
|
+ make test # application tests, no hardware or display
|
|
|
+ make panel-test # the panel core's tests (in panel/)
|
|
|
+ make module KDIR=/path/to/kernel # the DRM driver, in panel/driver/
|
|
|
+
|
|
|
+`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`.
|
|
|
|
|
|
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;
|
|
|
@@ -156,12 +167,12 @@ whatever `--input` names. On the PC without the U2 keypad:
|
|
|
|
|
|
## Wiring
|
|
|
|
|
|
-**U1, TCA9539 at 0x74** (A1=L, A0=L), raw I²C client of the panel code
|
|
|
+**U1, TCA9539 at 0x74** (A1=L, A0=L), driven by the panel core (`panel/README.md`)
|
|
|
|
|
|
| Pin | Signal | Module pin |
|
|
|
|---|---|---|
|
|
|
| P0.0-7 | D0-D7 | D0-D7 |
|
|
|
-| P1.0 | Backlight enable (active high, assumed) | |
|
|
|
+| P1.0 | Backlight enable (active high) | |
|
|
|
| P1.1 | RES# | RST |
|
|
|
| P1.2 | A0 | A15 |
|
|
|
| P1.3 | WR# | WE |
|
|
|
@@ -170,11 +181,11 @@ whatever `--input` names. On the PC without the U2 keypad:
|
|
|
| P1.6-7 | spare | |
|
|
|
|
|
|
**U2, TCA9539 at 0x76** (A1=H, A0=L): polled by `radio-ui i2c`, or stock
|
|
|
-`gpio-pca953x` with the overlay
|
|
|
+`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
|
|
|
-test board, so the keys are polled; the final board wires it to a host GPIO.
|
|
|
+test board, so the keys are polled there; on the Orange Pi Zero it is on PA6.
|
|
|
|
|
|
| Pin | Key | Pin | Key |
|
|
|
|---|---|---|---|
|
|
|
@@ -187,8 +198,21 @@ test board, so the keys are polled; the final board wires it to a host GPIO.
|
|
|
| | | P1.6 | Play |
|
|
|
| | | P1.7 | Prev |
|
|
|
|
|
|
-## To confirm on hardware
|
|
|
+## On the Orange Pi Zero
|
|
|
+
|
|
|
+The radio's kernel, U-Boot and board device tree are built by the OPi0
|
|
|
+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.
|
|
|
+
|
|
|
+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
|
|
|
+100 kHz makes a playlist redraw take about half a second.
|
|
|
+
|
|
|
+## Not settled
|
|
|
|
|
|
-- TC/R (`--tcr`) for frame rate; 162 comes from the AVR project's 2 bpp setup
|
|
|
-- Key autorepeat on Up/Down; then the overlay (`evtest`)
|
|
|
-- The application on the target's Python 3.7.3
|
|
|
+- TC/R (`--tcr`) for the frame rate; 162 comes from the AVR project's 2 bpp setup
|
|
|
+- Key autorepeat timing on held keys
|