KConfig 语法学习
RTT 官方教程
https://www.rt-thread.org/document/site/#/development-tools/build-config-system/Kconfig
我自己写的IIC配置
menuconfig BSP_USING_I2C # I2C 菜单
bool "Enable I2C BUS" # 提示I2C 菜单
default n # 默认不使能I2C 菜单
if BSP_USING_I2C # 如果使能I2C 菜单
config RT_USING_I2C_BITOPS # 定义了一组新的配置选项 软件模拟IIC RT_USING_I2C_BITOPS
bool "Enable I2C BUS (software simulation)" # 提示I2C 是软件模拟
default n # 默认不使能I2C 菜单
if RT_USING_I2C_BITOPS # 如果定义IIC RT_USING_I2C_BITOPS
config BSP_I2C1_SCL_PIN # 定义了一组新的配置选项 软件模拟IIC scl 引脚
select RT_USING_PIN
int "i2c1 scl pin number software simulation" # 提示这是iic的 scl引脚配置
range 0 64 # 这里值得取值范围限制
default 22 # 这里值得取值范围限制
config BSP_I2C1_SDA_PIN # 定义了一组新的配置选项 软件模拟IIC sda 引脚
select RT_USING_PIN
int "I2C1 sda pin number software simulation" # 提示这是iic的 scl引脚配置
range 0 64 # 这里值得取值范围限制
default 23 # 这里值得取值范围限制
endif
menuconfig RT_USING_HARDWARE_I2C # I2C 硬件菜单
bool "Enable I2C BUS (hardware simulation)" # 提示I2C 是硬件模拟
default n # 默认不使能硬件I2C
if RT_USING_HARDWARE_I2C # 如果使能硬件I2C
config BSP_USING_I2C1 # 定义了一组新的配置选项 硬件IIC1
bool "Enable I2C1 BUS"
default n # 默认不使能硬件I2C1
if BSP_USING_I2C1
config BSP_I2C1_SCL_PIN
select RT_USING_PIN
int "i2c1 scl pin number"
range 0 64
default 22
config BSP_I2C1_SDA_PIN
select RT_USING_PIN
int "I2C1 sda pin number"
range 0 64
default 23
endif
config BSP_USING_I2C2
bool "Enable I2C2 BUS"
default n
if BSP_USING_I2C2
config BSP_I2C2_SCL_PIN
int "i2c2 scl pin number"
range 0 64
default 22
config BSP_I2C2_SDA_PIN
int "I2C2 sda pin number"
range 0 64
default 23
endif
endif
endif