Crates.io | can-bit-timings |
lib.rs | can-bit-timings |
version | 1.1.0 |
source | src |
created_at | 2021-02-21 11:00:42.013154 |
updated_at | 2021-02-22 16:22:25.940526 |
description | This is a procedural macro to calculate CAN bus timings |
homepage | |
repository | https://github.com/ASMfreaK/can_bit_timings |
max_upload_size | |
id | 358465 |
size | 25,854 |
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
#[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();
}