-
Notifications
You must be signed in to change notification settings - Fork 7.6k
feat(spi): Add return values to SPI begin + comments on SPI buses #11477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Hello P-R-O-C-H-Y, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 12m 42s ⏱️ Results for commit ab93cbd. ♻️ This comment has been updated with latest results. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the SPI initialization API by changing SPIClass::begin to return a bool value instead of void, improving error handling and compatibility with newer ESP32 variants.
- Changes the SPI.begin method signature in SPI.h and its implementation in SPI.cpp to return a bool.
- Updates error-handling returns in SPI.cpp to reflect initialization success or failure.
- Adjusts SPI bus macro definitions in esp32-hal-spi.h to accommodate board-specific mappings.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
libraries/SPI/src/SPI.h | Updated the begin method signature to return a bool. |
libraries/SPI/src/SPI.cpp | Modified begin implementation to return true/false based on initialization. |
cores/esp32/esp32-hal-spi.h | Adjusted macro definitions for FSPI and HSPI to match new board mappings. |
Comments suppressed due to low confidence (2)
libraries/SPI/src/SPI.h:64
- Consider updating the documentation for the begin() method to clearly state what the bool return value indicates (e.g., success if already initialized or newly initialized, and failure on errors).
bool begin(int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1, int8_t ss = -1);
libraries/SPI/src/SPI.cpp:69
- A comment here explaining that returning true when _spi is already initialized is intended behavior could help clarify the API's design and usage.
}
Description of Change
This pull request is modifying the
SPIClass::begin
method to return abool
for better error handling. These updates enhance compatibility with newer ESP32 variants and provide clearer feedback on initialization success.Tests scenarios
Related links
Closes #8192