You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
54 lines
1.5 KiB
#include "basic.hpp"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
using namespace iflytop;
|
|
using namespace std;
|
|
uint16_t CanPacketRxBuffer::get_packetindex() {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
return cmdheader->index;
|
|
}
|
|
uint16_t CanPacketRxBuffer::get_cmdid() {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
|
|
return cmdheader->cmdid;
|
|
}
|
|
|
|
uint8_t CanPacketRxBuffer::get_packetType() {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
return cmdheader->packetType;
|
|
}
|
|
uint8_t *CanPacketRxBuffer::get_params() {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
return (cmdheader->data);
|
|
}
|
|
uint16_t CanPacketRxBuffer::get_params_len() {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
return cmdheader->datalen;
|
|
}
|
|
void CanPacketRxBuffer::clear() {
|
|
id = 0;
|
|
memset(&m_canPacket, 0, sizeof(m_canPacket)); // fix
|
|
m_canPacketNum = 0;
|
|
m_npacket = 0;
|
|
memset(rxdata, 0, sizeof(rxdata));
|
|
rxdataSize = 0;
|
|
|
|
dataIsReady = false;
|
|
isOnReceive = false;
|
|
isUsed = false;
|
|
lostpacket = false;
|
|
}
|
|
|
|
bool CanPacketRxBuffer::iscmd(int32_t id) {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
return cmdheader->cmdid == id;
|
|
}
|
|
zcr_cmd_header_t *CanPacketRxBuffer::get_cmdheader() {
|
|
zcr_cmd_header_t *cmdheader = (zcr_cmd_header_t *)rxdata;
|
|
return cmdheader;
|
|
}
|
|
|
|
uint8_t *CanPacketRxBuffer::get_rx_raw() { return rxdata; }
|
|
uint16_t CanPacketRxBuffer::get_rx_raw_len() { return rxdataSize; }
|