feat: 增加速度环
This commit is contained in:
19
app/by_can.c
19
app/by_can.c
@@ -2,8 +2,11 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "dwt_delay.h"
|
||||
#include "by_utils.h"
|
||||
#include "by_debug.h"
|
||||
|
||||
uint8_t by_can_send_stdd(uint32_t id, const uint8_t *data, uint8_t len)
|
||||
by_error_status by_can_send_stdd(uint32_t id, const uint8_t *data, uint8_t len, uint16_t timeout)
|
||||
{
|
||||
|
||||
assert(id < 0x7FF);
|
||||
@@ -23,9 +26,15 @@ uint8_t by_can_send_stdd(uint32_t id, const uint8_t *data, uint8_t len)
|
||||
transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct); /* 将以上待发送报文写入发送邮箱并请求发送 */
|
||||
|
||||
/* 等待该邮箱发送成功—对应邮箱发送成功标志置起 */
|
||||
while (can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) !=
|
||||
CAN_TX_STATUS_SUCCESSFUL)
|
||||
;
|
||||
while (can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL) {
|
||||
// LOGD("CAN#SEND: timeout=%d", timeout);
|
||||
if (0 == timeout--) {
|
||||
LOGW("CAN#TIMEOUT: ID=0x%x", id);
|
||||
|
||||
return 0;
|
||||
return BY_ERROR;
|
||||
}
|
||||
DWT_Delay(10);
|
||||
}
|
||||
|
||||
return BY_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user