diff options
| author | liYangYang <[email protected]> | 2023-01-19 11:03:48 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-01-18 22:03:48 -0500 |
| commit | 63294afc9da6dfe8fd9ce5d28ae883a2d51c744f (patch) | |
| tree | 805e99e1c06cb28690947470e698864924f05884 /components | |
| parent | 7ff64c1cfd2c3392f388ed91cd4955a064265c7f (diff) | |
[stm32][softspi]soft spi attach函数问题解决方案 (#6868)
* [softspi]soft spi attach函数问题解决方案
* 更改函数名
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/spi/spi-bit-ops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/drivers/spi/spi-bit-ops.c b/components/drivers/spi/spi-bit-ops.c index 253c471849..eb6df1590a 100644 --- a/components/drivers/spi/spi-bit-ops.c +++ b/components/drivers/spi/spi-bit-ops.c @@ -417,7 +417,7 @@ rt_uint32_t spi_bit_xfer(struct rt_spi_device *device, struct rt_spi_message *me struct rt_spi_bit_obj *obj = rt_container_of(device->bus, struct rt_spi_bit_obj, bus); struct rt_spi_bit_ops *ops = obj->ops; struct rt_spi_configuration *config = &obj->config; - rt_base_t cs_pin = (rt_base_t)device->parent.user_data; + rt_base_t cs_pin = device->cs_pin; RT_ASSERT(device != NULL); RT_ASSERT(message != NULL); @@ -438,7 +438,7 @@ rt_uint32_t spi_bit_xfer(struct rt_spi_device *device, struct rt_spi_message *me #endif /* take CS */ - if (message->cs_take) + if (message->cs_take && (cs_pin != PIN_NONE)) { LOG_I("spi take cs\n"); rt_pin_write(cs_pin, PIN_LOW); @@ -492,7 +492,7 @@ rt_uint32_t spi_bit_xfer(struct rt_spi_device *device, struct rt_spi_message *me } /* release CS */ - if (message->cs_release) + if (message->cs_release && (cs_pin != PIN_NONE)) { spi_delay(ops); rt_pin_write(cs_pin, PIN_HIGH); |
