在board_config.h文件中添加#define SOFTWARE_IIC选项用以选择使用软件IIC还是硬件IIC,如果注释掉该行则为硬件IIC方式。并完整实现软件IIC功能。

This commit is contained in:
2024-12-29 22:07:49 +08:00
parent 9b9f14f97a
commit 0ac221ce6f
10 changed files with 187 additions and 89 deletions

View File

@@ -5,6 +5,10 @@
#ifndef BOARD_CONFIG_H
#define BOARD_CONFIG_H
#define SOFTWARE_IIC
// #define DEBUG_VERBOES
/******************************************************************************/
#define I2C_SPEED 20000
@@ -18,4 +22,15 @@
/******************************************************************************/
#define RS485_RCU RCU_USART0
#define RS485_GPIO_RCU RCU_GPIOA
#define RS485_GPIO_PORT GPIOA
#define RS485_TX_PIN GPIO_PIN_2
#define RS485_RX_PIN GPIO_PIN_3
#define RS485_PHY USART0
#define RS485_BAUDRATE 115200U
#define RS485_EN_PIN GPIO_PIN_1
/******************************************************************************/
#endif //BOARD_CONFIG_H