mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
fixed function duplicated def issue
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
|
||||
bool DecodeCanFrame(const struct can_frame *rx_frame, AgxMessage *msg) {
|
||||
bool DecodeCanFrameV2(const struct can_frame *rx_frame, AgxMessage *msg) {
|
||||
msg->type = AgxMsgUnkonwn;
|
||||
|
||||
switch (rx_frame->can_id) {
|
||||
@@ -309,7 +309,7 @@ bool DecodeCanFrame(const struct can_frame *rx_frame, AgxMessage *msg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void EncodeCanFrame(const AgxMessage *msg, struct can_frame *tx_frame) {
|
||||
void EncodeCanFrameV2(const AgxMessage *msg, struct can_frame *tx_frame) {
|
||||
switch (msg->type) {
|
||||
/***************** command frame *****************/
|
||||
case AgxMsgMotionCommand: {
|
||||
@@ -595,7 +595,7 @@ void EncodeCanFrame(const AgxMessage *msg, struct can_frame *tx_frame) {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t CalcCanFrameChecksum(uint16_t id, uint8_t *data, uint8_t dlc) {
|
||||
uint8_t CalcCanFrameChecksumV2(uint16_t id, uint8_t *data, uint8_t dlc) {
|
||||
uint8_t checksum = 0x00;
|
||||
checksum = (uint8_t)(id & 0x00ff) + (uint8_t)(id >> 8) + dlc;
|
||||
for (int i = 0; i < (dlc - 1); ++i) checksum += data[i];
|
||||
|
||||
Reference in New Issue
Block a user