NetBurner 3.5.6
PDF Version |
MCAN Module Class. More...
#include <mcan.h>
Public Member Functions | |
mcan_module (Mcan *phw, uint32_t baud) | |
Create a MCAN module instance. | |
void | init (Mcan *phw, struct mcan_config *config, uint32_t baud) |
Initialize a MCAN module. | |
void | send_message (uint32_t id_value, uint8_t *data, uint32_t data_length, OS_SEM *pSem=0) |
Send a MCAN message. | |
bool | blocking_send_message (uint32_t id_value, uint8_t *data, uint32_t data_length, uint32_t TimeOut) |
Send a MCAN message and block until sent. | |
int | RegisterRxFifo (uint32_t composite_id, OS_FIFO *pFifo, int channel=-1) |
Register a FIFO to receive CAN messages. | |
int | RegisterRxFifoMask (uint32_t composite_id, uint32_t mask, OS_FIFO *pFifo, int channel=-1) |
Register a FIFO to receive messages as specified by the address bit mask. A value of 1 = match, a value of 0 = does not match. | |
int | RegisterRxFifoRange (uint32_t composite_id_low, uint32_t composite_id_hi, OS_FIFO *pFifo, int channel=-1) |
Register a FIFO to receive messages in the specified numeric range of addresses from low to high. | |
int | UnRegisterFifo (int channel) |
Unregister the FIFO for the specified CAN channel. | |
int | MultiCanSetRTRMessage (uint32_t id, uint8_t *data, uint8_t len, int channel=-1) |
Enable an auto-reply to a CAN RTR message for the specified CAN ID. The reply message is specified by the data parameter. | |
int | MultiCanReplaceRTRMessage (int channel, uint8_t *data, uint8_t len) |
Modifies/updates the response for the RTR message registered wotj MultiCanSetRTRMessage(). | |
int | MultiCanStopRTRMessage (int channel) |
Unregister the RTR message for the specified channel. | |
MCAN Module Class.
Class to control a MCAN modules (peripherals) on the MODM7AE70
mcanMODM7AE70::mcan_module::mcan_module | ( | Mcan * | phw, |
uint32_t | baud ) |
Create a MCAN module instance.
phw | MCAN hardware peripheral, MCAN0 or MCAN 1 |
baud | MCAN baud rate. For example, 500000 |
bool mcanMODM7AE70::mcan_module::blocking_send_message | ( | uint32_t | id_value, |
uint8_t * | data, | ||
uint32_t | data_length, | ||
uint32_t | TimeOut ) |
Send a MCAN message and block until sent.
id_value | CAN ID, 11-bit standard or 29-bit extended |
data | Pointer to message data |
data_length | Length of data in bytes |
TimeOut | Time out value in system time ticks. For example, TICKS_PER_SECOND * 1 |
void mcanMODM7AE70::mcan_module::init | ( | Mcan * | phw, |
struct mcan_config * | config, | ||
uint32_t | baud ) |
Initialize a MCAN module.
phw | MCAN hardware peripheral, MCAN0 or MCAN 1 |
config | Pointer to a mcan_config object, initialized with appropriate values. |
baud | MCAN baud rate. For example, 500000 |
int mcanMODM7AE70::mcan_module::MultiCanReplaceRTRMessage | ( | int | channel, |
uint8_t * | data, | ||
uint8_t | len ) |
Modifies/updates the response for the RTR message registered wotj MultiCanSetRTRMessage().
int mcanMODM7AE70::mcan_module::MultiCanSetRTRMessage | ( | uint32_t | id, |
uint8_t * | data, | ||
uint8_t | len, | ||
int | channel = -1 ) |
Enable an auto-reply to a CAN RTR message for the specified CAN ID. The reply message is specified by the data parameter.
The response message can be modified with MultiCanReplaceRTRMessage().
id | CAN ID, 11-bit standard or 29-bit extended |
data | Pointer to message data |
len | Length of message |
channel | Optional CAN channel |
int mcanMODM7AE70::mcan_module::MultiCanStopRTRMessage | ( | int | channel | ) |
Unregister the RTR message for the specified channel.
channel | CAN channel number |
int mcanMODM7AE70::mcan_module::RegisterRxFifo | ( | uint32_t | composite_id, |
OS_FIFO * | pFifo, | ||
int | channel = -1 ) |
Register a FIFO to receive CAN messages.
composite_id | CAN ID, 11-bit standard or 29-bit extended |
pFifo | Pointer to OS_FIFO for received data |
channel | Optional CAN channel |
int mcanMODM7AE70::mcan_module::RegisterRxFifoMask | ( | uint32_t | composite_id, |
uint32_t | mask, | ||
OS_FIFO * | pFifo, | ||
int | channel = -1 ) |
Register a FIFO to receive messages as specified by the address bit mask. A value of 1 = match, a value of 0 = does not match.
composite_id | CAN ID, 11-bit standard or 29-bit extended |
mask | Id mask |
pFifo | Pointer to OS_FIFO for received data |
channel | Optional CAN channel |
int mcanMODM7AE70::mcan_module::RegisterRxFifoRange | ( | uint32_t | composite_id_low, |
uint32_t | composite_id_hi, | ||
OS_FIFO * | pFifo, | ||
int | channel = -1 ) |
Register a FIFO to receive messages in the specified numeric range of addresses from low to high.
composite_id_low | Composite ID low value |
composite_id_hi | Composite ID high value |
pFifo | Pointer to OS_FIFO for received data |
channel | Optional CAN channel |
void mcanMODM7AE70::mcan_module::send_message | ( | uint32_t | id_value, |
uint8_t * | data, | ||
uint32_t | data_length, | ||
OS_SEM * | pSem = 0 ) |
Send a MCAN message.
id_value | CAN ID, 11-bit standard or 29-bit extended |
data | Pointer to message data |
data_length | Length of data in bytes |
pSem | Optional pointer to semaphore to post to, default is no post |
int mcanMODM7AE70::mcan_module::UnRegisterFifo | ( | int | channel | ) |
Unregister the FIFO for the specified CAN channel.
channel | CAN channel number |