Skip to content

Commit 931e9ba

Browse files
committed
Remove dead code
1 parent 67965e5 commit 931e9ba

File tree

2 files changed

+0
-204
lines changed

2 files changed

+0
-204
lines changed

src/comparator.rs

Lines changed: 0 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,6 @@ impl Config {
124124
self.inverted = inverted;
125125
self
126126
}
127-
128-
/*
129-
pub fn power_mode(mut self, power_mode: PowerMode) -> Self {
130-
self.power_mode = power_mode;
131-
self
132-
}*/
133-
134-
/*
135-
/// Sets the output to be Comparator 1 XOR Comparator 2.
136-
/// Used to implement window comparator mode.
137-
pub fn output_xor(mut self) -> Self {
138-
self.output_xor = true;
139-
self
140-
}*/
141127
}
142128

143129
#[derive(Copy, Clone, Eq, PartialEq)]
@@ -152,12 +138,6 @@ pub enum Hysteresis {
152138
H70mV = 0b111,
153139
}
154140

155-
/*#[derive(Copy, Clone, Eq, PartialEq)]
156-
pub enum PowerMode {
157-
HighSpeed = 0b00,
158-
MediumSpeed = 0b01,
159-
}*/
160-
161141
/// Comparator positive input
162142
pub trait PositiveInput<C> {
163143
fn setup(&self, comp: &C);
@@ -178,32 +158,6 @@ pub trait NegativeInput<C> {
178158
fn setup(&self, comp: &C);
179159
}
180160

181-
/*
182-
/// Comparator 1 positive input used as positive input for Comparator 2.
183-
/// Used to implement window comparator mode.
184-
#[derive(Copy, Clone, Eq, PartialEq)]
185-
pub struct Comp1InP;
186-
187-
/// Comparator 2 positive input used as positive input for Comparator 1.
188-
/// Used to implement window comparator mode.
189-
#[derive(Copy, Clone, Eq, PartialEq)]
190-
pub struct Comp2InP;
191-
192-
193-
macro_rules! window_input_pin {
194-
($COMP:ident, $pin:ty) => {
195-
impl PositiveInput<$COMP> for $pin {
196-
fn setup(&self, comp: &$COMP) {
197-
comp.csr().modify(|_, w| w.winmode().set_bit())
198-
}
199-
}
200-
};
201-
}
202-
203-
window_input_pin!(COMP1, Comp2InP);
204-
window_input_pin!(COMP2, Comp1InP);
205-
*/
206-
207161
macro_rules! positive_input_pin {
208162
($COMP:ident, $pin_0:ident, $pin_1:ident) => {
209163
impl PositiveInput<$COMP> for &$pin_0<Analog> {
@@ -568,153 +522,6 @@ impl_comparator!(COMP6, comp2, ExtiEvent::COMP6);
568522
))]
569523
impl_comparator!(COMP7, comp2, ExtiEvent::COMP7);
570524

571-
/*
572-
/// Uses two comparators to implement a window comparator.
573-
/// See Figure 69 in RM0444 Rev 5.
574-
pub struct WindowComparator<U, L, ED> {
575-
pub upper: Comparator<U, ED>,
576-
pub lower: Comparator<L, ED>,
577-
}
578-
579-
pub trait WindowComparatorExt<UC, LC> {
580-
/// Uses two comparators to implement a window comparator
581-
///
582-
/// See Figure 69 in RM0444 Rev 5. Ignores and overrides the `output_xor` setting in `config`.
583-
fn window_comparator<I: PositiveInput<UC>, L: NegativeInput<LC>, U: NegativeInput<UC>>(
584-
self,
585-
input: I,
586-
lower_threshold: L,
587-
upper_threshold: U,
588-
config: Config,
589-
clocks: &Clocks,
590-
) -> WindowComparator<UC, LC, Disabled>;
591-
}
592-
593-
macro_rules! impl_window_comparator {
594-
($UPPER:ident, $LOWER:ident, $LOTHR:expr) => {
595-
impl WindowComparatorExt<$UPPER, $LOWER> for ($UPPER, $LOWER) {
596-
fn window_comparator<
597-
I: PositiveInput<$UPPER>,
598-
L: NegativeInput<$LOWER>,
599-
U: NegativeInput<$UPPER>,
600-
>(
601-
self,
602-
input: I,
603-
lower_threshold: L,
604-
upper_threshold: U,
605-
config: Config,
606-
clocks: &Clocks,
607-
) -> WindowComparator<$UPPER, $LOWER, Disabled> {
608-
let (upper, lower) = self;
609-
610-
let mut configu = config.clone();
611-
configu.output_xor = true;
612-
let upper = upper.comparator(input, upper_threshold, configu, clocks);
613-
614-
let mut configl = config;
615-
configl.output_xor = false;
616-
let lower = lower.comparator($LOTHR, lower_threshold, configl, clocks);
617-
618-
WindowComparator { upper, lower }
619-
}
620-
}
621-
622-
impl WindowComparator<$UPPER, $LOWER, Disabled> {
623-
/// Enables the comparator
624-
pub fn enable(self) -> WindowComparator<$UPPER, $LOWER, Enabled> {
625-
WindowComparator {
626-
upper: self.upper.enable(),
627-
lower: self.lower.enable(),
628-
}
629-
}
630-
631-
/// Enables raising the `ADC_COMP` interrupt at the specified signal edge
632-
pub fn listen(&self, edge: SignalEdge, exti: &mut EXTI) {
633-
self.upper.listen(edge, exti)
634-
}
635-
}
636-
637-
impl WindowComparator<$UPPER, $LOWER, Enabled> {
638-
/// Disables the comparator
639-
pub fn disable(self) -> WindowComparator<$UPPER, $LOWER, Disabled> {
640-
WindowComparator {
641-
upper: self.upper.disable(),
642-
lower: self.lower.disable(),
643-
}
644-
}
645-
646-
/// Returns the value of the output of the comparator
647-
pub fn output(&self) -> bool {
648-
self.upper.output()
649-
}
650-
651-
/// Returns `true` if the input signal is above the lower threshold
652-
pub fn above_lower(&self) -> bool {
653-
self.lower.output()
654-
}
655-
}
656-
657-
impl<ED> WindowComparator<$UPPER, $LOWER, ED> {
658-
/// Configures a GPIO pin to output the signal of the comparator
659-
///
660-
/// Multiple GPIO pins may be configured as the output simultaneously.
661-
pub fn output_pin<P: OutputPin<$UPPER>>(&self, pin: P) {
662-
self.upper.output_pin(pin)
663-
}
664-
665-
/// Disables raising interrupts for the output signal
666-
pub fn unlisten(&self, exti: &mut EXTI) {
667-
self.upper.unlisten(exti)
668-
}
669-
670-
/// Returns `true` if the output signal interrupt is pending for the `edge`
671-
pub fn is_pending(&self, edge: SignalEdge, exti: &EXTI) -> bool {
672-
self.upper.is_pending(edge, exti)
673-
}
674-
675-
/// Unpends the output signal interrupt
676-
pub fn unpend(&self, exti: &EXTI) {
677-
self.upper.unpend(exti)
678-
}
679-
}
680-
};
681-
}
682-
683-
impl_window_comparator!(COMP1, COMP2, Comp1InP);
684-
impl_window_comparator!(COMP2, COMP1, Comp2InP);
685-
686-
pub fn window_comparator12<
687-
I: PositiveInput<COMP1>,
688-
L: NegativeInput<COMP2>,
689-
U: NegativeInput<COMP1>,
690-
>(
691-
comp: COMP,
692-
input: I,
693-
lower_threshold: L,
694-
upper_threshold: U,
695-
config: Config,
696-
rcc: &mut Rcc,
697-
) -> WindowComparator<COMP1, COMP2, Disabled> {
698-
let (comp1, comp2) = comp.split(rcc);
699-
(comp1, comp2).window_comparator(input, lower_threshold, upper_threshold, config, &rcc.clocks)
700-
}
701-
702-
pub fn window_comparator21<
703-
I: PositiveInput<COMP2>,
704-
L: NegativeInput<COMP1>,
705-
U: NegativeInput<COMP2>,
706-
>(
707-
comp: COMP,
708-
input: I,
709-
lower_threshold: L,
710-
upper_threshold: U,
711-
config: Config,
712-
rcc: &mut Rcc,
713-
) -> WindowComparator<COMP2, COMP1, Disabled> {
714-
let (comp1, comp2) = comp.split(rcc);
715-
(comp2, comp1).window_comparator(input, lower_threshold, upper_threshold, config, &rcc.clocks)
716-
}*/
717-
718525
#[cfg(not(any(
719526
feature = "stm32g473",
720527
feature = "stm32g483",

src/dac.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,6 @@ macro_rules! dac_helper {
191191
}
192192
}
193193

194-
/*pub fn enable_unbuffered(self) -> $CX<MODE_BITS, EnabledUnbuffered> {
195-
let dac = unsafe { &(*<$DAC>::ptr()) };
196-
197-
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(2) });
198-
dac.dac_cr.modify(|_, w| w.$en().set_bit());
199-
200-
$CX {
201-
_enabled: PhantomData,
202-
}
203-
}*/
204-
205194
pub fn enable_generator(self, config: GeneratorConfig) -> $CX<MODE_BITS, WaveGenerator> {
206195
let dac = unsafe { &(*<$DAC>::ptr()) };
207196

0 commit comments

Comments
 (0)