Add PM5 CEP transport for Flipper Zero (WITH_CEP)

Wire up the previously-dead Flipper Zero handshake/SPI code from
at32_unit_test.c into a real WITH_CEP platform extra, independent of
BWM (new g_reply_via_cep flag, not reusing BWM's g_reply_via_fpc, so
both transports can run concurrently).

Fixes a real reconnect bug found during hardware bring-up: the
handshake listener was gated on a CC-controller attach edge that
didn't reliably fire on every FAP relaunch, requiring a physical
cable replug to reconnect. Now watches for a fresh incoming byte any
time the link reports attached, with a bounded receive timeout so a
stray byte can never hang the main loop.

RF/FPGA-dependent functionality (hf/lf reads) is out of scope here -
tracked separately. Closes #3667.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Tom HarknessandClaude Sonnet 5 committed 2026-09-26 09:45:51 -04:00
1 parent fc024c8038
commit 2b5e3e51eb
9 files changed
+573 -21

No files matched your search

+5 -1
View File
@@ -287,13 +287,17 @@ typedef struct {
// Appended in version 12.
bool compiled_with_bwm : 1; // PM5 built with PLATFORM_EXTRAS=BWM (battery/wireless module)
// Appended in version 13.
bool compiled_with_cep : 1; // PM5 built with PLATFORM_EXTRAS=CEP (Flipper Zero, Type-C extended port)
} PACKED capabilities_t;
// Bump this whenever a command payload changes shape, so a mismatched client and
// firmware refuse to talk instead of misparsing each other.
// 10: CMD_HF_MIFARE_EML_MEMSET gained a flags byte
// 11: capabilities_t gained em_size / em_allocated
// 12: capabilities_t gained compiled_with_bwm
#define CAPABILITIES_VERSION 12
// 13: capabilities_t gained compiled_with_cep
#define CAPABILITIES_VERSION 13
// what a pre-v9 device would have used, it could not tell us
#define CAPABILITIES_LEGACY_CMD_DATA_SIZE 512
extern capabilities_t g_pm3_capabilities;