Adjust pin-names to FooPin.

Move common bits up to spi/mod.rs.
Isolate the RNG interrupt in a sub-module to avoid conflict with the const.
This commit is contained in:
Bob McWhirter
2021-05-14 10:11:43 -04:00
parent 9e93a0999f
commit 2569d38ab4
201 changed files with 14694 additions and 14765 deletions

View File

@ -2,18 +2,22 @@
use core::future::Future;
use core::task::Poll;
use defmt::*;
use embassy::traits;
use embassy::util::{AtomicWaker, Unborrow};
use embassy_extras::unborrow;
use futures::future::poll_fn;
use rand_core::{CryptoRng, RngCore};
//Guse crate::interrupt;
use crate::interrupt;
use crate::pac;
pub(crate) static RNG_WAKER: AtomicWaker = AtomicWaker::new();
pub enum Error {
SeedError,
ClockError,
}
pub struct Random<T: Instance> {
inner: T,
}
@ -75,11 +79,6 @@ impl<T: Instance> RngCore for Random<T> {
impl<T: Instance> CryptoRng for Random<T> {}
pub enum Error {
SeedError,
ClockError,
}
impl<T: Instance> traits::rng::Rng for Random<T> {
type Error = Error;
#[rustfmt::skip]
@ -146,12 +145,16 @@ macro_rules! impl_rng {
impl crate::rng::Instance for peripherals::RNG {}
#[$crate::interrupt]
unsafe fn $irq() {
let bits = $crate::pac::RNG.sr().read();
if bits.drdy() || bits.seis() || bits.ceis() {
$crate::pac::RNG.cr().write(|reg| reg.set_ie(false));
$crate::rng::RNG_WAKER.wake();
mod rng_irq {
use crate::interrupt;
#[interrupt]
unsafe fn $irq() {
let bits = $crate::pac::RNG.sr().read();
if bits.drdy() || bits.seis() || bits.ceis() {
$crate::pac::RNG.cr().write(|reg| reg.set_ie(false));
$crate::rng::RNG_WAKER.wake();
}
}
}
};