mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 10:36:04 +08:00
[device][spi] 修复 rt_spi_sendrecv8/16 收发不同时的问题
rt_spi_send_then_recv是先发再等待一个独立的消息接收 rt_spi_transfer是收发同时进行 rt_spi_sendrecv8/16应使用rt_spi_transfer而不是rt_spi_send_then_recv
This commit is contained in:
committed by
Man, Jianting (Meco)
parent
d8a42139bf
commit
93968942c2
@@ -237,10 +237,6 @@ rt_err_t rt_spi_send_then_send(struct rt_spi_device *device,
|
||||
const void *send_buf2,
|
||||
rt_size_t send_length2);
|
||||
|
||||
rt_err_t rt_spi_sendrecv16(struct rt_spi_device *device,
|
||||
rt_uint16_t senddata,
|
||||
rt_uint16_t *recvdata);
|
||||
|
||||
/**
|
||||
* This function transmits data to SPI device.
|
||||
*
|
||||
@@ -256,6 +252,14 @@ rt_ssize_t rt_spi_transfer(struct rt_spi_device *device,
|
||||
void *recv_buf,
|
||||
rt_size_t length);
|
||||
|
||||
rt_err_t rt_spi_sendrecv8(struct rt_spi_device *device,
|
||||
rt_uint8_t senddata,
|
||||
rt_uint8_t *recvdata);
|
||||
|
||||
rt_err_t rt_spi_sendrecv16(struct rt_spi_device *device,
|
||||
rt_uint16_t senddata,
|
||||
rt_uint16_t *recvdata);
|
||||
|
||||
/**
|
||||
* This function transfers a message list to the SPI device.
|
||||
*
|
||||
@@ -282,16 +286,6 @@ rt_inline rt_size_t rt_spi_send(struct rt_spi_device *device,
|
||||
return rt_spi_transfer(device, send_buf, RT_NULL, length);
|
||||
}
|
||||
|
||||
rt_inline rt_uint8_t rt_spi_sendrecv8(struct rt_spi_device *device,
|
||||
rt_uint8_t data)
|
||||
{
|
||||
rt_uint8_t value = 0;
|
||||
|
||||
rt_spi_send_then_recv(device, &data, 1, &value, 1);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function appends a message to the SPI message list.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user