NetBurner 3.5.6
PDF Version
canMCF5441x::CanRxMessage Class Reference

Class to hold received CAN messages. More...

#include <multican.h>

Public Member Functions

uint8_t GetLength ()
 Returns the amount of data stored in the message.
 
uint8_t GetData (uint8_t *buffer, uint8_t max_len)
 Copy the data in the message up to max_len.
 
uint32_t GetId ()
 Returns the ID of the message.
 
uint16_t GetTimeStamp ()
 Returns the time stamp of the message.
 
BOOL IsValid ()
 Check to verify the CanRxMessage is a valid message.
 
 CanRxMessage (OS_FIFO *pFifo, uint16_t timeout)
 Build a CanRxMessage from a FIFO.
 
 CanRxMessage (int moduleNum, uint32_t id, uint16_t timeout)
 Constructor that sends out a RTR request to ID and waits for a response.
 
 ~CanRxMessage ()
 Destructor.
 
BOOL GetNewMessage (OS_FIFO *pFifo, uint16_t timeout)
 Get a new message from the FIFO. If no message is available, wait up to the timeout for one to be received.
 

Detailed Description

Class to hold received CAN messages.

Constructor & Destructor Documentation

◆ CanRxMessage() [1/2]

canMCF5441x::CanRxMessage::CanRxMessage ( OS_FIFO * pFifo,
uint16_t timeout )

Build a CanRxMessage from a FIFO.

The FIFO must be registered to listen for incoming messages. If no messages are received in the timeout interval, the returned CanRxMessage will be marked as not valid. A Timeout value of 0 will wait forever.

Parameters
pFifoPointer to an OS_FIFO to store the message
timeoutMessage timeout in TICKS_PER_SECOND

◆ CanRxMessage() [2/2]

canMCF5441x::CanRxMessage::CanRxMessage ( int moduleNum,
uint32_t id,
uint16_t timeout )

Constructor that sends out a RTR request to ID and waits for a response.

The CAN system uses any unused channel to send and receive the buffer. The constructor can return an invalid message for two reasons:

  1. The timeout interval has expired
  2. There were no free CAN channels available to send the request
Parameters
moduleNumCAN module number
idCAN ID number
timeoutMessage timeout in TICKS_PER_SECOND. A value of 0 will wait forever.

Member Function Documentation

◆ GetData()

uint8_t canMCF5441x::CanRxMessage::GetData ( uint8_t * buffer,
uint8_t max_len )

Copy the data in the message up to max_len.

Parameters
bufferPointer to destination storage buffer
max_lenMaximum number of bytes to copy
Returns
The number of bytes copied

◆ GetNewMessage()

BOOL canMCF5441x::CanRxMessage::GetNewMessage ( OS_FIFO * pFifo,
uint16_t timeout )

Get a new message from the FIFO. If no message is available, wait up to the timeout for one to be received.

Parameters
pFifoPointer to the OS_FIFO.
timeoutTimeout to wait if no messages are currently available. Value is in TICKS_PER_SECOND, a value of 0 will wait forever.

◆ IsValid()

BOOL canMCF5441x::CanRxMessage::IsValid ( )

Check to verify the CanRxMessage is a valid message.

Please refer to the CanRxMessage() constructor for further information on valid messages.


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