This commit is contained in:
james 2024-07-30 14:49:27 +08:00
parent 191f4a4877
commit c765ad513a
5 changed files with 17 additions and 11 deletions

View File

@ -1556,7 +1556,7 @@ CONFIG_BSP_USING_FLASH_FS_AUTO_MOUNT=y
CONFIG_BSP_USING_FAL=y CONFIG_BSP_USING_FAL=y
# CONFIG_BSP_USING_BOOTLOADER is not set # CONFIG_BSP_USING_BOOTLOADER is not set
# CONFIG_BSP_USING_EASYFLASH is not set # CONFIG_BSP_USING_EASYFLASH is not set
CONFIG_BSP_USING_RW007_WLAN=y # CONFIG_BSP_USING_RW007_WLAN is not set
CONFIG_BSP_USING_AHT21=y CONFIG_BSP_USING_AHT21=y
# CONFIG_BSP_USING_AP3216C is not set # CONFIG_BSP_USING_AP3216C is not set
# CONFIG_BSP_USING_ICM20608 is not set # CONFIG_BSP_USING_ICM20608 is not set

View File

@ -1,5 +1,12 @@
# 设备驱动
## I/O设备框架概念
### SPI驱动和设备驱动分离提供统一的API
• 更换 MCU 只需要改变对应的对接驱动
• 重新驱动设备,只需要重新编写设备驱动相关的代码
• 同一 API 接口,学习成本低
• 分离后设备驱动可以入库,供公司其他项目使用,减少碎片化开发,防止反复造轮子
• 代码框架会变复杂,但是从上面的优点来看是值得的
![spi驱动与设备驱动分离示意图](image-3.png)
### I/O框架 ### I/O框架
显示屏、串口通信、flash、SD卡、以太网接口 显示屏、串口通信、flash、SD卡、以太网接口

BIN
Day4/image-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -21,12 +21,12 @@ int main(void)
return 0; return 0;
} }
#define WIFI_CS GET_PIN(F,10) // #define WIFI_CS GET_PIN(F,10)
void WIFI_CS_PULL_DOWN(void) // void WIFI_CS_PULL_DOWN(void)
{ // {
rt_pin_mode(WIFI_CS, PIN_MODE_OUTPUT); // rt_pin_mode(WIFI_CS, PIN_MODE_OUTPUT);
rt_pin_write(WIFI_CS, PIN_LOW); // rt_pin_write(WIFI_CS, PIN_LOW);
} // }
INIT_BOARD_EXPORT(WIFI_CS_PULL_DOWN); // INIT_BOARD_EXPORT(WIFI_CS_PULL_DOWN);

View File

@ -563,7 +563,6 @@
#define BSP_USING_FLASH_FATFS #define BSP_USING_FLASH_FATFS
#define BSP_USING_FLASH_FS_AUTO_MOUNT #define BSP_USING_FLASH_FS_AUTO_MOUNT
#define BSP_USING_FAL #define BSP_USING_FAL
#define BSP_USING_RW007_WLAN
#define BSP_USING_AHT21 #define BSP_USING_AHT21
/* end of Onboard Peripheral Drivers */ /* end of Onboard Peripheral Drivers */