|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <can.hpp>
Public Member Functions | |
| Can ()=default | |
| mockable | ~Can ()=default |
| mockable void | initialize () |
| mockable bool | isMessageAvailable (CanBus bus) const |
| mockable bool | getMessage (CanBus bus, modm::can::Message *message) |
| mockable bool | isReadyToSend (CanBus bus) const |
| mockable bool | sendMessage (CanBus bus, const modm::can::Message &message) |
A simple CAN wrapper class that handles I/O from both CAN bus 1 and 2.
|
default |
|
default |
| bool tap::can::Can::getMessage | ( | CanBus | bus, |
| modm::can::Message * | message | ||
| ) |
Checks the CanBus for a message and if a message is successfully acquired, returns true and places the message in the return parameter message.
| [in] | bus | the CanBus to acquire a message from. |
| [out] | message | a return parameter which the message is placed in. |
| void tap::can::Can::initialize | ( | ) |
Initializes CAN 1 and CAN 2 hardware to pins specific to the development board and sets up the CAN bus filters necessary for reading from the CAN bus.
| bool tap::can::Can::isMessageAvailable | ( | CanBus | bus | ) | const |
Checks the passed in CanBus to see if there is a message waiting and available.
| [in] | bus | the CanBus to check for a message. |
| bool tap::can::Can::isReadyToSend | ( | CanBus | bus | ) | const |
Checks the given CanBus to see if the CanBus is idle.
| [in] | bus | the CanBus to check. |
| bool tap::can::Can::sendMessage | ( | CanBus | bus, |
| const modm::can::Message & | message | ||
| ) |
Sends the passed in message over the CanBus. Returns whether or not the message succeeded.
modm::can::Message defaults to an extended message identifier. For all RoboMaster products we have, we do not want our messages to be extended. Be sure to be explicit when instantiating a message object and setting extended to false.| [in] | bus | the CanBus for which the message should be sent across. |
| [in] | message | the message to send |