From 3ce7f2cb15f0a8e83c4360a61a283873725cee8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC=5F666?= <13089258+pony-six-hundred-and-sixty-six@user.noreply.gitee.com> Date: Thu, 23 Jan 2025 08:50:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/main.c | 5 +---- bsp/src/bsp_h308.c | 21 ++++++--------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/applications/main.c b/applications/main.c index c2413d6..3d7e784 100644 --- a/applications/main.c +++ b/applications/main.c @@ -2,7 +2,7 @@ * @Author: mbw * @Date: 2024-10-23 17:14:16 * @LastEditors: mbw && 1600520629@qq.com - * @LastEditTime: 2025-01-23 08:42:56 + * @LastEditTime: 2025-01-23 08:46:44 * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\applications\main.c * @Descrt_thread_ * @@ -505,9 +505,6 @@ static void SYS_Set_RtcProductTime(int argc, char **argv) MSH_CMD_EXPORT(SYS_Set_RtcProductTime, "SYS_Set_RtcProductTime"); - - - static void SYS_SW_Version(void) { COMPILE_TIME; diff --git a/bsp/src/bsp_h308.c b/bsp/src/bsp_h308.c index 48ff2b8..a3aa915 100644 --- a/bsp/src/bsp_h308.c +++ b/bsp/src/bsp_h308.c @@ -2,7 +2,7 @@ * @Author: mbw * @Date: 2024-11-14 10:21:04 * @LastEditors: mbw && 1600520629@qq.com - * @LastEditTime: 2025-01-22 22:54:08 + * @LastEditTime: 2025-01-23 08:45:04 * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_h308.c * @Description: * @@ -34,8 +34,7 @@ static rt_uint8_t uart4_rx_rb_data[UART4_RX_RB_LENGTH]; static rt_sem_t uart4_rx_ok_sem; -// static rt_timer_t uart4_rx_timer; -static struct rt_timer uart4_rx_timer1; +static struct rt_timer uart4_rx_timer; uint8_t sensor_rx_count = 0; // 接收缓冲区中,已经收到的数据包数量 static rt_uint8_t alarm_flag = 0, fault_flag = 0; @@ -45,8 +44,8 @@ TsH308 H308 = {0}; void _UART4_RxTimeout(void *parameter) { rt_sem_release(uart4_rx_ok_sem); - // rt_timer_stop(uart4_rx_timer); - rt_timer_stop(&uart4_rx_timer1); + rt_timer_stop(&uart4_rx_timer); + } static uint8_t H308_XorChecksum(char *str, int len) @@ -373,13 +372,7 @@ int BSP_H308_Init(void) } // TODO:这里改的静态 - rt_timer_init(&uart4_rx_timer1, "_UART4_RxTimeout", _UART4_RxTimeout, RT_NULL, 200, RT_TIMER_FLAG_PERIODIC); - // rt_timer_start(&uart4_rx_timer1); - // uart4_rx_timer = rt_timer_create("_UART4_RxTimeout", _UART4_RxTimeout, RT_NULL, 200, RT_TIMER_FLAG_PERIODIC); - // if (uart4_rx_timer == RT_NULL) - // { - // LOG_E("uart4_rx_timer create failed"); - // } + rt_timer_init(&uart4_rx_timer, "_UART4_RxTimeout", _UART4_RxTimeout, RT_NULL, 200, RT_TIMER_FLAG_PERIODIC); UART4_Init(); rt_err_t ret = rt_thread_init(&h308_thread, "h308_thread", @@ -413,9 +406,7 @@ void UART4_IRQHandler(void) { uint8_t temp = USART_ReceiveData(UART4); lwrb_write(&uart4_rx_rb, &temp, 1); - // sensor_rx_count++; - // rt_timer_start(uart4_rx_timer); - rt_timer_start(&uart4_rx_timer1); + rt_timer_start(&uart4_rx_timer); } rt_interrupt_leave();