Skip to content

Question about CAN abstractions #657

Open
@robamu

Description

@robamu

I have a few question and possibly improvement suggestions for the CAN library

  1. Is there a special reasons why the CAN frame trait contains constructors? How would those be used, and be better than more explicit custom constructors for the actual frame types inside libraries?

  2. For device drivers, the transmit function already assumes a constructed frame, and for reception.. Wouldn't an API just expect the user to somehow take care of polling CAN frames and pass them to the driver? Maybe it would make more sense to have something like CanTx trait which only provided transmit functions, and possibly a specialized CanRx? I still think it is easier for device drivers to just assume the user takes care of polling CAN frames, and offer an API which consumes frames (probably re-using the CAN frame trait to remain generic)

  3. Any reason not to provide a default implementation for Frame::is_extended?

    /// Returns true if this frame is an extended frame.
    fn is_extended(&self) -> bool {
        match self.id() {
            Id::Standard(_) => false,
            Id::Extended(_) => true,
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions