summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorliYangYang <[email protected]>2022-09-01 12:36:45 +0800
committerGitHub <[email protected]>2022-09-01 00:36:45 -0400
commit6ac09a6db02e9772886d5f76163f534f959934cf (patch)
tree63ff1deec4c8889f973108c6b1bc91cf3d02331b /components/drivers/include
parent9bbe2097db4f201e5dc49e9a84ddd3c012d92f78 (diff)
[spi]fix some bug for rt_spi_sendrecv16 (#6360)
修复 rt_spi_sendrecv16 api 对最高有效位(MSB or LSB)的处理不当造成的一些问题。 https://github.com/stm32duino/Arduino_Core_STM32/blob/main/libraries/SPI/src/SPI.cpp#L273
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/spi.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/components/drivers/include/drivers/spi.h b/components/drivers/include/drivers/spi.h
index 5bc46b3c1b..0bcac3aac0 100644
--- a/components/drivers/include/drivers/spi.h
+++ b/components/drivers/include/drivers/spi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2021, RT-Thread Development Team
+ * Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -7,6 +7,7 @@
* Date Author Notes
* 2012-11-23 Bernard Add extern "C"
* 2020-06-13 armink fix the 3 wires issue
+ * 2022-09-01 liYony fix api rt_spi_sendrecv16 about MSB and LSB bug
*/
#ifndef __SPI_H__
@@ -227,6 +228,9 @@ rt_err_t rt_spi_send_then_send(struct rt_spi_device *device,
const void *send_buf2,
rt_size_t send_length2);
+rt_uint16_t rt_spi_sendrecv16(struct rt_spi_device *device,
+ rt_uint16_t data);
+
/**
* This function transmits data to SPI device.
*
@@ -278,16 +282,6 @@ rt_inline rt_uint8_t rt_spi_sendrecv8(struct rt_spi_device *device,
return value;
}
-rt_inline rt_uint16_t rt_spi_sendrecv16(struct rt_spi_device *device,
- rt_uint16_t data)
-{
- rt_uint16_t value = 0;
-
- rt_spi_send_then_recv(device, &data, 2, &value, 2);
-
- return value;
-}
-
/**
* This function appends a message to the SPI message list.
*