pub fn new(twim: T, scl: &Pin, sda: &Pin, frequency: TwimFreq) -> Self {
        // Select pins.
        twim.psel.scl.write(|w| unsafe {
            #[cfg(not(any(
                feature = "52810",
                feature = "52811",
                feature = "52832",
                feature = "53"
            )))]
            w.port().bit(scl.port as u8 != 0);
            #[cfg(feature = "53")]
            w.port().bits(scl.port as u8);
            w.pin().bits(scl.pin);
            w.connect().clear_bit()
        });

        twim.psel.sda.write(|w| unsafe {
            #[cfg(not(any(
                feature = "52810",
                feature = "52811",
                feature = "52832",
                feature = "53"
            )))]
            w.port().bit(sda.port as u8 != 0);
            #[cfg(feature = "53")]
            w.port().bits(sda.port as u8);
            w.pin().bits(sda.pin);
            w.connect().clear_bit()
        });

        // Enable TWIM instance.
        twim.enable.write(|w| w.enable().enabled());

        // Configure frequency.
        twim.frequency.write(|w| w.frequency().variant(frequency));

        Twim(twim)
    }
/// Initialize a TWIM (Two-Wire Interface Master) peripheral.
Initialize a TWIM (Two-Wire Interface Master) peripheral.
Initialize a TWIM ( Two - Wire Interface Master ) peripheral .
pub fn new(twim: T, scl: &Pin, sda: &Pin, frequency: TwimFreq) -> Self {
        // Select pins.
        twim.psel.scl.write(|w| unsafe {
            #[cfg(not(any(
                feature = "52810",
                feature = "52811",
                feature = "52832",
                feature = "53"
            )))]
            w.port().bit(scl.port as u8 != 0);
            #[cfg(feature = "53")]
            w.port().bits(scl.port as u8);
            w.pin().bits(scl.pin);
            w.connect().clear_bit()
        });
        twim.psel.sda.write(|w| unsafe {
            #[cfg(not(any(
                feature = "52810",
                feature = "52811",
                feature = "52832",
                feature = "53"
            )))]
            w.port().bit(sda.port as u8 != 0);
            #[cfg(feature = "53")]
            w.port().bits(sda.port as u8);
            w.pin().bits(sda.pin);
            w.connect().clear_bit()
        });
        // Enable TWIM instance.
        twim.enable.write(|w| w.enable().enabled());
        // Configure frequency.
        twim.frequency.write(|w| w.frequency().variant(frequency));
        Twim(twim)
    }
pub fn new ( twim : T , scl : & Pin , sda : & Pin , frequency : TwimFreq ) -> Self { // Select pins. twim . psel . scl . write ( | w | unsafe { # [ cfg ( not ( any ( feature " " feature " " feature " " feature " " ) ) ) ] w . port ( ) . bit ( scl . port as u8 != 0 ) ; # [ cfg ( feature " " ) ] w . port ( ) . bits ( scl . port as u8 ) ; w . pin ( ) . bits ( scl . pin ) ; w . connect ( ) . clear_bit ( ) } ) ; twim . psel . sda . write ( | w | unsafe { # [ cfg ( not ( any ( feature " " feature " " feature " " feature " " ) ) ) ] w . port ( ) . bit ( sda . port as u8 != 0 ) ; # [ cfg ( feature " " ) ] w . port ( ) . bits ( sda . port as u8 ) ; w . pin ( ) . bits ( sda . pin ) ; w . connect ( ) . clear_bit ( ) } ) ; // Enable TWIM instance. twim . enable . write ( | w | w . enable ( ) . enabled ( ) ) ; // Configure frequency. twim . frequency . write ( | w | w . frequency ( ) . variant ( frequency ) ) ; Twim ( twim ) }
Initialize a TWIM (Two-Wire Interface Master) peripheral.
Initialize a TWIM ( Two - Wire Interface Master ) peripheral .
twim
T
scl
&Pin
sda
&Pin
frequency
TwimFreq
twim
T
scl
&Pin
sda
&Pin
frequency
TwimFreq