20#include "platform/platform.h"
22#if DEVICE_CAN || defined(DOXYGEN_ONLY)
24#include "interfaces/InterfaceCAN.h"
25#include "hal/can_api.h"
26#include "platform/Callback.h"
27#include "rtos/Mutex.h"
40#ifdef FEATURE_EXPERIMENTAL_API
90 CAN(PinName rd, PinName td);
99 CAN(PinName rd, PinName td,
int hz,
int data_hz = 0);
209 int filter(
unsigned int id,
unsigned int mask,
CANFormat format = CANAny,
int handle = 0);
233 static void _irq_handler(uintptr_t context, CanIrqType type);
235#if !defined(DOXYGEN_ONLY)
238 virtual void unlock();
241 Callback<void()> _irq[IrqType::IrqCnt];
A can bus client, used for communicating with can devices.
CAN(PinName rd, PinName td, int hz, int data_hz=0)
Initialize CAN interface and set the frequency.
unsigned char rderror()
Detects read errors - Used to detect read overflow errors.
CAN(PinName rd, PinName td)
Creates a CAN interface connected to specific pins.
CAN(const can_pinmap_t &pinmap, int hz, int data_hz=0)
Initialize CAN interface and set the frequency.
int write(CANFDMessage msg)
Write a CANFDMessage to the bus.
int write(CANMessage msg)
Write a CANMessage to the bus.
int mode(Mode mode)
Change CAN operation to the specified mode.
void monitor(bool silent)
Puts or removes the CAN interface into silent monitoring mode.
unsigned char tderror()
Detects write errors - Used to detect write overflow errors.
int frequency(int hz, int data_hz=0)
Set the frequency of the CAN interface.
int filter(unsigned int id, unsigned int mask, CANFormat format=CANAny, int handle=0)
Filter out incoming messages.
void reset()
Reset CAN interface.
int read(CANFDMessage &msg, int handle=0)
Read a CANFDMessage from the bus.
void attach(Callback< void()> func, IrqType type=IrqType::RxIrq)
Attach a function to call whenever a CAN frame received interrupt is generated.
int read(CANMessage &msg, int handle=0)
Read a CANMessage from the bus.
CAN(const can_pinmap_t &pinmap)
Initialize CAN interface.
Callback class based on template specialization.
The Mutex class is used to synchronize the execution of threads.
CANFormat
Values that represent CAN Format.