generated from hulk/gd32e23x_template
99 lines
2.9 KiB
C
99 lines
2.9 KiB
C
//
|
|
// Created by dell on 24-12-28.
|
|
//
|
|
|
|
#ifndef BOARD_CONFIG_H
|
|
#define BOARD_CONFIG_H
|
|
|
|
// #define SOFTWARE_IIC
|
|
|
|
// #define DEBUG_VERBOES
|
|
|
|
#define POWER_SUPPLY_12V
|
|
// #define POWER_SUPPLY_24V
|
|
|
|
/******************************************************************************/
|
|
|
|
#ifdef POWER_SUPPLY_12V
|
|
#define POWER_VOLTAGE "12V"
|
|
#define TIME_CORRECTION_US 250
|
|
#define CAPTURE_VALUE_MAX 515
|
|
#elif defined(POWER_SUPPLY_24V)
|
|
#define POWER_VOLTAGE "24V"
|
|
#define TIME_CORRECTION_US 230
|
|
#define CAPTURE_VALUE_MAX 550
|
|
#else
|
|
#error "Please define either POWER_SUPPLY_12V or POWER_SUPPLY_24V"
|
|
#endif
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
#define I2C_GPIO_RCU RCU_GPIOF
|
|
#define I2C_RCU RCU_I2C0
|
|
#define I2C_PHY I2C0
|
|
#define I2C_SCL_PORT GPIOF
|
|
#define I2C_SCL_PIN GPIO_PIN_1
|
|
#define I2C_SDA_PORT GPIOF
|
|
#define I2C_SDA_PIN GPIO_PIN_0
|
|
#define I2C_GPIO_AF GPIO_AF_1
|
|
|
|
/******************************************************************************/
|
|
|
|
#define USART_GPIO_RCU RCU_GPIOA
|
|
#define USART_RCU RCU_USART1
|
|
#define USART_GPIO_PORT GPIOA
|
|
#define USART_GPIO_AF GPIO_AF_1
|
|
#define USART_TX_PIN GPIO_PIN_2
|
|
#define USART_RX_PIN GPIO_PIN_3
|
|
#define USART_PHY USART1
|
|
#define USART_PHY_BAUDRATE 115200U
|
|
#define USART_PHY_IRQ USART1_IRQn
|
|
#define RS485_EN_PORT GPIOA
|
|
#define RS485_EN_PIN GPIO_PIN_4
|
|
|
|
/******************************************************************************/
|
|
|
|
#define LED_PORT GPIOA
|
|
#define LED_PIN GPIO_PIN_9
|
|
#define LED_RCU RCU_GPIOA
|
|
#define LED_BLINK_TIMER_RCU RCU_TIMER5
|
|
#define LED_BLINK_TIMER TIMER5
|
|
#define LED_BLINK_IRQ TIMER5_IRQn
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
#define US_TX_GPIO_RCU RCU_GPIOB
|
|
#define US_TX_GPIO_PORT GPIOB
|
|
#define US_TX_PIN GPIO_PIN_1
|
|
#define US_TX_GPIO_AF GPIO_AF_0
|
|
#define US_TX_RCU RCU_TIMER13
|
|
#define US_TX_TIMER TIMER13
|
|
#define US_TX_CH TIMER_CH_0
|
|
|
|
/******************************************************************************/
|
|
|
|
#define US_TX_DELAY_RCU RCU_TIMER15
|
|
#define US_TX_DELAY_TIMER TIMER15
|
|
|
|
/******************************************************************************/
|
|
|
|
#define US_RX_GPIO_RCU RCU_GPIOA
|
|
#define US_RX_EXTI_RCU RCU_CFGCMP
|
|
#define US_RX_GPIO_PORT GPIOA
|
|
#define US_RX_GPIO_PIN GPIO_PIN_0
|
|
#define US_RX_EXTI_IRQ EXTI0_1_IRQn
|
|
#define US_RX_GPIO_EXTI EXTI_0
|
|
#define US_RX_EXTI_LINE EXTI_SOURCE_PIN0
|
|
|
|
/******************************************************************************/
|
|
|
|
#define US_ECHO_RCU RCU_TIMER16
|
|
#define US_ECHO_TIMER TIMER16
|
|
#define US_ECHO_CH TIMER_CH_0
|
|
|
|
/******************************************************************************/
|
|
|
|
#endif //BOARD_CONFIG_H
|