rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions
CanTxTyped< TData > Class Template Referencefinal

#include <can_msg_tx.h>

Inheritance diagram for CanTxTyped< TData >:
Inheritance graph
[legend]
Collaboration diagram for CanTxTyped< TData >:
Collaboration graph
[legend]

Public Member Functions

 CanTxTyped (CanCategory p_category, uint32_t p_id, bool p_isExtended, size_t canChannel)
 
TData * operator-> ()
 
TData & get ()
 
- Public Member Functions inherited from CanTxMessage
 CanTxMessage (CanCategory category, uint32_t eid, uint8_t dlc=8, size_t bus=0, bool isExtended=false)
 
 ~CanTxMessage ()
 
uint8_t & operator[] (size_t)
 Read & write the raw underlying 8-byte buffer.
 
void setShortValue (uint16_t value, size_t offset)
 Write a 16-bit short value to the buffer. Note: this writes in Intel little endian byte order.
 
void setShortValueMsb (uint16_t value, size_t offset)
 
void setBit (size_t byteIdx, size_t bitIdx)
 Set a single bit in the transmit buffer. Useful for single-bit flags.
 
void setDlc (uint8_t dlc)
 
void setBus (size_t bus)
 
const CANTxFramegetFrame () const
 
void setArray (const uint8_t *data, size_t len)
 
template<size_t N>
void setArray (const uint8_t(&data)[N])
 

Additional Inherited Members

- Static Public Member Functions inherited from CanTxMessage
static void setDevice (CANDriver *device1, CANDriver *device2)
 
- Data Fields inherited from CanTxMessage
CanCategory category
 
size_t busIndex = 0
 
- Protected Attributes inherited from CanTxMessage
CANTxFrame m_frame
 

Detailed Description

template<typename TData>
class CanTxTyped< TData >

A CAN message based on a type, removing the need for manually flipping bits/bytes.

Definition at line 113 of file can_msg_tx.h.

Constructor & Destructor Documentation

◆ CanTxTyped()

template<typename TData >
CanTxTyped< TData >::CanTxTyped ( CanCategory  p_category,
uint32_t  p_id,
bool  p_isExtended,
size_t  canChannel 
)
inlineexplicit

Definition at line 120 of file can_msg_tx.h.

120: CanTxMessage(p_category, p_id, sizeof(TData), canChannel, p_isExtended) { }
static CanTsChannel canChannel

Member Function Documentation

◆ get()

template<typename TData >
TData & CanTxTyped< TData >::get ( )
inline

Definition at line 134 of file can_msg_tx.h.

134 {
135 return *reinterpret_cast<TData*>(&m_frame.data8);
136 }
CANTxFrame m_frame
Definition can_msg_tx.h:100
uint8_t data8[8]
Frame data.
Definition can_mocks.h:27

Referenced by transmitStruct().

Here is the caller graph for this function:

◆ operator->()

template<typename TData >
TData * CanTxTyped< TData >::operator-> ( )
inline

Access members of the templated type.

So you can do: CanTxTyped<MyType> d; d->memberOfMyType = 23;

Definition at line 130 of file can_msg_tx.h.

130 {
131 return reinterpret_cast<TData*>(&m_frame.data8);
132 }

The documentation for this class was generated from the following file: