fix mode 3
This commit is contained in:
parent
aa29b351d1
commit
fb90221892
|
|
@ -212,12 +212,35 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
|
|||
if (_miso != -1) {
|
||||
if (BUSIO_READ_MISO())
|
||||
reply |= b;
|
||||
}
|
||||
}
|
||||
|
||||
BUSIO_SET_CLOCK_LOW();
|
||||
|
||||
} else { // if (_dataMode == SPI_MODE1 || _dataMode == SPI_MODE3)
|
||||
} else if (_dataMode == SPI_MODE3) {
|
||||
|
||||
if (_mosi != -1) { // transmit on falling edge
|
||||
BUSIO_WRITE_MOSI(send & b);
|
||||
}
|
||||
|
||||
BUSIO_SET_CLOCK_LOW();
|
||||
|
||||
if (bitdelay_us) {
|
||||
delayMicroseconds(bitdelay_us);
|
||||
}
|
||||
|
||||
BUSIO_SET_CLOCK_HIGH();
|
||||
|
||||
if (bitdelay_us) {
|
||||
delayMicroseconds(bitdelay_us);
|
||||
}
|
||||
|
||||
if (_miso != -1) { // read on rising edge
|
||||
if (BUSIO_READ_MISO()) {
|
||||
reply |= b;
|
||||
}
|
||||
}
|
||||
|
||||
} else { // || _dataMode == SPI_MODE1)
|
||||
|
||||
BUSIO_SET_CLOCK_HIGH();
|
||||
|
||||
|
|
@ -237,9 +260,9 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (_miso != -1) {
|
||||
buffer[i] = reply;
|
||||
}
|
||||
}
|
||||
if (_miso != -1) {
|
||||
buffer[i] = reply;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue