Skip to content

Calling SPI.setHwCs(true) twice disables hardware CS #4558

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

Closed
InvncibiltyCloak opened this issue Nov 22, 2020 · 0 comments · Fixed by #4559
Closed

Calling SPI.setHwCs(true) twice disables hardware CS #4558

InvncibiltyCloak opened this issue Nov 22, 2020 · 0 comments · Fixed by #4559

Comments

@InvncibiltyCloak
Copy link
Contributor

Hardware:

Board: ESP32 DevKitv1
Core Installation version: master
IDE name: Platform.io
Computer OS: Ubuntu

Description:

If you call SPI.setHwCs twice it causes hardware CS to be turned off due to a bad check in the else if.

This is easily fixed by changing the else if to be else if (!use && _use_hw_ss).

I found this while browsing master.

Sketch

#include <Arduino.h>

void setup() {
    SPI.begin()
    SPI.setHwCs(true);
    SPI.setHwCs(true);
    // CS pin does not get toggled now
}
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 a pull request may close this issue.

1 participant