Skip to main content

Module can

Module can 

Source
Expand description

The C ABI for CAN bus framing.

These functions wrap [pamoja_can] for callers that reach the SDK through the flat C boundary: classic CAN 2.0 and CAN-FD frames, the length encoding CAN-FD uses above eight bytes, and the J1939 identifier that trucks, tractors, and gensets ride on top of it.

A frame carries a payload of up to 64 bytes, so it crosses as an opaque handle like every other payload-bearing type here. A J1939 identifier is only scalars, so it crosses by value as PamojaJ1939Id, which keeps decoding an identifier free of any allocation.

Structs§

PamojaCanFrame
An opaque handle to a CAN frame.
PamojaJ1939Id
The fields J1939 packs into an extended CAN identifier.
PamojaJ1939Signals
The eight data bytes of a J1939 frame, addressed by the signals inside them.

Constants§

PAMOJA_J1939_BROADCAST_ADDRESS
The destination address every node on the bus reads.
PAMOJA_J1939_NOT_AVAILABLE
The byte a J1939 sender writes for a signal it is not reporting.
PAMOJA_J1939_PRIORITY_CONTROL
The priority a control message takes, ahead of ordinary traffic.
PAMOJA_J1939_PRIORITY_DEFAULT
The priority ordinary traffic takes.
PAMOJA_J1939_PRIORITY_LOWEST
The priority that yields to everything else on the bus.

Functions§

pamoja_can_dlc_to_len
Returns the payload length a data length code encodes.
pamoja_can_frame_data
Returns a pointer to a frame’s payload bytes.
pamoja_can_frame_data_len
Returns how many bytes pamoja_can_frame_data points to.
pamoja_can_frame_dlc
Returns a frame’s data length code, the length as it appears on the wire.
pamoja_can_frame_fd
Builds a CAN-FD frame.
pamoja_can_frame_free
Releases a frame handle.
pamoja_can_frame_id
Returns a frame’s identifier, already masked to 11 or 29 bits.
pamoja_can_frame_is_extended
Reports whether a frame carries a 29-bit extended identifier.
pamoja_can_frame_is_fd
Reports whether a frame is CAN-FD rather than classic CAN 2.0.
pamoja_can_frame_is_remote
Reports whether a frame is a remote transmission request.
pamoja_can_frame_len
Returns how many payload bytes a frame carries.
pamoja_can_frame_new
Builds a classic CAN 2.0 frame.
pamoja_can_frame_remote
Builds a remote transmission request, which asks another node to send.
pamoja_can_j1939_broadcast
Composes the identifier of a J1939 broadcast, which every node on the bus reads.
pamoja_can_j1939_compose
Composes the extended CAN identifier a set of J1939 fields describes.
pamoja_can_j1939_decode
Decodes the J1939 fields out of an extended CAN identifier.
pamoja_can_len_to_dlc
Returns the data length code that encodes a payload length.
pamoja_can_signals_new
Builds a J1939 payload with every signal marked not available.
pamoja_can_signals_set_u8
Writes a one-byte signal at the offset its parameter group defines.
pamoja_can_signals_set_u16
Writes a two-byte little-endian signal at the offset its group defines.
pamoja_can_signals_u8
Reads a one-byte signal at the offset its parameter group defines.
pamoja_can_signals_u16
Reads a two-byte little-endian signal at the offset its group defines.