#![allow(unused_variables)]
use super::*;
use crate::{gpio::*, pac::*};

// table
// Do NOT manually modify the code.
// It's generated by scripts/generate_remap_table.py from scripts/table/stm32f1_remap_peripheral.csv

// Binder types ------------------

pub trait TimBkinPin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimBkinPin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh1Pin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh1Pin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh1nPin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh1nPin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh2Pin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh2Pin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh2nPin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh2nPin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh3Pin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh3Pin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh3nPin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh3nPin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimCh4Pin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimCh4Pin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}
pub trait TimEtrPin<REMAP> {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        true
    }
}
impl<T> TimEtrPin<T> for NonePin {
    #[inline(always)]
    fn is_pin(&self) -> bool {
        false
    }
}

// Bind pins ---------------------

#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh1Pin<RemapDefault<TIM1>> for PA8<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh2Pin<RemapDefault<TIM1>> for PA9<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh3Pin<RemapDefault<TIM1>> for PA10<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh4Pin<RemapDefault<TIM1>> for PA11<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh1Pin<RemapFull<TIM1>> for PE9<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh2Pin<RemapFull<TIM1>> for PE11<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh3Pin<RemapFull<TIM1>> for PE13<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh4Pin<RemapFull<TIM1>> for PE14<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh1Pin<RemapPartial1<TIM1>> for PA8<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh2Pin<RemapPartial1<TIM1>> for PA9<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh3Pin<RemapPartial1<TIM1>> for PA10<Alternate<PushPull>> {}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl TimCh4Pin<RemapPartial1<TIM1>> for PA11<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh1Pin<RemapDefault<TIM10>> for PB8<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh1Pin<RemapFull<TIM10>> for PF6<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh1Pin<RemapDefault<TIM11>> for PB9<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh1Pin<RemapFull<TIM11>> for PF7<Alternate<PushPull>> {}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl TimCh1Pin<RemapDefault<TIM12>> for PB14<Alternate<PushPull>> {}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl TimCh2Pin<RemapDefault<TIM12>> for PB15<Alternate<PushPull>> {}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl TimCh1Pin<RemapDefault<TIM13>> for PA6<Alternate<PushPull>> {}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl TimCh1Pin<RemapFull<TIM13>> for PF8<Alternate<PushPull>> {}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl TimCh1Pin<RemapDefault<TIM14>> for PA7<Alternate<PushPull>> {}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl TimCh1Pin<RemapFull<TIM14>> for PF9<Alternate<PushPull>> {}
impl TimCh1Pin<RemapDefault<TIM2>> for PA0<Alternate<PushPull>> {}
impl TimCh2Pin<RemapDefault<TIM2>> for PA1<Alternate<PushPull>> {}
impl TimCh3Pin<RemapDefault<TIM2>> for PA2<Alternate<PushPull>> {}
impl TimCh4Pin<RemapDefault<TIM2>> for PA3<Alternate<PushPull>> {}
impl TimCh1Pin<RemapFull<TIM2>> for PA15<Alternate<PushPull>> {}
impl TimCh2Pin<RemapFull<TIM2>> for PB3<Alternate<PushPull>> {}
impl TimCh3Pin<RemapFull<TIM2>> for PB10<Alternate<PushPull>> {}
impl TimCh4Pin<RemapFull<TIM2>> for PB11<Alternate<PushPull>> {}
impl TimCh1Pin<RemapPartial1<TIM2>> for PA15<Alternate<PushPull>> {}
impl TimCh2Pin<RemapPartial1<TIM2>> for PB3<Alternate<PushPull>> {}
impl TimCh3Pin<RemapPartial1<TIM2>> for PA2<Alternate<PushPull>> {}
impl TimCh4Pin<RemapPartial1<TIM2>> for PA3<Alternate<PushPull>> {}
impl TimCh1Pin<RemapPartial2<TIM2>> for PA0<Alternate<PushPull>> {}
impl TimCh2Pin<RemapPartial2<TIM2>> for PA1<Alternate<PushPull>> {}
impl TimCh3Pin<RemapPartial2<TIM2>> for PB10<Alternate<PushPull>> {}
impl TimCh4Pin<RemapPartial2<TIM2>> for PB11<Alternate<PushPull>> {}
impl TimCh1Pin<RemapDefault<TIM3>> for PA6<Alternate<PushPull>> {}
impl TimCh2Pin<RemapDefault<TIM3>> for PA7<Alternate<PushPull>> {}
impl TimCh3Pin<RemapDefault<TIM3>> for PB0<Alternate<PushPull>> {}
impl TimCh4Pin<RemapDefault<TIM3>> for PB1<Alternate<PushPull>> {}
impl TimCh1Pin<RemapFull<TIM3>> for PC6<Alternate<PushPull>> {}
impl TimCh2Pin<RemapFull<TIM3>> for PC7<Alternate<PushPull>> {}
impl TimCh3Pin<RemapFull<TIM3>> for PC8<Alternate<PushPull>> {}
impl TimCh4Pin<RemapFull<TIM3>> for PC9<Alternate<PushPull>> {}
impl TimCh1Pin<RemapPartial1<TIM3>> for PB4<Alternate<PushPull>> {}
impl TimCh2Pin<RemapPartial1<TIM3>> for PB5<Alternate<PushPull>> {}
impl TimCh3Pin<RemapPartial1<TIM3>> for PB0<Alternate<PushPull>> {}
impl TimCh4Pin<RemapPartial1<TIM3>> for PB1<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh1Pin<RemapDefault<TIM4>> for PB6<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh2Pin<RemapDefault<TIM4>> for PB7<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh3Pin<RemapDefault<TIM4>> for PB8<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh4Pin<RemapDefault<TIM4>> for PB9<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh1Pin<RemapFull<TIM4>> for PD12<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh2Pin<RemapFull<TIM4>> for PD13<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh3Pin<RemapFull<TIM4>> for PD14<Alternate<PushPull>> {}
#[cfg(feature = "medium")]
impl TimCh4Pin<RemapFull<TIM4>> for PD15<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh1Pin<RemapDefault<TIM5>> for PA0<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh2Pin<RemapDefault<TIM5>> for PA1<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh3Pin<RemapDefault<TIM5>> for PA2<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh4Pin<RemapDefault<TIM5>> for PA3<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh1Pin<RemapFull<TIM5>> for PA0<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh2Pin<RemapFull<TIM5>> for PA1<Alternate<PushPull>> {}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl TimCh3Pin<RemapFull<TIM5>> for PA2<Alternate<PushPull>> {}
#[cfg(all(feature = "f103", feature = "high"))]
impl TimCh1Pin<RemapDefault<TIM8>> for PC6<Alternate<PushPull>> {}
#[cfg(all(feature = "f103", feature = "high"))]
impl TimCh2Pin<RemapDefault<TIM8>> for PC7<Alternate<PushPull>> {}
#[cfg(all(feature = "f103", feature = "high"))]
impl TimCh3Pin<RemapDefault<TIM8>> for PC8<Alternate<PushPull>> {}
#[cfg(all(feature = "f103", feature = "high"))]
impl TimCh4Pin<RemapDefault<TIM8>> for PC9<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh1Pin<RemapDefault<TIM9>> for PA2<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh2Pin<RemapDefault<TIM9>> for PA3<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh1Pin<RemapFull<TIM9>> for PE5<Alternate<PushPull>> {}
#[cfg(feature = "xl")]
impl TimCh2Pin<RemapFull<TIM9>> for PE6<Alternate<PushPull>> {}

