summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorRuncheng Lu <[email protected]>2025-12-29 14:35:41 +0800
committerR b b666 <[email protected]>2026-01-04 17:04:34 +0800
commit17d026c6cc74f12dddf79690256331121124e2f3 (patch)
tree1c9593c16d54597cc1587e5fb5ff7515b76bd788 /components
parenta73f5d103263740263e839970e957e6d02d18fb5 (diff)
[fix] drivers: spi: refactor SPI bit operations into independent configuration
- Add RT_USING_SPI_BITOPS as a separate configurable option - Make RT_USING_SOFT_SPI depend on RT_USING_SPI_BITOPS - Adjust build order in SConscript for proper com Signed-off-by: Runcheng Lu <[email protected]>
Diffstat (limited to 'components')
-rw-r--r--components/drivers/spi/Kconfig5
-rw-r--r--components/drivers/spi/SConscript4
-rw-r--r--components/drivers/spi/dev_soft_spi.c2
3 files changed, 9 insertions, 2 deletions
diff --git a/components/drivers/spi/Kconfig b/components/drivers/spi/Kconfig
index 37a6a9b943..e1568dd460 100644
--- a/components/drivers/spi/Kconfig
+++ b/components/drivers/spi/Kconfig
@@ -7,11 +7,16 @@ menuconfig RT_USING_SPI
menuconfig RT_USING_SPI_ISR
bool "Enable interrupt-safe SPI operations (using spinlocks in ISR context)"
default y
+
+ config RT_USING_SPI_BITOPS
+ bool "Enable SPI bit-bang operation functions"
+ default n
menuconfig RT_USING_SOFT_SPI
bool "Use GPIO to simulate SPI"
default n
select RT_USING_PIN
+ select RT_USING_SPI_BITOPS
if RT_USING_SOFT_SPI
menuconfig RT_USING_SOFT_SPI0
bool "Enable SPI0 Bus (software simulation)"
diff --git a/components/drivers/spi/SConscript b/components/drivers/spi/SConscript
index 94c78456dc..a48767cb25 100644
--- a/components/drivers/spi/SConscript
+++ b/components/drivers/spi/SConscript
@@ -7,8 +7,10 @@ src = ['dev_spi_core.c', 'dev_spi.c']
CPPPATH = [cwd, cwd + '/../include']
LOCAL_CFLAGS = ''
-if GetDepend('RT_USING_SOFT_SPI'):
+if GetDepend('RT_USING_SPI_BITOPS'):
src += ['dev_spi_bit_ops.c']
+
+if GetDepend('RT_USING_SOFT_SPI'):
src += ['dev_soft_spi.c']
if GetDepend('RT_USING_QSPI'):
diff --git a/components/drivers/spi/dev_soft_spi.c b/components/drivers/spi/dev_soft_spi.c
index a308299f6c..9cfca2039f 100644
--- a/components/drivers/spi/dev_soft_spi.c
+++ b/components/drivers/spi/dev_soft_spi.c
@@ -19,7 +19,7 @@
#error "Please define at least one RT_USING_SOFT_SPIx"
/*
This driver can be disabled at:
- menuconfig -> RT-Thread Components -> Device Drivers -> Using I2C device drivers
+ menuconfig -> RT-Thread Components -> Device Drivers -> Using SPI Bus/Device device drivers -> Use GPIO to simulate SPI
*/
#endif