/// Initialize the display and its corresponding SPI bus peripheral. Return
/// a tuple containing the configured display driver struct and backlight
/// pin.
Initialize the display and its corresponding SPI bus peripheral. Return
a tuple containing the configured display driver struct and backlight
pin.
Initialize the display and its corresponding SPI bus peripheral . Return a tuple containing the configured display driver struct and backlight pin .
pub fn init<F: Into<Hertz>, D: DelayMs<u16>>(
        self,
        clocks: &mut GenericClockController,
        sercom7: SERCOM7,
        mclk: &mut MCLK,
        baud: F,
        delay: &mut D,
    ) -> Result<(LCD, LcdBacklight), ()> {
        // Initialize the SPI peripherial on the configured pins, using SERCOM7.
        let gclk0 = clocks.gclk0();
        let clock = &clocks.sercom7_core(&gclk0).ok_or(())?;
        let pads = spi::Pads::default().data_out(self.mosi).sclk(self.sck);
        let spi = spi::Config::new(mclk, sercom7, pads, clock.freq())
            .spi_mode(spi::MODE_0)
            .baud(baud)
            .enable();
        // Configure the chip select, data/command, and reset pins as push-pull outputs.
        let cs = self.cs.into_push_pull_output();
        let dc = self.dc.into_push_pull_output();
        let reset = self.reset.into_push_pull_output();
        // Create a SPIInterface over the peripheral, then create the ILI9341 driver
        // using said interface and set its default orientation.
        let interface = SPIInterface::new(spi, dc, cs);
        let ili9341 = Ili9341::new(
            interface,
            reset,
            delay,
            Orientation::LandscapeFlipped,
            DisplaySize240x320,
        )
        .map_err(|_| ())?;
        // Configure the backlight pin as a push-pull output; unfortunately this pin
        // does not appear to support PWM.
        //   HIGH - backlight enabled
        //   LOW  - backlight disabled
        let mut backlight = self.backlight.into_push_pull_output();
        backlight.set_high().ok();
        // Return a result consisting of a Tuple containing the display driver and
        // backlight pin.
        Ok((ili9341, backlight))
    }
pub fn init < F : Into < Hertz > , D : DelayMs < u16 > > ( self , clocks : & mut GenericClockController , sercom7 : SERCOM7 , mclk : & mut MCLK , baud : F , delay : & mut D , ) -> Result < ( LCD , LcdBacklight ) , ( ) > { // Initialize the SPI peripherial on the configured pins, using SERCOM7. let gclk0 = clocks . gclk0 ( ) ; let clock = & clocks . sercom7_core ( & gclk0 ) . ok_or ( ( ) ) ? ; let pads = spi :: Pads :: default ( ) . data_out ( self . mosi ) . sclk ( self . sck ) ; let spi = spi :: Config :: new ( mclk , sercom7 , pads , clock . freq ( ) ) . spi_mode ( spi :: MODE_0 ) . baud ( baud ) . enable ( ) ; // Configure the chip select, data/command, and reset pins as push-pull outputs. let cs = self . cs . into_push_pull_output ( ) ; let dc = self . dc . into_push_pull_output ( ) ; let reset = self . reset . into_push_pull_output ( ) ; // Create a SPIInterface over the peripheral, then create the ILI9341 driver // using said interface and set its default orientation. let interface = SPIInterface :: new ( spi , dc , cs ) ; let ili9341 = Ili9341 :: new ( interface , reset , delay , Orientation :: LandscapeFlipped , DisplaySize240x320 , ) . map_err ( | _ | ( ) ) ? ; // Configure the backlight pin as a push-pull output; unfortunately this pin // does not appear to support PWM. //   HIGH - backlight enabled //   LOW  - backlight disabled let mut backlight = self . backlight . into_push_pull_output ( ) ; backlight . set_high ( ) . ok ( ) ; // Return a result consisting of a Tuple containing the display driver and // backlight pin. Ok ( ( ili9341 , backlight ) ) }
Initialize the display and its corresponding SPI bus peripheral.
Initialize the display and its corresponding SPI bus peripheral .
self
clocks
&mut GenericClockController
sercom7
SERCOM7
mclk
&mut MCLK
baud
F
delay
&mut D