ESPSomfy-RTS/test/stubs/SPI.h
R. Sid Shaytay 28af01195a
Move the board profile tests into the native Unity suite
The board tests ran through tools/test-board-profile.sh with their own stubs, assert() and a script that copied nine method bodies out of Transceiver.cpp, so they were outside pio test -e native and the coverage report.

Pure decisions now live in units the native env builds: BoardProfile::usesPin is constexpr, RadioReadiness decides register validity, the receive-state outcome (ready, retry or unavailable, with one try today) and whether a queued job may transmit, and ShadeGpioGuard decides whether a shade's outputs touch a board pad. Transceiver and ShadeGpio call them with identical behaviour. New Unity suites cover the generic and LILYGO profiles (reserved pads, startup order, radio bring-up) and the readiness unit; the old harness, its script, CI step and stubs are deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 18:47:04 -08:00

19 lines
641 B
C

// Arduino SPI stand-in for the native test env: remembers whether the bus is
// up and logs begin/end in order with the pin calls (see Arduino.h).
#pragma once
#include <Arduino.h>
struct StubSPI {
bool active = false;
unsigned int begins = 0;
unsigned int ends = 0;
int8_t sck = -1, miso = -1, mosi = -1, cs = -1;
void begin(int8_t s, int8_t mi, int8_t mo, int8_t c) {
active = true; begins++; sck = s; miso = mi; mosi = mo; cs = c;
stubGpioLog.push_back({StubGpioEvent::SpiBegin, 0, 0});
}
void end() {
active = false; ends++;
stubGpioLog.push_back({StubGpioEvent::SpiEnd, 0, 0});
}
};
inline StubSPI SPI;