|
| CAN (PinName rd, PinName td) |
| Creates a CAN interface connected to specific pins.
|
|
| CAN (PinName rd, PinName td, int hz) |
| Initialize CAN interface and set the frequency.
|
|
| CAN (const can_pinmap_t &pinmap) |
| Initialize CAN interface.
|
|
| CAN (const can_pinmap_t &pinmap, int hz) |
| Initialize CAN interface and set the frequency.
|
|
int | frequency (int hz) |
| Set the frequency of the CAN interface.
|
|
int | write (CANMessage msg) |
| Write a CANMessage to the bus.
|
|
int | read (CANMessage &msg, int handle=0) |
| Read a CANMessage from the bus.
|
|
void | reset () |
| Reset CAN interface.
|
|
void | monitor (bool silent) |
| Puts or removes the CAN interface into silent monitoring mode.
|
|
int | mode (Mode mode) |
| Change CAN operation to the specified mode.
|
|
int | filter (unsigned int id, unsigned int mask, CANFormat format=CANAny, int handle=0) |
| Filter out incoming messages.
|
|
unsigned char | rderror () |
| Detects read errors - Used to detect read overflow errors.
|
|
unsigned char | tderror () |
| Detects write errors - Used to detect write overflow errors.
|
|
void | attach (Callback< void()> func, IrqType type=IrqType::RxIrq) |
| Attach a function to call whenever a CAN frame received interrupt is generated.
|
|
Creates an unlocked CAN interface connected to specific pins.
Example:
#include "mbed.h"
RawCAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD);
RawCAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD);
unsigned char counter = 0;
void send() {
printf("Message sent: %d\n", counter);
counter++;
}
led1 = !led1;
}
int main() {
CANMessage msg;
while(1) {
if(can2.read(msg)) {
printf("Message received: %d\n\n", msg.data[0]);
led2 = !led2;
}
ThisThread::sleep_for(200);
}
}
A digital output, used for setting the state of a pin.
Creates an unlocked CAN interface connected to specific pins.
MBED_FORCEINLINE void attach(F &&func, float t)
Attach a function to be called by the Ticker, specifying the interval in seconds.
Definition at line 73 of file RawCAN.h.