rt-mcp2517
Rust no_std library for MCP2517FD CAN controller
Crate currently offers the following features:
- CAN2.0 and CAN FD format support
- Standard and extended ID formats for CAN frames
no_stdsupport
Example
use ;
use ;
use ;
use Filter;
use *;
use Bytes;
use ;
let cs_pin = ExampleCSPin;
let spi_bus = default ;
let clock = default ;
let mut controller = MCP2517new;
// configure CAN controller
controller
.configure.unwrap;
// Create message frame
let can_id = Standard;
// Important note: Generic arg for message type for CAN2.0
// should be either 4 or 8, the DLC will be based off the
// length of the payload buffer. So for a payload of 5 bytes
// you can only use Can20::<8> as the message type
let message_type = ;
let payload = ;
let pl_bytes = copy_from_slice;
let can_message = new.unwrap;
// Create and set filter object
let filter = new.unwrap;
let _ = controller.set_filter_object;
// Transmit CAN message
controller.transmit.unwrap;
// Receive CAN message
let mut buff = ;
let result = controller.receive;
assert!;
assert_eq!;
Development
Any form of support is greatly appreciated. Feel free to create issues and PRs. See DEVELOPMENT for more details.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Each contributor agrees that his/her contribution covers both licenses.