Add shutdown sense reading and fault control via GPIO #39
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.
Changes
Added read_shutdown() to allow querying of the shutdown-sense GPIO (TS_MINUS_SENSE).
Returns true when the shutdown circuit is open (pin low) and false when it is closed (pin high).
Implemented compute_set_fault() using explicit GPIO writes (GPIO_PIN_SET / GPIO_PIN_RESET).
Test Cases
Case A – Shutdown circuit closed (normal): mock HAL_GPIO_ReadPin to return GPIO_PIN_SET. read_shutdown() returns false.
Case B – Shutdown circuit open: mock HAL_GPIO_ReadPin to return GPIO_PIN_RESET. read_shutdown() returns true.
Case C – Fault output set: compute_set_fault(true) drives GPIO_PIN_SET, compute_set_fault(false) drives GPIO_PIN_RESET.
Edge Case – Unexpected pin state: equality check still resolves correctly.
To Do
Nothing
Closes #24