feat: 完成通信配置
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
#include "by_tiny_frame_pack.h"
|
||||
#include "by_tiny_frame_parse.h"
|
||||
|
||||
uint8_t write_processing_flag;
|
||||
|
||||
void by_tiny_frame_write_run(void)
|
||||
{
|
||||
// nothing
|
||||
@@ -14,6 +12,11 @@ void by_tiny_frame_write_run(void)
|
||||
|
||||
void by_tiny_frame_write(uint8_t slave_id, uint16_t reg_addr, uint32_t data)
|
||||
{
|
||||
if(by_tiny_frame_pack_lock){
|
||||
//写入忙处理
|
||||
return;
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
by_tf_pack_frame_t frame_s;
|
||||
frame_s.slave_id = slave_id;
|
||||
@@ -30,12 +33,12 @@ void by_tiny_frame_write(uint8_t slave_id, uint16_t reg_addr, uint32_t data)
|
||||
// 开启响应监听
|
||||
by_tiny_frame_parse_start_listen();
|
||||
|
||||
write_processing_flag = 1;
|
||||
by_tiny_frame_pack_lock = 1;
|
||||
}
|
||||
|
||||
void by_tiny_frame_write_handle(by_tf_parse_frame_t frame_s, uint8_t status)
|
||||
{
|
||||
write_processing_flag = 0;
|
||||
by_tiny_frame_pack_lock = 0;
|
||||
|
||||
#if (BY_TF_DEBUG)
|
||||
printf("****** WRITE REGISTER DONE ******\r\n");
|
||||
|
||||
Reference in New Issue
Block a user