Skip to content

Commit a10ecee

Browse files
committed
[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 <runcheng.lu@hpmicro.com>
1 parent c39e92f commit a10ecee

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

components/drivers/spi/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ menuconfig RT_USING_SPI
77
menuconfig RT_USING_SPI_ISR
88
bool "Enable interrupt-safe SPI operations (using spinlocks in ISR context)"
99
default y
10+
11+
config RT_USING_SPI_BITOPS
12+
bool "Enable SPI bit-bang operation functions"
13+
default n
1014

1115
menuconfig RT_USING_SOFT_SPI
1216
bool "Use GPIO to simulate SPI"
1317
default n
1418
select RT_USING_PIN
19+
select RT_USING_SPI_BITOPS
1520
if RT_USING_SOFT_SPI
1621
menuconfig RT_USING_SOFT_SPI0
1722
bool "Enable SPI0 Bus (software simulation)"

components/drivers/spi/SConscript

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ src = ['dev_spi_core.c', 'dev_spi.c']
77
CPPPATH = [cwd, cwd + '/../include']
88
LOCAL_CFLAGS = ''
99

10-
if GetDepend('RT_USING_SOFT_SPI'):
10+
if GetDepend('RT_USING_SPI_BITOPS'):
1111
src += ['dev_spi_bit_ops.c']
12+
13+
if GetDepend('RT_USING_SOFT_SPI'):
1214
src += ['dev_soft_spi.c']
1315

1416
if GetDepend('RT_USING_QSPI'):

components/drivers/spi/dev_soft_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#error "Please define at least one RT_USING_SOFT_SPIx"
2020
/*
2121
This driver can be disabled at:
22-
menuconfig -> RT-Thread Components -> Device Drivers -> Using I2C device drivers
22+
menuconfig -> RT-Thread Components -> Device Drivers -> Using SPI Bus/Device device drivers -> Use GPIO to simulate SPI
2323
*/
2424
#endif
2525

0 commit comments

Comments
 (0)