Skip to content

delay for CS? #1

@RudolphRrr

Description

@RudolphRrr

I was just looking over the code out of curiosity and found this in EVE_MCU.cpp:

// --------------------- Chip Select line low ----------------------------------
void MCU_CSlow(void) {
  digitalWrite(PIN_CHIPSELECT, LOW);  // disable CS#
  delayMicroseconds(10);
}

// --------------------- Chip Select line high ---------------------------------
void MCU_CShigh(void) {
  digitalWrite(PIN_CHIPSELECT, HIGH);  // disable CS#
  delayMicroseconds(10);
}

First of all, why is there a 10 microsecond delay after setting CS to low? That is extremely long.
And as long as everything takes when using the Arduino API, a delay should not be required at all.

Second, if for some reason a delay would be required in MCU_CShigh, and I doubt that it is, I would put the delay before setting CS back to high.
But, digitalWrite() takes around 30 to 50 clock-cycles, depending on the Arduino target.

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