parent
4148ee76bf
commit
5830975040
|
@ -13,7 +13,6 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "os_access.h"
|
#include "os_access.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include "serial_can.h"
|
|
||||||
|
|
||||||
#if HAL_USE_CAN
|
#if HAL_USE_CAN
|
||||||
static CanStreamer streamer;
|
static CanStreamer streamer;
|
||||||
|
@ -21,8 +20,8 @@ static CanStreamerState state(&streamer);
|
||||||
static CanTsListener listener;
|
static CanTsListener listener;
|
||||||
#endif // HAL_USE_CAN
|
#endif // HAL_USE_CAN
|
||||||
|
|
||||||
|
|
||||||
#if HAL_USE_CAN || EFI_UNIT_TEST
|
#if HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
|
#include "serial_can.h"
|
||||||
#include "can.h"
|
#include "can.h"
|
||||||
#include "can_msg_tx.h"
|
#include "can_msg_tx.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ extern int canWriteNotOk;
|
||||||
#endif // EFI_CAN_SUPPORT
|
#endif // EFI_CAN_SUPPORT
|
||||||
|
|
||||||
CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc, bool isExtended) {
|
CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc, bool isExtended) {
|
||||||
|
#if HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
#ifndef STM32H7XX
|
#ifndef STM32H7XX
|
||||||
// ST bxCAN device
|
// ST bxCAN device
|
||||||
m_frame.IDE = isExtended ? CAN_IDE_EXT : CAN_IDE_STD;
|
m_frame.IDE = isExtended ? CAN_IDE_EXT : CAN_IDE_STD;
|
||||||
|
@ -44,6 +45,7 @@ CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc, bool isExtended) {
|
||||||
setDlc(dlc);
|
setDlc(dlc);
|
||||||
|
|
||||||
memset(m_frame.data8, 0, sizeof(m_frame.data8));
|
memset(m_frame.data8, 0, sizeof(m_frame.data8));
|
||||||
|
#endif // HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
CanTxMessage::~CanTxMessage() {
|
CanTxMessage::~CanTxMessage() {
|
||||||
|
@ -77,6 +79,7 @@ CanTxMessage::~CanTxMessage() {
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
void CanTxMessage::setDlc(uint8_t dlc) {
|
void CanTxMessage::setDlc(uint8_t dlc) {
|
||||||
m_frame.DLC = dlc;
|
m_frame.DLC = dlc;
|
||||||
}
|
}
|
||||||
|
@ -93,4 +96,5 @@ void CanTxMessage::setBit(size_t byteIdx, size_t bitIdx) {
|
||||||
uint8_t& CanTxMessage::operator[](size_t index) {
|
uint8_t& CanTxMessage::operator[](size_t index) {
|
||||||
return m_frame.data8[index];
|
return m_frame.data8[index];
|
||||||
}
|
}
|
||||||
|
#endif // HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
|
|
||||||
|
|
|
@ -59,16 +59,16 @@ public:
|
||||||
|
|
||||||
void setDlc(uint8_t dlc);
|
void setDlc(uint8_t dlc);
|
||||||
|
|
||||||
//#if ! EFI_SIMULATOR
|
#if HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
const CANTxFrame *getFrame() const {
|
const CANTxFrame *getFrame() const {
|
||||||
return &m_frame;
|
return &m_frame;
|
||||||
}
|
}
|
||||||
//#endif // EFI_SIMULATOR
|
#endif // HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//#if ! EFI_SIMULATOR
|
#if HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
CANTxFrame m_frame;
|
CANTxFrame m_frame;
|
||||||
//#endif // EFI_SIMULATOR
|
#endif // HAL_USE_CAN || EFI_UNIT_TEST
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if EFI_CAN_SUPPORT
|
#if EFI_CAN_SUPPORT
|
||||||
|
|
Loading…
Reference in New Issue