fix(examples/pico-doom): wire ILI9341 power + MISO

The Pico Doom example loaded with the ILI9341 dangling on three
critical pins:

  - VCC  — unconnected (no 3V3 from the Pico)
  - GND  — unconnected (no return path)
  - MISO — unconnected

On real hardware the TFT wouldn't power on at all without VCC/GND.
Inside the velxio simulator the missing power isn't strictly fatal
(the simulator drives pixels off the SPI bus, not the rail), but it
makes the schematic incorrect and misleading for users who copy it
to a breadboard. MISO is electrically idle for write-only drivers,
but Adafruit_ILI9341 with the 3-arg constructor binds to hardware
SPI0, so MISO physically maps to GP16 — leaving it floating leaves
the SPI bus topology incomplete.

Wires added:

  Pico 3V3   → tft1.VCC   (red)
  Pico GND.5 → tft1.GND   (black) — closest GND pad to GP17/18/19
  Pico GP16  → tft1.MISO  (amber) — hardware SPI0 MISO

Updated the data-integrity test (examples-pico-doom.test.ts) to
include the three new pairs in the SPI/control/power expectation
map. 10/10 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Montero Crespo 2026-05-14 23:22:31 -03:00
parent 6edc715e8d
commit 844083657c
2 changed files with 26 additions and 11 deletions

View File

@ -71,18 +71,25 @@ describe('pico-doom-raycaster example', () => {
expect(offenders).toEqual([]);
});
it('SPI wires connect the Pico GP18/GP19/GP17/GP20/GP21/GP22 to the ILI9341 pins the sketch expects', () => {
it('SPI + control + power wires connect Pico → ILI9341 with the pinout the sketch + hardware expect', () => {
const e = findExample()!;
// (pico-pin, ili9341-pin) pairs the sketch hard-codes. If any of these
// get re-routed in the example, the sketch's #define block has to
// match — fail loud here so the mismatch can't slip into prod.
// (pico-pin, ili9341-pin) pairs. Everything except GP16↔MISO comes
// from the sketch's #define block. GP16↔MISO is hardware SPI0's
// MISO line — the 3-arg Adafruit_ILI9341(CS, DC, RST) constructor
// selects hardware SPI0, so this pin is fixed even though the
// driver never reads back. If any pair gets re-routed in the
// example, the sketch + this list have to move together — fail
// loud here so the mismatch can't slip into prod.
const expected: Array<[string, string]> = [
['GP18', 'SCK'],
['GP19', 'MOSI'],
['GP17', 'CS'],
['GP20', 'D/C'],
['GP21', 'RST'],
['GP22', 'LED'],
['3V3', 'VCC'],
['GND.5', 'GND'],
['GP18', 'SCK'],
['GP19', 'MOSI'],
['GP16', 'MISO'],
['GP17', 'CS'],
['GP20', 'D/C'],
['GP21', 'RST'],
['GP22', 'LED'],
];
for (const [picoPin, tftPin] of expected) {
const match = e.wires.find(

View File

@ -956,9 +956,17 @@ void loop() {
{ type: 'wokwi-pushbutton', id: 'btn-right', x: 310, y: 470, properties: { color: 'green', label: 'RIGHT' } },
],
wires: [
// SPI bus + control lines to the ILI9341
// Power
{ id: 'w-tft-vcc', start: { componentId: 'raspberry-pi-pico', pinName: '3V3' }, end: { componentId: 'tft1', pinName: 'VCC' }, color: '#ff0000' },
{ id: 'w-tft-gnd', start: { componentId: 'raspberry-pi-pico', pinName: 'GND.5' }, end: { componentId: 'tft1', pinName: 'GND' }, color: '#000000' },
// SPI bus + control lines to the ILI9341. MISO is GP16 — the
// sketch's 3-arg Adafruit_ILI9341(CS, DC, RST) constructor uses
// hardware SPI0, whose MISO pin is GP16. The driver writes only
// (no register reads), so MISO is electrically idle, but the
// wire is included so the circuit is didactically complete.
{ id: 'w-tft-sck', start: { componentId: 'raspberry-pi-pico', pinName: 'GP18' }, end: { componentId: 'tft1', pinName: 'SCK' }, color: '#ff8800' },
{ id: 'w-tft-mosi', start: { componentId: 'raspberry-pi-pico', pinName: 'GP19' }, end: { componentId: 'tft1', pinName: 'MOSI' }, color: '#ff8800' },
{ id: 'w-tft-miso', start: { componentId: 'raspberry-pi-pico', pinName: 'GP16' }, end: { componentId: 'tft1', pinName: 'MISO' }, color: '#ffaa44' },
{ id: 'w-tft-cs', start: { componentId: 'raspberry-pi-pico', pinName: 'GP17' }, end: { componentId: 'tft1', pinName: 'CS' }, color: '#00aaff' },
{ id: 'w-tft-dc', start: { componentId: 'raspberry-pi-pico', pinName: 'GP20' }, end: { componentId: 'tft1', pinName: 'D/C' }, color: '#00cc00' },
{ id: 'w-tft-rst', start: { componentId: 'raspberry-pi-pico', pinName: 'GP21' }, end: { componentId: 'tft1', pinName: 'RST' }, color: '#cc0000' },