Rename PeripheralBorrow to Unborrow

This commit is contained in:
Dario Nieuwenhuis
2021-04-14 19:59:52 +02:00
parent bac53e3e55
commit 97ca54fa66
12 changed files with 61 additions and 64 deletions

View File

@ -5,7 +5,7 @@ use crate::pac::generic::{Reg, RW};
use crate::pac::SIO;
use crate::peripherals;
use embassy::util::PeripheralBorrow;
use embassy::util::Unborrow;
use embassy_extras::{impl_unborrow, unborrow};
use embedded_hal::digital::v2::{InputPin, OutputPin, StatefulOutputPin};
@ -37,7 +37,7 @@ pub struct Input<'d, T: Pin> {
}
impl<'d, T: Pin> Input<'d, T> {
pub fn new(pin: impl PeripheralBorrow<Target = T> + 'd, pull: Pull) -> Self {
pub fn new(pin: impl Unborrow<Target = T> + 'd, pull: Pull) -> Self {
unborrow!(pin);
unsafe {
@ -91,7 +91,7 @@ pub struct Output<'d, T: Pin> {
impl<'d, T: Pin> Output<'d, T> {
// TODO opendrain
pub fn new(pin: impl PeripheralBorrow<Target = T> + 'd, initial_output: Level) -> Self {
pub fn new(pin: impl Unborrow<Target = T> + 'd, initial_output: Level) -> Self {
unborrow!(pin);
unsafe {

View File

@ -1,6 +1,6 @@
use core::marker::PhantomData;
use embassy::util::PeripheralBorrow;
use embassy::util::Unborrow;
use embassy_extras::unborrow;
use gpio::Pin;
@ -30,11 +30,11 @@ pub struct Uart<'d, T: Instance> {
impl<'d, T: Instance> Uart<'d, T> {
pub fn new(
inner: impl PeripheralBorrow<Target = T>,
tx: impl PeripheralBorrow<Target = impl TxPin<T>>,
rx: impl PeripheralBorrow<Target = impl RxPin<T>>,
cts: impl PeripheralBorrow<Target = impl CtsPin<T>>,
rts: impl PeripheralBorrow<Target = impl RtsPin<T>>,
inner: impl Unborrow<Target = T>,
tx: impl Unborrow<Target = impl TxPin<T>>,
rx: impl Unborrow<Target = impl RxPin<T>>,
cts: impl Unborrow<Target = impl CtsPin<T>>,
rts: impl Unborrow<Target = impl RtsPin<T>>,
config: Config,
) -> Self {
unborrow!(inner, tx, rx, cts, rts);