Skip to content

Commit

Permalink
Fix example in readme to use unsafe block.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Jul 22, 2024
1 parent 0a1ea3a commit db9ec33
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ System Real Time Clock (RTC) Drivers for aarch64 based on PL031.
```rust
use arm_pl031::Rtc;

let epoch_time = Rtc::new(0x901_0000).get_unix_timestamp();
let rtc = unsafe { Rtc::new(0x901_0000 as _) };
let epoch_time = rtc.get_unix_timestamp();
```

`base_addr` needs to be the device virtual address available for mmio, which can be obtained from the device tree, for example:
`base_addr` needs to be the device virtual address available for mmio, which can be obtained from
the device tree, for example:

```
/ {
Expand All @@ -32,4 +34,4 @@ let epoch_time = Rtc::new(0x901_0000).get_unix_timestamp();
...
}
```
```

0 comments on commit db9ec33

Please sign in to comment.