Skip to content

Commit ff99276

Browse files
committed
generic_or_fixed
1 parent 102a33a commit ff99276

File tree

4 files changed

+340
-222
lines changed

4 files changed

+340
-222
lines changed

src/fmpi2c.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::ops::Deref;
22

3-
use crate::gpio::{self, OpenDrain};
3+
use crate::gpio;
44
use crate::i2c::{Error, NoAcknowledgeSource};
55
use crate::pac::{fmpi2c1, FMPI2C1, RCC};
66
use crate::rcc::{Enable, Reset};
@@ -21,8 +21,8 @@ pub trait Instance:
2121
}
2222

2323
impl Instance for FMPI2C1 {
24-
type Sda = gpio::alt::fmpi2c1::Sda<OpenDrain>;
25-
type Scl = gpio::alt::fmpi2c1::Scl<OpenDrain>;
24+
type Sda = gpio::alt::fmpi2c1::Sda;
25+
type Scl = gpio::alt::fmpi2c1::Scl;
2626
fn ptr() -> *const fmpi2c1::RegisterBlock {
2727
FMPI2C1::ptr() as *const _
2828
}

src/gpio.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ pub trait PinExt {
105105
}
106106

107107
/// Some alternate mode (type state)
108+
#[derive(Debug, Default)]
109+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
108110
pub struct Alternate<const A: u8, Otype = PushPull>(PhantomData<Otype>);
109111

110112
/// Input mode (type state)
113+
#[derive(Debug, Default)]
114+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
111115
pub struct Input;
112116

113117
/// Pull setting for an input.
@@ -123,17 +127,25 @@ pub enum Pull {
123127
}
124128

125129
/// Open drain input or output (type state)
130+
#[derive(Debug, Default)]
131+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
126132
pub struct OpenDrain;
127133

128134
/// Output mode (type state)
135+
#[derive(Debug, Default)]
136+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
129137
pub struct Output<MODE = PushPull> {
130138
_mode: PhantomData<MODE>,
131139
}
132140

133141
/// Push pull output (type state)
142+
#[derive(Debug, Default)]
143+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
134144
pub struct PushPull;
135145

136146
/// Analog mode (type state)
147+
#[derive(Debug, Default)]
148+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
137149
pub struct Analog;
138150

139151
/// JTAG/SWD mote (type state)

0 commit comments

Comments
 (0)