Mbed OS Reference
|
Creates an unlocked CAN interface connected to specific pins. More...
#include <RawCAN.h>
Public Member Functions | |
CAN (PinName rd, PinName td) | |
Creates a CAN interface connected to specific pins. More... | |
CAN (PinName rd, PinName td, int hz) | |
Initialize CAN interface and set the frequency. More... | |
CAN (const can_pinmap_t &pinmap) | |
Initialize CAN interface. More... | |
CAN (const can_pinmap_t &pinmap, int hz) | |
Initialize CAN interface and set the frequency. More... | |
int | frequency (int hz) |
Set the frequency of the CAN interface. More... | |
int | write (CANMessage msg) |
Write a CANMessage to the bus. More... | |
int | read (CANMessage &msg, int handle=0) |
Read a CANMessage from the bus. More... | |
void | reset () |
Reset CAN interface. More... | |
void | monitor (bool silent) |
Puts or removes the CAN interface into silent monitoring mode. More... | |
int | mode (Mode mode) |
Change CAN operation to the specified mode. More... | |
int | filter (unsigned int id, unsigned int mask, CANFormat format=CANAny, int handle=0) |
Filter out incoming messages. More... | |
unsigned char | rderror () |
Detects read errors - Used to detect read overflow errors. More... | |
unsigned char | tderror () |
Detects write errors - Used to detect write overflow errors. More... | |
void | attach (Callback< void()> func, IrqType type=IrqType::RxIrq) |
Attach a function to call whenever a CAN frame received interrupt is generated. More... | |
Creates an unlocked CAN interface connected to specific pins.
Example:
CAN | ( | PinName | rd, |
PinName | td | ||
) |
Creates a CAN interface connected to specific pins.
rd | read from transmitter |
td | transmit to transmitter |
Example:
CAN | ( | PinName | rd, |
PinName | td, | ||
int | hz | ||
) |
Initialize CAN interface and set the frequency.
rd | the read pin |
td | the transmit pin |
hz | the bus frequency in hertz |
CAN | ( | const can_pinmap_t & | pinmap | ) |
Initialize CAN interface.
pinmap | reference to structure which holds static pinmap |
CAN | ( | const can_pinmap_t & | pinmap, |
int | hz | ||
) |
Initialize CAN interface and set the frequency.
pinmap | reference to structure which holds static pinmap |
hz | the bus frequency in hertz |
|
inherited |
Set the frequency of the CAN interface.
hz | The bus frequency in hertz |
|
inherited |
Write a CANMessage to the bus.
msg | The CANMessage to write. |
|
inherited |
Read a CANMessage from the bus.
msg | A CANMessage to read to. |
handle | message filter handle (0 for any message) |
|
inherited |
Reset CAN interface.
To use after error overflow.
|
inherited |
Puts or removes the CAN interface into silent monitoring mode.
silent | boolean indicating whether to go into silent mode or not |
|
inherited |
Change CAN operation to the specified mode.
mode | The new operation mode (CAN::Normal, CAN::Silent, CAN::LocalTest, CAN::GlobalTest, CAN::SilentTest) |
|
inherited |
Filter out incoming messages.
id | the id to filter on |
mask | the mask applied to the id |
format | format to filter on (Default CANAny) |
handle | message filter handle (Optional) |
|
inherited |
Detects read errors - Used to detect read overflow errors.
|
inherited |
Detects write errors - Used to detect write overflow errors.
|
inherited |
Attach a function to call whenever a CAN frame received interrupt is generated.
This function locks the deep sleep while a callback is attached
func | A pointer to a void function, or 0 to set as none |
type | Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, CAN::TxIrq for transmitted or aborted, CAN::EwIrq for error warning, CAN::DoIrq for data overrun, CAN::WuIrq for wake-up, CAN::EpIrq for error passive, CAN::AlIrq for arbitration lost, CAN::BeIrq for bus error) |