Skip to content

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

Closed
@InvncibiltyCloak

Description

@InvncibiltyCloak

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions