new project

This commit is contained in:
2025-08-19 23:24:29 +08:00
parent 1247429882
commit c5eb3ab534
9 changed files with 365 additions and 28 deletions

View File

@@ -8,19 +8,14 @@
/* >>>>>>>>>>>>>>>>>>>>[IIC TYPE DEFINE]<<<<<<<<<<<<<<<<<<<< */
// #define SOFTWARE_IIC // IIC Type : Software IIC
#undef SOFTWARE_IIC // IIC Type : Hardware IIC
#define POWER_SUPPLY_24V // Powwer Supplu : 24V
// #undef POWER_SUPPLY_24V // Powwer Supplu : 12V
/* >>>>>>>>>>>>>>>>>>>>[DEBUG ASSERTIONS DEFINE]<<<<<<<<<<<<<<<<<<<< */
// #define DEBUG_VERBOSE // Debug Assertions Status : Debug Verbose Information
#undef DEBUG_VERBOSE // Debug Assertions Status : No Debug Verbose Information
/* >>>>>>>>>>>>>>>>>>>>[EDDY DRIVE CURRENT DETECTION]<<<<<<<<<<<<<<<<<<<< */
// #define EDDY_DRIVE_CURRENT_DETECTION // Eddy Drive Current Detection : Enable
#undef EDDY_DRIVE_CURRENT_DETECTION // Eddy Drive Current Detection : Disable
/******************************************************************************/
#define RCU_GPIO_I2C RCU_GPIOF
@@ -36,7 +31,7 @@
/******************************************************************************/
#define LED_PORT GPIOA
#define LED_PIN GPIO_PIN_7
#define LED_PIN GPIO_PIN_9
#define LED_RCU RCU_GPIOA
/******************************************************************************/
@@ -53,4 +48,40 @@
/******************************************************************************/
#define US_TX_GPIO_RCU RCU_GPIOB
#define US_TX_GPIO_PORT GPIOB
#define US_TX_GPIO_PIN GPIO_PIN_1
#define US_TX_GPIO_AF GPIO_AF_0
#define US_TX_TIMER_RCU RCU_TIMER13
#define US_TX_TIMER TIMER13
#define US_TX_TIMER_CH TIMER_CH_0
/******************************************************************************/
#define US_TX_DELAY_RCU RCU_TIMER15
#define US_TX_DELAY_TIMER TIMER15
/******************************************************************************/
#define US_RX_GPIO_RCU RCU_GPIOB
#define US_RX_EXTI_RCU RCU_CFGCMP
#define US_RX_GPIO_PORT GPIOA
#define US_RX_GPIO_PIN GPIO_PIN_0
#define US_RX_GPIO_EXTI EXTI_0
#define US_RX_EXTI_LINE EXTI_SOURCE_PIN0
#define US_RX_EXTI_IRQ EXTI0_1_IRQn
/******************************************************************************/
#define US_ECHO_RCU RCU_TIMER16
#define US_ECHO_TIMER TIMER16
#define US_ECHO_CH TIMER_CH_0
/******************************************************************************/
#define TIME_CORRECTION_US 230U
#define CAPTURE_VALUE_MAX 550U
/******************************************************************************/
#endif //BOARD_CONFIG_H

View File

@@ -16,6 +16,10 @@
* @{
*/
/** @brief 传感器周期上报使能标志 */
extern volatile bool g_eddy_current_sensor_report_enabled;
extern volatile bool g_temperature_sensor_report_enabled;
/**
* @section Command_Protocol 协议格式
* 接收命令帧格式:

View File

@@ -49,4 +49,8 @@ void PendSV_Handler(void);
/* this function handles SysTick exception */
void SysTick_Handler(void);
void TIMER13_IRQHandler(void);
void USART0_IRQHandler(void);
#endif /* GD32E23X_IT_H */

31
Inc/ultrasonic_analog.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef ULTRASONIC_ANALOG_H
#define ULTRASONIC_ANALOG_H
#include <stdint.h>
#include <stdbool.h>
extern volatile bool g_ultrasonic_measure_done;
/**************************************************************************************************/
#define ULTRASONIC_TX_CYCLES 5U /* 发送5个PWM周期驱动换能器 */
#define ULTRASONIC_TX_TIME 498U // ms
#define ULTRASONIC_MAX_TOF_RELOAD 1000U //us
/**************************************************************************************************/
void ultrasonic_tx_init(void);
void ultrasonic_pwm_out_cycles(void);
// void ultrasonic_transmit_delay(const uint16_t micro_second);
// void ultrasonic_rece_exti_config(void);
void ultrasonic_echo_timer_config(void);
void ultrasonic_config(void);
// uint16_t ultrasonic_calc_distance(void);
#endif // UART_H