Question about CAN abstractions

未关闭
#657 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
rust
领域
embedded-iot

调研方向

Start by reading the CAN frame trait, especially its constructors and Frame::is_extended, then inspect the device-driver transmit and reception APIs. Compare the current abstractions with the proposed CanTx and CanRx split. Done would require an agreed API design and corresponding implementation scope, which the issue does not yet define.

由索引模型根据 Issue 内容生成。

描述

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,
        }
    }
    
主要语言
Rust
星标
2.7k
派生
283
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rust-embedded/embedded-hal 的其他 Issue

查看 rust-embedded/embedded-hal 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。