Skip to main content

Class Mcp2515.Mcp2515CanBus

Represents a CAN bus using the MCP2515

Assembly: Mcp2515.dll
View Source
Declaration
public class Mcp2515.Mcp2515CanBus : ICanBus

Implements:
Meadow.Hardware.ICanBus

Properties

BitRate

Gets or sets the bus bit rate

View Source
Declaration
public CanBitrate BitRate { get; set; }

AcceptanceFilters

The collection of message acceptance filters for the bus

View Source
Declaration
public CanAcceptanceFilterCollection AcceptanceFilters { get; }

Methods

IsFrameAvailable()

Checks if a CAN frame is available to read.

View Source
Declaration
public bool IsFrameAvailable()
Returns

System.Boolean: true if a frame is available; otherwise, false.### WriteFrame(ICanFrame) Writes a CAN frame to the specified buffer.

View Source
Declaration
public void WriteFrame(ICanFrame frame)
Parameters
TypeNameDescription
Meadow.Hardware.ICanFrameframeThe CAN frame to write.

ReadFrame()

Reads a CAN frame.

View Source
Declaration
public ICanFrame? ReadFrame()
Returns

Meadow.Hardware.ICanFrame: The CAN frame if available; otherwise, null.### ClearReceiveBuffers() Clears any data currently in the bus receive buffers

View Source
Declaration
public void ClearReceiveBuffers()

Events

FrameReceived

Raised when a CAN frame is received.

View Source
Declaration
public event EventHandler<ICanFrame>? FrameReceived
Event Type

System.EventHandler<Meadow.Hardware.ICanFrame>

BusError

Raised when a bus error occurs

View Source
Declaration
public event EventHandler<CanErrorInfo>? BusError
Event Type

System.EventHandler<Meadow.Hardware.CanErrorInfo>

Implements

  • Meadow.Hardware.ICanBus