mirror of https://github.com/rusefi/wideband.git
simplify
This commit is contained in:
parent
4eda375f17
commit
545fd5575a
|
@ -12,8 +12,6 @@ static const CANConfig canConfig500 =
|
||||||
void InitCan()
|
void InitCan()
|
||||||
{
|
{
|
||||||
canStart(&CAND1, &canConfig500);
|
canStart(&CAND1, &canConfig500);
|
||||||
|
|
||||||
CanTxMessage::setDevice(CAND1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StandardDataFrame
|
struct StandardDataFrame
|
||||||
|
|
|
@ -2,12 +2,6 @@
|
||||||
|
|
||||||
#include <cstring>
|
#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) {
|
CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc) {
|
||||||
m_frame.IDE = CAN_IDE_STD;
|
m_frame.IDE = CAN_IDE_STD;
|
||||||
m_frame.EID = eid;
|
m_frame.EID = eid;
|
||||||
|
@ -17,10 +11,8 @@ CanTxMessage::CanTxMessage(uint32_t eid, uint8_t dlc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CanTxMessage::~CanTxMessage() {
|
CanTxMessage::~CanTxMessage() {
|
||||||
auto device = s_device;
|
|
||||||
|
|
||||||
// 100 ms timeout
|
// 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) {
|
uint8_t& CanTxMessage::operator[](size_t index) {
|
||||||
|
|
|
@ -25,11 +25,6 @@ public:
|
||||||
*/
|
*/
|
||||||
~CanTxMessage();
|
~CanTxMessage();
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the device for all messages to transmit from.
|
|
||||||
*/
|
|
||||||
static void setDevice(CANDriver& device);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read & write the raw underlying 8-byte buffer.
|
* @brief Read & write the raw underlying 8-byte buffer.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue