You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Andre Richter 0ce1cde72c Add Deref trait in the spirit of cortex-m peripherals
Improves code readability; Reduces need for unsafe blocks on register
reads.

https://github.com/japaric/cortex-m/blob/master/src/peripheral/mod.rs
7 years ago
..
raspi3_glue Introduce abstraction tut, shuffle tut numbers again 7 years ago
src Add Deref trait in the spirit of cortex-m peripherals 7 years ago
Cargo.lock Introduce abstraction tut, shuffle tut numbers again 7 years ago
Cargo.toml Introduce abstraction tut, shuffle tut numbers again 7 years ago
Makefile Introduce abstraction tut, shuffle tut numbers again 7 years ago
README.md Introduce abstraction tut, shuffle tut numbers again 7 years ago
aarch64-raspi3-none-elf.json Introduce abstraction tut, shuffle tut numbers again 7 years ago
kernel8.img Add Deref trait in the spirit of cortex-m peripherals 7 years ago
link.ld Introduce abstraction tut, shuffle tut numbers again 7 years ago

README.md

Tutorial 08 - Hardware Random Number Generator

This going to be an easy tutorial. We query a number from the (undocumented) hardware random number generator. You can use this to implement a simple, but accurate dice throw in any game. It is important as without hardware support you can only generate pseudo-random numbers.

rand.s

Rng::init(&self) initializes the hardware.

Rng::rand(&self, min: u32, max: u32) returns a random number between min and max.

main.rs

Press a key to query a random value and then display it on the serial console.