添加i2c支持
This commit is contained in:
parent
e0c2bf09e3
commit
cabf2f5ee5
|
@ -18,7 +18,7 @@
|
|||
#define LOG_TAG "drv.i2c"
|
||||
#include <drv_log.h>
|
||||
|
||||
#if !defined(BSP_USING_I2C1) && !defined(BSP_USING_I2C2) && !defined(BSP_USING_I2C3)
|
||||
#if !defined(BSP_USING_I2C1) && !defined(BSP_USING_I2C2) && !defined(BSP_USING_I2C3) && !defined(BSP_USING_I2C4)
|
||||
#error "Please define at least one BSP_USING_I2Cx"
|
||||
/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */
|
||||
#endif
|
||||
|
@ -32,7 +32,10 @@ static const struct stm32_soft_i2c_config soft_i2c_config[] =
|
|||
I2C2_BUS_CONFIG,
|
||||
#endif
|
||||
#ifdef BSP_USING_I2C3
|
||||
I2C2_BUS_CONFIG,
|
||||
I2C3_BUS_CONFIG,
|
||||
#endif
|
||||
#ifdef BSP_USING_I2C4
|
||||
I2C4_BUS_CONFIG,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -56,6 +56,15 @@ struct stm32_i2c
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_I2C4
|
||||
#define I2C4_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C4_SCL_PIN, \
|
||||
.sda = BSP_I2C4_SDA_PIN, \
|
||||
.bus_name = "i2c4", \
|
||||
}
|
||||
#endif
|
||||
|
||||
int rt_hw_i2c_init(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,13 +41,14 @@
|
|||
| :----------------- | :----------: | :------------------------------------- |
|
||||
| USB 转串口 | 支持 | |
|
||||
| RS232 | 支持 | 与以太网有引脚冲突 |
|
||||
| QSPI Flash | 暂不支持 | |
|
||||
| 电位器 | 暂不支持 | 使用 ADC1 |
|
||||
| 以太网 | 暂不支持 | |
|
||||
| MPU6050六轴传感器 | 暂不支持 | |
|
||||
| QSPI Flash | 支持 | |
|
||||
| 电位器 | 支持 | 使用 ADC1 |
|
||||
| 以太网 | 暂不支持 | 移植中 |
|
||||
| MPU6050六轴传感器 | 暂不支持 | 移植中 |
|
||||
| SDRAM | 支持 | |
|
||||
| SD卡 | 暂不支持 | |
|
||||
| CAN | 暂不支持 | |
|
||||
| SD卡 | 即将支持 | |
|
||||
| CAN | 即将支持 | |
|
||||
| EMW1062 | 暂不支持 | |
|
||||
| **片上外设** | **支持情况** | **备注** |
|
||||
| GPIO | 支持 | PA0, PA1... PK15 ---> PIN: 0, 1...176 |
|
||||
| UART | 支持 | UART1/x/x |
|
||||
|
|
|
@ -22,10 +22,16 @@ menu "Onboard Peripheral Drivers"
|
|||
default n
|
||||
|
||||
config BSP_USING_QSPI_FLASH
|
||||
bool "Enable QSPI FLASH (W25Q128 spi5)"
|
||||
select BSP_USING_SPI5
|
||||
bool "Enable QSPI FLASH"
|
||||
select BSP_USING_QSPI
|
||||
select RT_USING_SFUD
|
||||
select RT_SFUD_USING_SFDP
|
||||
select RT_SFUD_USING_QSPI
|
||||
default n
|
||||
|
||||
config BSP_USING_MPU6050
|
||||
bool "Enable MPU6050 (i2c4)"
|
||||
select BSP_USING_I2C4
|
||||
select PKG_USING_MPU6XXX
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
@ -79,6 +85,12 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable SPI DMA support"
|
||||
default n
|
||||
|
||||
config BSP_USING_QSPI
|
||||
bool "Enable QSPI BUS"
|
||||
select RT_USING_QSPI
|
||||
select RT_USING_SPI
|
||||
default n
|
||||
|
||||
menuconfig BSP_USING_ADC
|
||||
bool "Enable ADC"
|
||||
default n
|
||||
|
@ -115,6 +127,58 @@ menu "On-chip Peripheral Drivers"
|
|||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS (software simulation)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 1 176
|
||||
default 47
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 1 176
|
||||
default 48
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS (software simulation)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 1 176
|
||||
default 92
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 1 176
|
||||
default 93
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C4
|
||||
bool "Enable I2C4 BUS (software simulation)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C4
|
||||
comment "Notice: PD12 --> 60; PD13 --> 61"
|
||||
config BSP_I2C4_SCL_PIN
|
||||
int "i2c4 scl pin number"
|
||||
range 1 176
|
||||
default 60
|
||||
config BSP_I2C4_SDA_PIN
|
||||
int "I2C4 sda pin number"
|
||||
range 1 176
|
||||
default 61
|
||||
endif
|
||||
|
||||
config BSP_USING_ONCHIP_RTC
|
||||
bool "Enable RTC"
|
||||
select RT_USING_RTC
|
||||
|
|
Loading…
Reference in New Issue