index: add example for rust
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
265e6eae3f
commit
b1a2d25642
14
index.html
14
index.html
@ -387,6 +387,20 @@ dq.o.eq(
|
||||
|
||||
<section>
|
||||
<h2>SVD2Rust: Generating Safe Accessors</h2>
|
||||
<pre><code class="rust">fn init(&mut self) {
|
||||
self.registers
|
||||
.ctrl
|
||||
.write(|w| w.exe().bit(true).curren().bit(true).rgbleden().bit(true));
|
||||
self.write(LEDDEN | FR250 | QUICK_STOP, LedRegister::LEDDCR0);
|
||||
|
||||
// Set clock register to 12 MHz / 64 kHz - 1
|
||||
self.write(((12_000_000u32 / 64_000u32) - 1) as u8, LedRegister::LEDDBR);
|
||||
|
||||
self.write(
|
||||
BREATHE_ENABLE | BREATHE_MODE_FIXED | breathe_rate_ms(128),
|
||||
LedRegister::LEDDBCRR,
|
||||
);
|
||||
}</code></pre>
|
||||
<aside class="notes">
|
||||
In addition to generating a reference manual for humans, we can generate an SVD
|
||||
file that's usable in a wide variety of areas. For example, we can turn an SVD
|
||||
|
Loading…
Reference in New Issue
Block a user