New SPI invert hardware SS function in hall-spi and SPI library #11297
+20
−2
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.
This PR adds the ability to invert the logic level of the Hardware Slave Select (SS) pin for ESP32 SPI buses (HSPI/VSPI). This is critical for compatibility with hardware that expects active-high SS signals.
Backward Compatibility:
No breaking changes: Existing code using setHwCs() will default to invert_out=false (original behavior)
No Software SS Impact: Only affects hardware-controlled SS pins.
Isolation: Changes to one SPI bus (e.g., HSPI) do not affect others (e.g., VSPI).
Usage Example:
SPIClass *hspi = NULL;
setup(){
hspi = new SPIClass(HSPI);
hspi->begin();
hspi->setSSInvert(true); // Set before setHwCs();
hspi->setHwCs(true);
hspi->beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE2));
}
I have tested my Pull Request on Arduino-esp32 core v3.1.3 with ESP32-S3 Board.
Related links
Some people have the same issue but with espidf. I use arduino ide so I fixed it for myself.
https://esp32.com/viewtopic.php?t=16057
https://esp32.com/viewtopic.php?t=16057