mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 18:57:16 +08:00
[driver][soft-spi] spi device driver framework adds pin init function function
为什么提交这份PR (why to submit this PR) ps:在设备初始化阶段不应该存在对硬件的操作 你的解决方案是什么 (what is your solution) ps:添加一个pin_init函数,在spi设备使用时调用该函数来完成硬件引脚的状态初始化,而不是在设备初始化阶段对硬件进行操作,已经在瑞萨HMI上通过验证
This commit is contained in:
@@ -384,6 +384,11 @@ rt_err_t spi_bit_configure(struct rt_spi_device *device, struct rt_spi_configura
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(configuration != RT_NULL);
|
||||
|
||||
if(ops->pin_init != RT_NULL)
|
||||
{
|
||||
ops->pin_init();
|
||||
}
|
||||
|
||||
if (configuration->mode & RT_SPI_SLAVE)
|
||||
{
|
||||
return -RT_EIO;
|
||||
|
||||
@@ -21,6 +21,7 @@ extern "C" {
|
||||
struct rt_spi_bit_ops
|
||||
{
|
||||
void *data; /* private data for lowlevel routines */
|
||||
void (*const pin_init)(void);
|
||||
void (*const tog_sclk)(void *data);
|
||||
void (*const set_sclk)(void *data, rt_int32_t state);
|
||||
void (*const set_mosi)(void *data, rt_int32_t state);
|
||||
|
||||
Reference in New Issue
Block a user