#convenience #timing #can-bus #bit #proc-macro #mcu #can-bit-timings

no-std can-bit-timings-core

This package is a common dependency for can-bit-timings and can-bit-timings-proc-macro

4 stable releases

1.1.0 Feb 22, 2021
1.0.2 Feb 22, 2021
1.0.0 Feb 21, 2021

#9 in #can-bus

Download history 9/week @ 2024-02-19 20/week @ 2024-02-26 1/week @ 2024-03-04 11/week @ 2024-03-11 60/week @ 2024-04-01

72 downloads per month
Used in 2 crates

MPL-2.0 license

4KB

can_bit_timings

CI Crates.io

This is a procedural macro (originally a constexpr function (const fn)) to calculate CAN bus timings for different STM32 MCUs bxcan module. It can be useful to calculate timings for different MCUs, but one should write a function formatting the calculated values into appropriate register value.

This project is based on a similar piece of code from modm project. You can find out more on bit timings here

Example:

#[no-std]
use can_bus_timings::can_timings_bxcan;

const fn can0_timings() -> u32{
    can_timings_bxcan!(10.mhz(), 1.mhz())
}

fn main(){
    // ... CAN hardware initialization
    can0_timings();
}

No runtime deps