Skip to main content

Crate cansimple

Crate cansimple 

Source
Expand description

§CANSimple

An implementation of the CANSimple identifier scheme mainly used by ODrive products.

§Features

  • defmt-1 enables defmt formatting on relevant types.

§Overview

The CANsimple protocol uses only 11-bit identifiers and features a node and command components.

| 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Node ID                | Command ID        |

A full explanation can be found in the ODrive documentation.

§Examples

Identifiers can be created from either raw ids or from node and command ids.

// From components
let id = cansimple::Id::new(1, 15).unwrap();

// From raw id
let id = cansimple::Id::from_raw(0x029);

CANsimple identifers can be converted to and from embedded_can identifers.

let id = cansimple::Id::new(1, 15).unwrap();
let embedded_id: embedded_can::Id = id.into();

Structs§

Id
CANsimple identifier.