generated from hulk/gd32e23x_template_cmake_vscode
fix project
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "board_config.h"
|
||||
#include "gd32e23x_usart.h"
|
||||
#include "ultrasonic_analog.h"
|
||||
#include "systick.h"
|
||||
|
||||
/* ============================================================================
|
||||
* 协议格式说明
|
||||
@@ -255,15 +256,17 @@ void handle_command(const uint8_t *frame, uint8_t len) {
|
||||
switch (base_cmd) {
|
||||
case 1u: // M1: enable sensor report
|
||||
// g_ultrasonic_measure_done = false;
|
||||
gpio_bit_toggle(GPIOA, GPIO_PIN_0);
|
||||
ultrasonic_pwm_out_cycles();
|
||||
|
||||
delay_ms(2); // TODO: 模拟超声结果等待延时
|
||||
|
||||
gpio_bit_toggle(GPIOA, GPIO_PIN_0);
|
||||
|
||||
while (g_ultrasonic_measure_done)
|
||||
{
|
||||
g_ultrasonic_measure_done = false;
|
||||
// g_ultrasonic_measure_done = false;
|
||||
send_response(RESP_TYPE_OK, s_report_status_err, sizeof(s_report_status_err));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -39,8 +39,6 @@ OF SUCH DAMAGE.
|
||||
#include "led.h"
|
||||
#include "ultrasonic_analog.h"
|
||||
|
||||
extern uint16_t g_capture_value;
|
||||
|
||||
/*!
|
||||
\brief this function handles NMI exception
|
||||
\param[in] none
|
||||
@@ -147,7 +145,7 @@ void EXTI0_1_IRQHandler(void) {
|
||||
if (exti_interrupt_flag_get(US_RX_GPIO_EXTI) == SET)
|
||||
{
|
||||
exti_interrupt_flag_clear(US_RX_GPIO_EXTI);
|
||||
g_capture_value = timer_channel_capture_value_register_read(US_ECHO_TIMER, US_ECHO_CH);
|
||||
// g_capture_value = timer_channel_capture_value_register_read(US_ECHO_TIMER, US_ECHO_CH);
|
||||
|
||||
timer_disable(US_ECHO_TIMER);
|
||||
exti_interrupt_disable(US_RX_GPIO_EXTI);
|
||||
|
@@ -42,8 +42,6 @@ OF SUCH DAMAGE.
|
||||
#include "board_config.h"
|
||||
#include "ultrasonic_analog.h"
|
||||
|
||||
volatile uint16_t g_capture_value;
|
||||
|
||||
/*!
|
||||
\brief main function
|
||||
\param[in] none
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "systick.h"
|
||||
|
||||
volatile bool g_ultrasonic_measure_done = false;
|
||||
extern uint32_t g_capture_value;
|
||||
|
||||
void ultrasonic_tx_init(void) {
|
||||
|
||||
@@ -73,7 +72,9 @@ void ultrasonic_pwm_out_cycles(void) {
|
||||
timer_channel_output_state_config(TIMER13, TIMER_CH_0, TIMER_CCX_ENABLE);
|
||||
|
||||
timer_enable(US_TX_TIMER);
|
||||
timer_enable(TIMER15);
|
||||
|
||||
// TODO 启动后续回波计时器
|
||||
// timer_enable(TIMER15);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user