Repository navigation
Store sensor pins per device and accept pin commands from the host - #7
Open
ShivtejG236 wants to merge 1 commit into
Open
ShivtejG236 wants to merge 1 commit into
ShivtejG236 wants to merge 1 commit into
Conversation
Each physical board can now keep its own pin assignment in non-volatile storage. The host sends SET_PINS or RESET_PINS using the existing framing; the firmware checks the request against allowed-pin masks generated from the pin rules, stores it, answers with an ACK frame and restarts to apply it. An assignment that fails the check is never stored, and the UART0 pins are always blocked, so the host link cannot be cut. HELLO gains id (the chip's factory MAC), pins and pin_src. These are new keys and new frame types, so the protocol version stays 1. The release manifest now carries each board's default pins and pin rules for host tools.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #6; retarget to
mainafter it merges.What
HELLOnow carriesid(the chip's factory MAC address),pins(the GPIOs in use) andpin_src(defaultorstored).SET_PINS(0x10) andRESET_PINS(0x11) with the existing framing. The firmware answers each with anACK(0x05) and, on success, restarts to apply the change.scripts/boards.pyturns the pin rules into two allowed-pin masks that are compiled in.pincfg_check()(include/pin_config.h) rejects a GPIO that does not exist, is blocked or reserved, is input-only for a driven signal, or is used twice. A rejected assignment is never stored.src/device_config.cpp). Stored pins are checked again at boot, so a build with stricter rules falls back to the board defaults.pinsandpin_rulesfor host tools.Protocol version
Unchanged (1). The spec already says new frame types and new
HELLOkeys do not change it; existing hosts ignore both.Tests
tools/host/test_pins.cpp: command receiving (round trip, every single-byte corruption, oversized frames, noise) and the pin check. Added to CI.tools/test_pin_rules.py: the compiled masks allow exactly whatpin_errors()allows, for every GPIO on every board.Not verified
Nothing here has run on a board. The firmware is compiled only by CI. NVS storage, the restart after an accepted command and the MAC byte order need a hardware check.