diff --git a/app/main.c b/app/main.c index af00836..028d67c 100644 --- a/app/main.c +++ b/app/main.c @@ -35,9 +35,13 @@ #include "by_tiny_frame_pack.h" /** 测试完成后移除 **/ -void test(void) +void test(uint8_t status) { - printf("hhhhhhok\r\n"); + if (status) { + printf("noooooooo!\r\n"); + } else { + printf("hhhhhhok\r\n"); + } } int main(void) diff --git a/app/tiny_frame/by_tiny_frame_parse.c b/app/tiny_frame/by_tiny_frame_parse.c index d5f627f..0432c14 100644 --- a/app/tiny_frame/by_tiny_frame_parse.c +++ b/app/tiny_frame/by_tiny_frame_parse.c @@ -10,7 +10,7 @@ uint8_t listern_flag; uint16_t listern_timeout; uint16_t listern_timevia; by_tf_parse_frame_t frame_now; -by_tf_parse_success_handle_func parse_success_handle; +by_tf_parse_done_handle_func parse_done_handle; void by_tiny_frame_parse_init(void) { @@ -104,6 +104,7 @@ void by_tiny_frame_parse_run(void) } else { if (listern_timeout <= listern_timevia) { // 接收超时,停止监听 + parse_done_handle(1); by_tiny_frame_parse_end_listern(); #if (BY_TF_DEBUG) printf("by_tf_listern timeout\r\n"); @@ -126,7 +127,7 @@ void by_tiny_frame_parse_run(void) // 接收成功后停止监听 by_tiny_frame_parse_end_listern(); // 解析成功回调 - parse_success_handle(); + parse_done_handle(0); #if (BY_TF_DEBUG) printf("frame parsed!\r\n"); #endif @@ -160,9 +161,9 @@ uint8_t by_tiny_frame_parse_crc(by_tf_parse_frame_t *frame_s) return 1; } -void by_tiny_frame_parse_handle_register(by_tf_parse_success_handle_func func) +void by_tiny_frame_parse_handle_register(by_tf_parse_done_handle_func func) { - parse_success_handle = func; + parse_done_handle = func; } void by_tiny_frame_parse_start_listern(void) diff --git a/app/tiny_frame/by_tiny_frame_parse.h b/app/tiny_frame/by_tiny_frame_parse.h index eeb41a0..2d7a7ac 100644 --- a/app/tiny_frame/by_tiny_frame_parse.h +++ b/app/tiny_frame/by_tiny_frame_parse.h @@ -18,13 +18,13 @@ typedef struct by_tf_parse_frame_t { uint32_t data; } by_tf_parse_frame_t; -typedef void (*by_tf_parse_success_handle_func)(void); +typedef void (*by_tf_parse_done_handle_func)(uint8_t); extern void by_tiny_frame_parse_init(void); extern void by_tiny_frame_parse_uart_handle(uint8_t buff); extern void by_tiny_frame_parse_run(void); extern uint8_t by_tiny_frame_parse_crc(by_tf_parse_frame_t *frame_s); -extern void by_tiny_frame_parse_handle_register(by_tf_parse_success_handle_func func); +extern void by_tiny_frame_parse_handle_register(by_tf_parse_done_handle_func func); extern void by_tiny_frame_parse_start_listern(void); extern void by_tiny_frame_parse_end_listern(void);