diff options
| author | liYangYang <[email protected]> | 2023-01-18 13:27:08 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-01-18 00:27:08 -0500 |
| commit | 7ff64c1cfd2c3392f388ed91cd4955a064265c7f (patch) | |
| tree | 87f1c548d63072a0a86abdcd23499107668bc030 /components | |
| parent | 65f18040058c8f3aff638bdd407e5e9f34ccab3f (diff) | |
[stm32][spi] spi attach函数问题解决方案 (#6864)
attach #6819
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/include/drivers/pin.h | 4 | ||||
| -rw-r--r-- | components/drivers/include/drivers/spi.h | 4 | ||||
| -rw-r--r-- | components/drivers/spi/spi_core.c | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/components/drivers/include/drivers/pin.h b/components/drivers/include/drivers/pin.h index 38e5abea2a..4390c9bb41 100644 --- a/components/drivers/include/drivers/pin.h +++ b/components/drivers/include/drivers/pin.h @@ -25,6 +25,8 @@ struct rt_device_pin const struct rt_pin_ops *ops; }; +#define PIN_NONE (-1) + #define PIN_LOW 0x00 #define PIN_HIGH 0x01 @@ -43,7 +45,7 @@ struct rt_device_pin #define PIN_IRQ_DISABLE 0x00 #define PIN_IRQ_ENABLE 0x01 -#define PIN_IRQ_PIN_NONE -1 +#define PIN_IRQ_PIN_NONE PIN_NONE struct rt_device_pin_mode { diff --git a/components/drivers/include/drivers/spi.h b/components/drivers/include/drivers/spi.h index 2cce830cd6..cd5ebe2db6 100644 --- a/components/drivers/include/drivers/spi.h +++ b/components/drivers/include/drivers/spi.h @@ -15,7 +15,7 @@ #include <stdlib.h> #include <rtthread.h> -#include <rtdevice.h> +#include <drivers/pin.h> #ifdef __cplusplus extern "C"{ @@ -79,7 +79,6 @@ struct rt_spi_configuration rt_uint8_t mode; rt_uint8_t data_width; rt_uint16_t reserved; - rt_base_t cs_pin; rt_uint32_t max_hz; }; @@ -113,6 +112,7 @@ struct rt_spi_device struct rt_spi_bus *bus; struct rt_spi_configuration config; + rt_base_t cs_pin; void *user_data; }; diff --git a/components/drivers/spi/spi_core.c b/components/drivers/spi/spi_core.c index 7aa09c9010..6bc875fccd 100644 --- a/components/drivers/spi/spi_core.c +++ b/components/drivers/spi/spi_core.c @@ -80,7 +80,6 @@ rt_err_t rt_spi_configure(struct rt_spi_device *device, device->config.data_width = cfg->data_width; device->config.mode = cfg->mode & RT_SPI_MODE_MASK ; device->config.max_hz = cfg->max_hz ; - device->config.cs_pin = cfg->cs_pin ; if (device->bus != RT_NULL) { |
