This commit is contained in:
Matthew Kennedy 2020-09-19 20:32:33 -07:00
parent 4eda375f17
commit 545fd5575a
3 changed files with 1 additions and 16 deletions

View File

@ -12,8 +12,6 @@ static const CANConfig canConfig500 =
void InitCan()
{
canStart(&CAND1, &canConfig500);
CanTxMessage::setDevice(CAND1);
}
struct StandardDataFrame

View File

@ -2,12 +2,6 @@
#include <cstring>
/*static*/ CANDriver* CanTxMessage::s_device = nullptr;
/*static*/ void CanTxMessage::setDevice(CANDriver& device) {
s_device = &device;
}
CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc) {
m_frame.IDE = CAN_IDE_STD;
m_frame.EID = eid;
@ -17,10 +11,8 @@ CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc) {
}
CanTxMessage::~CanTxMessage() {
auto device = s_device;
// 100 ms timeout
canTransmit(device, CAN_ANY_MAILBOX, &m_frame, TIME_MS2I(100));
canTransmit(&CAND1, CAN_ANY_MAILBOX, &m_frame, TIME_MS2I(100));
}
uint8_t& CanTxMessage::operator[](size_t index) {

View File

@ -25,11 +25,6 @@ public:
*/
~CanTxMessage();
/**
* Configures the device for all messages to transmit from.
*/
static void setDevice(CANDriver& device);
/**
* @brief Read & write the raw underlying 8-byte buffer.
*/