Skip to content
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

libraries/SPI/src/SPI.h: SPIClass: add method to get SS pin number #5788

Merged
merged 2 commits into from
Oct 21, 2021
Merged

libraries/SPI/src/SPI.h: SPIClass: add method to get SS pin number #5788

merged 2 commits into from
Oct 21, 2021

Conversation

michlv
Copy link
Contributor

@michlv michlv commented Oct 20, 2021

This change adds new method to SPIClass, so the user can get, which pin is the SS signal. This makes use of the class easier, if one needs to toggle the SS pin. This is demonstrated by simplification of the example, which is using multiple SPI buses and had to have the SS pin numbers hardcoded, outside of the logic of the SPI class and also there was some code duplication, which is now removed, due to this new function.

Since this PR extends the interface, the change is backwards compatible, but will benefit any future users.

As code example states, the SS pin needs to be explicitly set for output for SPI to work, but the pin number have to be coded in addition to the SPI logic in the library, which means this duplicates code. It is much better to just be able to get the pin number from library itself.
Simplify the example case, to show usage of pinSS method. This also simplifies the example, removing duplicated code.
@CLAassistant
Copy link

CLAassistant commented Oct 20, 2021

CLA assistant check
All committers have signed the CLA.

@me-no-dev me-no-dev merged commit 951c8be into espressif:master Oct 21, 2021
@michlv michlv deleted the michlv-spi-pinss branch October 21, 2021 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants