2 ms·
It is useful in embedded. For example, you may see something like [1]: let _clocks = rcc .cfgr .hse(HSEClock::new(25_000_000.Hz(), HSEClock
by pca006132 5y ago
It is useful in embedded. For example, you may see something like [1]:
let _clocks = rcc
.cfgr
.hse(HSEClock::new(25_000_000.Hz(), HSEClockMode::Bypass))
.sysclk(216_000_000.Hz())
.hclk(216_000_000.Hz())
.freeze();
where the freeze function does a lot of calculation to set up the peripheral [2].
[1]: https://github.com/stm32-rs/stm32f7xx-hal/blob/0a0d06d5f63c3a1471362370fdfb8c367207d308/examples/can-echo.rs#L28-L33 https://github.com/stm32-rs/stm32f7xx-hal/blob/0a0d06d5f63c3...
[2]: https://github.com/stm32-rs/stm32f7xx-hal/blob/0a0d06d5f63c3a1471362370fdfb8c367207d308/src/rcc.rs#L746 https://github.com/stm32-rs/stm32f7xx-hal/blob/0a0d06d5f63c3...
- dralley 5y agoIt would be the same for named arguments, yes? Only it would be the constructor doing the set-up work.