fix mode 3
This commit is contained in:
parent
aa29b351d1
commit
fb90221892
|
|
@ -213,11 +213,34 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
|
||||||
if (BUSIO_READ_MISO())
|
if (BUSIO_READ_MISO())
|
||||||
reply |= b;
|
reply |= b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BUSIO_SET_CLOCK_LOW();
|
||||||
|
|
||||||
|
} else if (_dataMode == SPI_MODE3) {
|
||||||
|
|
||||||
|
if (_mosi != -1) { // transmit on falling edge
|
||||||
|
BUSIO_WRITE_MOSI(send & b);
|
||||||
}
|
}
|
||||||
|
|
||||||
BUSIO_SET_CLOCK_LOW();
|
BUSIO_SET_CLOCK_LOW();
|
||||||
|
|
||||||
} else { // if (_dataMode == SPI_MODE1 || _dataMode == SPI_MODE3)
|
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();
|
BUSIO_SET_CLOCK_HIGH();
|
||||||
|
|
||||||
|
|
@ -237,11 +260,11 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (_miso != -1) {
|
if (_miso != -1) {
|
||||||
buffer[i] = reply;
|
buffer[i] = reply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue