mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
HAL_ChibiOS: use spiSend/spiReceive
this fixes an issue with microSD on F405.
This commit is contained in:
parent
d47663c0ba
commit
1414988870
@ -163,10 +163,10 @@ bool DeviceBus::adjust_timer(AP_HAL::Device::PeriodicHandle h, uint32_t period_u
|
||||
void DeviceBus::bouncebuffer_setup(const uint8_t *&buf_tx, uint16_t tx_len,
|
||||
uint8_t *&buf_rx, uint16_t rx_len)
|
||||
{
|
||||
if (rx_len != 0) {
|
||||
if (buf_rx) {
|
||||
bouncebuffer_setup_read(bounce_buffer_rx, &buf_rx, rx_len);
|
||||
}
|
||||
if (tx_len != 0) {
|
||||
if (buf_tx) {
|
||||
bouncebuffer_setup_write(bounce_buffer_tx, &buf_tx, tx_len);
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,13 @@ void SPIDevice::do_transfer(const uint8_t *send, uint8_t *recv, uint32_t len)
|
||||
}
|
||||
#else
|
||||
bus.bouncebuffer_setup(send, len, recv, len);
|
||||
spiExchange(spi_devices[device_desc.bus].driver, len, send, recv);
|
||||
if (send == nullptr) {
|
||||
spiReceive(spi_devices[device_desc.bus].driver, len, recv);
|
||||
} else if (recv == nullptr) {
|
||||
spiSend(spi_devices[device_desc.bus].driver, len, send);
|
||||
} else {
|
||||
spiExchange(spi_devices[device_desc.bus].driver, len, send, recv);
|
||||
}
|
||||
bus.bouncebuffer_finish(send, recv, len);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user