arduino-emulator
Loading...
Searching...
No Matches
Public Member Functions | List of all members
arduino::HardwareCAN Class Referenceabstract

Public Member Functions

virtual size_t available ()=0
 
virtual bool begin (CanBitRate const can_bitrate)=0
 
virtual void end ()=0
 
virtual CanMsg read ()=0
 
virtual int write (CanMsg const &msg)=0
 

Member Function Documentation

◆ available()

virtual size_t arduino::HardwareCAN::available ( )
pure virtual

Determine if any messages have been received and buffered.

Returns
the number of unread messages that have been received

◆ begin()

virtual bool arduino::HardwareCAN::begin ( CanBitRate const  can_bitrate)
pure virtual

Initialize the CAN controller.

Parameters
can_bitratethe bus bit rate
Returns
true if initialization succeeded and the controller is operational

◆ end()

virtual void arduino::HardwareCAN::end ( )
pure virtual

Disable the CAN controller.

Whether any messages that are buffered will be sent is implementation defined.

◆ read()

virtual CanMsg arduino::HardwareCAN::read ( )
pure virtual

Returns the first message received, or an empty message if none are available.

Messages must be returned in the order received.

Returns
the first message in the receive buffer

◆ write()

virtual int arduino::HardwareCAN::write ( CanMsg const msg)
pure virtual

Enqueue a message for transmission to the CAN bus.

This call returns when the message has been enqueued for transmission. Due to bus arbitration and error recovery there may be a substantial delay before the message is actually sent.

An implementation must ensure that all messages with the same CAN priority are sent in the order in which they are enqueued.

It is implementation defined whether multiple messages can be enqueued for transmission, and if messages with higher CAN priority can preempt the transmission of previously enqueued messages. The default configuration for and implementation should not allow multiple messages to be enqueued.

Parameters
msgthe message to send
Returns
1 if the message was enqueued, an implementation defined error code < 0 if there was an error
Todo:
define specific error codes, especially "message already pending"

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