Autogenerate the tailored PAC for each chip

This commit is contained in:
Dario Nieuwenhuis
2021-05-06 03:43:46 +02:00
parent 111dad613a
commit 23ca2f9174
302 changed files with 62050 additions and 50394 deletions

View File

@ -1,4 +1,4 @@
use crate::pac::rng_v1::{regs, Rng};
use crate::pac::rng::{regs, Rng};
use crate::peripherals;
use embassy::util::Unborrow;
use embassy_extras::unborrow;
@ -8,26 +8,23 @@ pub struct Random<T: Instance> {
}
impl<T: Instance> Random<T> {
pub fn new(inner: impl Unborrow<Target=T>) -> Self {
pub fn new(inner: impl Unborrow<Target = T>) -> Self {
unborrow!(inner);
Self {
inner,
}
Self { inner }
}
}
use embassy::traits::rng::Rng as RngTrait;
use core::future::Future;
use core::marker::PhantomData;
use embassy::traits::rng::Rng as RngTrait;
impl<T:Instance> RngTrait for Random<T> {
impl<T: Instance> RngTrait for Random<T> {
type Error = ();
type RngFuture<'a> where Self: 'a = impl Future<Output=Result<(), Self::Error>>;
#[rustfmt::skip]
type RngFuture<'a> where Self: 'a = impl Future<Output = Result<(), Self::Error>>;
fn fill<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a> {
async move {
Ok(())
}
async move { Ok(()) }
}
}
@ -42,13 +39,13 @@ pub(crate) mod sealed {
pub trait Instance: sealed::Instance {}
macro_rules! impl_rng {
($addr:expr) => {
impl crate::rng::sealed::Instance for peripherals::RNG {
fn regs(&self) -> crate::pac::rng_v1::Rng {
crate::pac::rng_v1::Rng($addr as _)
($inst:ident) => {
impl crate::rng::sealed::Instance for peripherals::$inst {
fn regs(&self) -> crate::pac::rng::Rng {
crate::pac::$inst
}
}
impl crate::rng::Instance for peripherals::RNG {}
}
}
impl crate::rng::Instance for peripherals::$inst {}
};
}