drivers: bluetooth: hci: spi: Handle when the buffer is empty
Check if the buffer size is not empty before spi transceive and buffer's data processing. This fixes the need to slow down MCUs to 16MHz when using BlueNRG-MS chips. Tested samples : Beacon, Central, Peripheral Signed-off-by: Yaël Boutreux <yael.boutreux@st.com> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
This commit is contained in:
parent
d44f6317ee
commit
3704e8b8b4
1 changed files with 6 additions and 5 deletions
|
@ -326,9 +326,8 @@ static void bt_spi_rx_thread(void)
|
|||
header_slave[STATUS_HEADER_TOREAD] == 0xFF) &&
|
||||
!ret)) && exit_irq_high_loop());
|
||||
|
||||
if (!ret) {
|
||||
size = header_slave[STATUS_HEADER_TOREAD];
|
||||
|
||||
size = header_slave[STATUS_HEADER_TOREAD];
|
||||
if (!ret || size != 0) {
|
||||
do {
|
||||
ret = bt_spi_transceive(&txmsg, size,
|
||||
&rxmsg, size);
|
||||
|
@ -339,8 +338,10 @@ static void bt_spi_rx_thread(void)
|
|||
gpio_pin_enable_callback(irq_dev, GPIO_IRQ_PIN);
|
||||
k_sem_give(&sem_busy);
|
||||
|
||||
if (ret) {
|
||||
BT_ERR("Error %d", ret);
|
||||
if (ret || size == 0) {
|
||||
if (ret) {
|
||||
BT_ERR("Error %d", ret);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue