You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2021/07/13 20:19:27 UTC

[mynewt-core] branch master updated: spi_hal: Pull CS line back up if write / read_write operations fail

This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new be3ce6f  spi_hal: Pull CS line back up if write / read_write operations fail
     new 22aa08e  Merge pull request #2641 from vikrant-proxy/spi-hal-rc
be3ce6f is described below

commit be3ce6f0e7220fbd2223246820504d0f1ab7a18f
Author: Vikrant More <vi...@proxy.com>
AuthorDate: Tue Jul 13 12:34:41 2021 -0700

    spi_hal: Pull CS line back up if write / read_write operations fail
---
 hw/bus/drivers/spi_hal/src/spi_hal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/bus/drivers/spi_hal/src/spi_hal.c b/hw/bus/drivers/spi_hal/src/spi_hal.c
index 26e30a2..1404456 100644
--- a/hw/bus/drivers/spi_hal/src/spi_hal.c
+++ b/hw/bus/drivers/spi_hal/src/spi_hal.c
@@ -184,7 +184,7 @@ bus_spi_write(struct bus_dev *bdev, struct bus_node *bnode, const uint8_t *buf,
     rc = hal_spi_txrx(dev->spi_dev.cfg.spi_num, (uint8_t *)buf, NULL, length);
 #endif
 
-    if (!(flags & BUS_F_NOSTOP)) {
+    if (rc || !(flags & BUS_F_NOSTOP)) {
         hal_gpio_write(node->pin_cs, 1);
     }
 
@@ -244,7 +244,7 @@ bus_spi_write_read(struct bus_dev *bdev, struct bus_node *bnode,
     }
 #endif
 
-    if (!(flags & BUS_F_NOSTOP)) {
+    if (rc || !(flags & BUS_F_NOSTOP)) {
         hal_gpio_write(node->pin_cs, 1);
     }