Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/gpio.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! General Purpose Input / Output
use core::marker::PhantomData;

use crate::rcc::Rcc;
use crate::rcc::{Enable, Rcc, Reset};
use crate::stm32::EXTI;
use crate::syscfg::SysCfg;

Expand All @@ -14,7 +14,7 @@ pub trait GpioExt {
type Parts;

/// Splits the GPIO block into independent pins and registers
fn split(self, rcc: &mut Rcc) -> Self::Parts;
fn split(self, rcc: &Rcc) -> Self::Parts;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, unrelated to #180, since Enable::enable and Reset::reset use bit banding, we do not need exclusive access to the rcc right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove this and perhaps do that later

}

/// Input mode (type state)
Expand Down Expand Up @@ -256,8 +256,10 @@ macro_rules! gpio {
impl GpioExt for $GPIOX {
type Parts = Parts;

fn split(self, rcc: &mut Rcc) -> Parts {
rcc.rb.ahb2enr.modify(|_, w| w.$iopxenr().set_bit());
fn split(self, rcc: &Rcc) -> Parts {
$GPIOX::enable(&rcc.rb);
$GPIOX::reset(&rcc.rb);

Parts {
$(
$pxi: $PXi { _mode: PhantomData },
Expand Down
Loading