pamoja-can
CAN bus framing for pamoja: classic CAN 2.0 and CAN-FD frames with 11-bit and 29-bit identifiers and the discrete CAN-FD length encoding, plus J1939 identifier decoding for trucks, tractors, and gensets, no_std and allocation-free. The framing half ahead of the CAN controller.
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-can |
reference, docs.rs, install |
| TypeScript | @pamoja/can |
reference, install |
| Python | pamoja-can |
reference, install |
| C# | Pamoja.Can |
reference, install |
CAN bus framing for the pamoja SDK.
CAN is the bus that connects the moving parts of a machine: motor controllers, servos, battery management, and the engines, gensets, and farm equipment that speak J1939 on top of it. It is how a robot or a vehicle's pieces talk to each other reliably over a short, noisy two-wire link, which is why it is the SDK's path to actuators and to the diesel-and-hydraulic world of rural machinery.
This crate is the byte layer for that, with no controller and no allocation:
CanId- a standard 11-bit or extended 29-bit identifier, always masked to width.Frame- a classic CAN 2.0 frame, a CAN-FD frame at the discrete CAN-FD lengths, or a remote frame, withlen_to_dlcanddlc_to_lenfor the length encoding CAN-FD uses above eight bytes.J1939Id- the priority, parameter group, and addresses J1939 packs into a 29-bit identifier, decoded from one and composed back into one.
The controller hardware handles the wire itself (arbitration, bit timing, the frame CRC); this is the identifier and payload layer above it, the part an application actually reasons about. Driving a real controller arrives with the hardware-I/O layer.
Examples
use ;
// Build a classic frame for a motor controller.
let frame = new.unwrap;
assert_eq!;
// Decode an engine-speed broadcast from a J1939 genset.
let message = from_id.unwrap;
assert_eq!;
assert!;
License
MIT - part of the pamoja workspace: one memory-safe Rust core with bindings for every language.