{
digitalWrite(pin_cs, LOW);
digitalWrite(pin_sck, LOW); << not needed - is controlled by SPI mode
digitalWrite(pin_sdi, LOW); << not needed - pin is ignore when CS is High
digitalWrite(pin_sck, HIGH); << not needed
SPI.transfer(cmd); << SCK & SDI are toggled here
digitalWrite(pin_cs, HIGH);
}
Why do you think the extra control changes are needed?