You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/interoperability/c-with-rust.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ For projects with limited dependencies or complexity, or for projects where it i
120
120
121
121
In the simplest case of compiling a single C file as a dependency to a static library, an example `build.rs` script using the [`cc` crate] would look like this:
This structure allows us to obtain a single instance of our peripheral. If we try to call `take_serial()` more than once, our code will panic!
46
46
47
-
```rust
47
+
```rust,ignore
48
48
fn main() {
49
49
let serial_1 = unsafe { PERIPHERALS.take_serial() };
50
50
// This panics!
@@ -60,7 +60,7 @@ This has a small runtime overhead because we must wrap the `SerialPort` structur
60
60
61
61
Although we created our own `Peripherals` structure above, it is not necessary to do this for your code. the `cortex_m` crate contains a macro called `singleton!()` that will perform this action for you.
62
62
63
-
```rust
63
+
```rust,ignore
64
64
#[macro_use(singleton)]
65
65
extern crate cortex_m;
66
66
@@ -116,7 +116,7 @@ There are two important factors in play here:
116
116
117
117
These two factors put together means that it is only possible to access the hardware if we have appropriately satisfied the borrow checker, meaning that at no point do we have multiple mutable references to the same hardware!
Copy file name to clipboardexpand all lines: src/start/registers.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ You may well find that the code you need to access the peripherals in your micro
21
21
22
22
Let's look at the SysTick peripheral that's common to all Cortex-M based micro-controllers. We can find a pretty low-level API in the [cortex-m] crate, and we can use it like this:
23
23
24
-
```rust
24
+
```rust,ignore
25
25
use cortex_m::peripheral::{syst, Peripherals};
26
26
use cortex_m_rt::entry;
27
27
@@ -125,7 +125,7 @@ The HAL crate for a chip typically works by implementing a custom Trait for the
0 commit comments