// Register operations ------------

#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl RemapMode<TIM1> for RemapDefault<TIM1> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim1_remap().bits(0b00) });
    }
}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl RemapMode<TIM1> for RemapFull<TIM1> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim1_remap().bits(0b11) });
    }
}
#[cfg(any(feature = "f100", feature = "f103", feature = "connectivity"))]
impl RemapMode<TIM1> for RemapPartial1<TIM1> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim1_remap().bits(0b01) });
    }
}
#[cfg(feature = "xl")]
impl RemapMode<TIM10> for RemapDefault<TIM10> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim10_remap().clear_bit());
    }
}
#[cfg(feature = "xl")]
impl RemapMode<TIM10> for RemapFull<TIM10> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim10_remap().set_bit());
    }
}
#[cfg(feature = "xl")]
impl RemapMode<TIM11> for RemapDefault<TIM11> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim11_remap().clear_bit());
    }
}
#[cfg(feature = "xl")]
impl RemapMode<TIM11> for RemapFull<TIM11> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim11_remap().set_bit());
    }
}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl RemapMode<TIM12> for RemapDefault<TIM12> {
    fn remap(afio: &mut Afio) {}
}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl RemapMode<TIM13> for RemapDefault<TIM13> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim13_remap().clear_bit());
    }
}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl RemapMode<TIM13> for RemapFull<TIM13> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim13_remap().set_bit());
    }
}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl RemapMode<TIM14> for RemapDefault<TIM14> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim14_remap().clear_bit());
    }
}
#[cfg(any(feature = "xl", all(feature = "f100", feature = "high",)))]
impl RemapMode<TIM14> for RemapFull<TIM14> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim14_remap().set_bit());
    }
}
impl RemapMode<TIM2> for RemapDefault<TIM2> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b00) });
    }
}
impl RemapMode<TIM2> for RemapFull<TIM2> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b11) });
    }
}
impl RemapMode<TIM2> for RemapPartial1<TIM2> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b01) });
    }
}
impl RemapMode<TIM2> for RemapPartial2<TIM2> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim2_remap().bits(0b10) });
    }
}
impl RemapMode<TIM3> for RemapDefault<TIM3> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim3_remap().bits(0b00) });
    }
}
impl RemapMode<TIM3> for RemapFull<TIM3> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim3_remap().bits(0b11) });
    }
}
impl RemapMode<TIM3> for RemapPartial1<TIM3> {
    fn remap(afio: &mut Afio) {
        afio.mapr
            .modify_mapr(unsafe { |_, w| w.tim3_remap().bits(0b10) });
    }
}
#[cfg(feature = "medium")]
impl RemapMode<TIM4> for RemapDefault<TIM4> {
    fn remap(afio: &mut Afio) {
        afio.mapr.modify_mapr(|_, w| w.tim4_remap().clear_bit());
    }
}
#[cfg(feature = "medium")]
impl RemapMode<TIM4> for RemapFull<TIM4> {
    fn remap(afio: &mut Afio) {
        afio.mapr.modify_mapr(|_, w| w.tim4_remap().set_bit());
    }
}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl RemapMode<TIM5> for RemapDefault<TIM5> {
    fn remap(afio: &mut Afio) {
        afio.mapr.modify_mapr(|_, w| w.tim5ch4_iremap().clear_bit());
    }
}
#[cfg(any(feature = "high", feature = "connectivity"))]
impl RemapMode<TIM5> for RemapFull<TIM5> {
    fn remap(afio: &mut Afio) {
        afio.mapr.modify_mapr(|_, w| w.tim5ch4_iremap().set_bit());
    }
}
#[cfg(all(feature = "f103", feature = "high"))]
impl RemapMode<TIM8> for RemapDefault<TIM8> {
    fn remap(afio: &mut Afio) {}
}
#[cfg(feature = "xl")]
impl RemapMode<TIM9> for RemapDefault<TIM9> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim9_remap().clear_bit());
    }
}
#[cfg(feature = "xl")]
impl RemapMode<TIM9> for RemapFull<TIM9> {
    fn remap(afio: &mut Afio) {
        afio.mapr2.modify_mapr(|_, w| w.tim9_remap().set_bit());
    }
}
