helping CAN compile
This commit is contained in:
parent
2afae264c6
commit
cf26181189
|
@ -21,10 +21,13 @@
|
||||||
|
|
||||||
class CanTsChannel : public TsChannelBase {
|
class CanTsChannel : public TsChannelBase {
|
||||||
public:
|
public:
|
||||||
|
CanTsChannel() : TsChannelBase("CAN") {
|
||||||
|
|
||||||
|
}
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
// TsChannelBase implementation
|
// TsChannelBase implementation
|
||||||
void write(const uint8_t* buffer, size_t size) override;
|
void write(const uint8_t* buffer, size_t size, bool) override;
|
||||||
size_t readTimeout(uint8_t* buffer, size_t size, int timeout) override;
|
size_t readTimeout(uint8_t* buffer, size_t size, int timeout) override;
|
||||||
void flush() override;
|
void flush() override;
|
||||||
bool isReady() const override;
|
bool isReady() const override;
|
||||||
|
@ -41,7 +44,7 @@ void CanTsChannel::start() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CONFIG(canReadEnabled) || !CONFIG(canWriteEnabled)) {
|
if (!engineConfiguration->canReadEnabled || !engineConfiguration->canWriteEnabled) {
|
||||||
warning(CUSTOM_ERR_CAN_CONFIGURATION, "CAN read or write not enabled");
|
warning(CUSTOM_ERR_CAN_CONFIGURATION, "CAN read or write not enabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,9 +57,9 @@ void CanTsChannel::writeCrcPacket(uint8_t responseCode, const uint8_t* buf, size
|
||||||
// a special case for short packets: we can send them in 1 frame, without CRC & size,
|
// a special case for short packets: we can send them in 1 frame, without CRC & size,
|
||||||
// because the CAN protocol is already protected by its own checksum.
|
// because the CAN protocol is already protected by its own checksum.
|
||||||
if ((size + 1) <= 7) {
|
if ((size + 1) <= 7) {
|
||||||
write(&responseCode, 1); // header without size
|
write(&responseCode, 1, false); // header without size
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
write(buf, size); // body
|
write(buf, size, false); // body
|
||||||
}
|
}
|
||||||
flush();
|
flush();
|
||||||
return;
|
return;
|
||||||
|
@ -67,7 +70,7 @@ void CanTsChannel::writeCrcPacket(uint8_t responseCode, const uint8_t* buf, size
|
||||||
TsChannelBase::writeCrcPacket(responseCode, buf, size);
|
TsChannelBase::writeCrcPacket(responseCode, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanTsChannel::write(const uint8_t* buffer, size_t size) {
|
void CanTsChannel::write(const uint8_t* buffer, size_t size, bool) {
|
||||||
canStreamAddToTxTimeout(&size, buffer, BINARY_IO_TIMEOUT);
|
canStreamAddToTxTimeout(&size, buffer, BINARY_IO_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue