feat: 移植从机通信帧协议

This commit is contained in:
bmy
2024-02-25 11:49:10 +08:00
parent 354b41dad8
commit 038098ff2d
20 changed files with 1562 additions and 19 deletions

View File

@@ -0,0 +1,37 @@
#include "by_tiny_frame.h"
#include <stdio.h>
#include <stdint.h>
#include "crc16.h"
#include "zf_common_headfile.h"
#include "by_tiny_frame_config.h"
#include "by_tiny_frame_parse.h"
#include "by_tiny_frame_master_read.h"
#include "by_tiny_frame_master_write.h"
#include "by_tiny_frame_slave_read_write.h"
void by_tiny_frame_init(void)
{
/*** 初始化相关外设 ***/
uart_init(BY_TF_UART_INDEX, BY_TF_UART_BAUDRATE, BY_TF_UART_TX_PIN, BY_TF_UART_RX_PIN);
uart_rx_interrupt(BY_TF_UART_INDEX, ENABLE);
by_tiny_frame_parse_init();
#if defined(BY_TF_DEVICE_SLAVE)
by_tiny_frame_parse_handle_register(by_tiny_frame_read_write_handle);
#endif
}
void by_tiny_frame_run(void)
{
by_tiny_frame_parse_run();
#if defined(BY_TF_DEVICE_MASTER)
by_tiny_frame_read_run();
by_tiny_frame_write_run();
#elif defined(BY_TF_DEVICE_SLAVE)
by_tiny_frame_read_write_run();
#endif
}