Add Zephyr RTOS port of OpenLaserTag remote control #1

Open
njord wants to merge 4 commits from port-zephyr into master

4 Commits

Author SHA1 Message Date
b7b6475ee9 docs: confirm Pico W BLE unsupported in Zephyr mainline too
Checked Zephyr main: dts/bindings/bluetooth has only UART-based Infineon BT-HCI
bindings (infineon,bt-hci-uart / cyw208xx-hci / bless-hci) and no
CYW43-BT-over-gSPI HCI driver; rpi_pico_rp2040_w.dts only adds
infineon,cyw43-gpio. So Pico W BLE needs a custom out-of-tree HCI driver.
Working BLE remains available on a controller board (e.g. ESP32 hci_esp32).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:10:27 +02:00
8cb641da5a Build with Zephyr v3.7.0/SDK 0.16.8; fix devicetree, verify targets
Set up a local Zephyr toolchain and actually built the firmware, fixing the
issues that surfaced and recording real results.

Devicetree fixes (compile errors / silent no-ops):
- Wrap bare gpios-only nodes (heartbeat, piezo, IR RX, and the GPIO IR TX on
  the stub boards) in gpio-leds / gpio-keys so DT emits the GPIO cell macros.
- Rename the battery ADC node to "zephyr,user" so its io-channels is exposed.

Verified building (Zephyr v3.7.0, SDK 0.16.8, ARM toolchain):
- rpi_pico (39.9K/14.0K), rpi_pico/rp2040/w (68.1K/20.2K),
  nucleo_f401re (37.4K/15.1K), nrf52840dk BLE (137.7K/28.3K). All clean.

Pico W BLE finding: the image links with the BLE stack, but Zephyr v3.7 has no
HCI transport for the Pico W (CYW43 BT shares the Wi-Fi gSPI bus; the in-tree
AIROC driver is UART-only), so bt_enable() returns -ENODEV at runtime and BLE
stays inactive while the rest of the firmware runs. The same ble_nus.c is
verified linking against a real controller on nrf52840dk. Clarified the runtime
log, the W board conf, README and migration-notes accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 11:47:58 +02:00
f2de891ea3 Make IR real-time/non-blocking, harden for Pico W, optimize
Primary target is now the Pico W; functionality preserved on other boards.

IR TX (RP2040/PWM): rewritten to a non-blocking, real-time symbol state
machine. A hardware-PWM 56 kHz/40% carrier is gated by a one-shot k_timer
(mark/space flips in the timer ISR), so TX never busy-waits and runs
concurrently with IR RX, BLE and everything else. Queued frames (BLE "bomb")
are sent back-to-back with a 50 ms inter-frame gap. Boards whose ir-tx is a
plain GPIO keep the (blocking) software bit-bang carrier as a fallback.

IR RX: cycle timestamps captured in the ISR, converted to us off the
interrupt path in the decode work item (lower ISR jitter).

Fixes:
- Heartbeat moved off GPIO25 (CYW43 WL_CS on Pico W) to GPIO14 to avoid
  corrupting WiFi/BLE.
- APP_BLE now selects BT_DEVICE_NAME_DYNAMIC (bt_set_name needs it).

Optimizations:
- RGB rewritten with integer math (no soft-float on the FPU-less M0+).
- CONFIG_SIZE_OPTIMIZATIONS; 100 us tick so OLT symbol durations schedule
  exactly.

Pico W: boards/rpi_pico_rp2040_w.conf enables BLE out of the box.

Docs: resolved hardware TODOs (battery cell-count divider, PWM channel math,
heartbeat, carrier), README primary target = Pico W, inline comments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 16:44:39 +02:00
9149761c82 Add Zephyr RTOS port of OpenLaserTag remote control
Port the MicroPython firmware to a maintainable Zephyr C application under
zephyr_app/, alongside the untouched original reference implementation.

- OLT IR protocol in pure C (olt_proto) with a host unit test
- buttons, piezo, RGB PWM, battery ADC, IR TX (software 56 kHz carrier),
  IR RX (edge-capture + timeout decode), and gated BLE Nordic UART service
- uasyncio tasks mapped to Zephyr threads / workqueues / k_timer
- rpi_pico overlay (full) plus esp32 and nucleo_f401re stubs
- prj.conf / Kconfig / overlay-ble.conf build configuration
- docs/migration-notes.md: hardware inventory, module/API maps, open questions

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 15:38:26 +02:00