pub fn init(&mut self, delay_source: &mut impl DelayUs<u32>) -> Result<(), Error<PinE>> {
        self.hard_reset(delay_source)?;
        if let Some(bl) = self.bl.as_mut() {
            bl.set_low().map_err(Error::Pin)?;
            delay_source.delay_us(10_000);
            bl.set_high().map_err(Error::Pin)?;
        }

        self.write_command(Instruction::SWRESET)?; // reset display
        delay_source.delay_us(150_000);
        self.write_command(Instruction::SLPOUT)?; // turn off sleep
        delay_source.delay_us(10_000);
        self.write_command(Instruction::INVOFF)?; // turn off invert
        self.write_command(Instruction::VSCRDER)?; // vertical scroll definition
        self.write_data(&[0u8, 0u8, 0x14u8, 0u8, 0u8, 0u8])?; // 0 TSA, 320 VSA, 0 BSA
        self.write_command(Instruction::MADCTL)?; // left -> right, bottom -> top RGB
        self.write_data(&[0b0000_0000])?;
        self.write_command(Instruction::COLMOD)?; // 16bit 65k colors
        self.write_data(&[0b0101_0101])?;
        self.write_command(Instruction::INVON)?; // hack?
        delay_source.delay_us(10_000);
        self.write_command(Instruction::NORON)?; // turn on display
        delay_source.delay_us(10_000);
        self.write_command(Instruction::DISPON)?; // turn on display
        delay_source.delay_us(10_000);
        Ok(())
    }
///
/// Runs commands to initialize the display
///
/// # Arguments
///
/// * `delay_source` - mutable reference to a delay provider
///
Runs commands to initialize the display
Runs commands to initialize the display
pub fn init(&mut self, delay_source: &mut impl DelayUs<u32>) -> Result<(), Error<PinE>> {
        self.hard_reset(delay_source)?;
        if let Some(bl) = self.bl.as_mut() {
            bl.set_low().map_err(Error::Pin)?;
            delay_source.delay_us(10_000);
            bl.set_high().map_err(Error::Pin)?;
        }
        self.write_command(Instruction::SWRESET)?; // reset display
        delay_source.delay_us(150_000);
        self.write_command(Instruction::SLPOUT)?; // turn off sleep
        delay_source.delay_us(10_000);
        self.write_command(Instruction::INVOFF)?; // turn off invert
        self.write_command(Instruction::VSCRDER)?; // vertical scroll definition
        self.write_data(&[0u8, 0u8, 0x14u8, 0u8, 0u8, 0u8])?; // 0 TSA, 320 VSA, 0 BSA
        self.write_command(Instruction::MADCTL)?; // left -> right, bottom -> top RGB
        self.write_data(&[0b0000_0000])?;
        self.write_command(Instruction::COLMOD)?; // 16bit 65k colors
        self.write_data(&[0b0101_0101])?;
        self.write_command(Instruction::INVON)?; // hack?
        delay_source.delay_us(10_000);
        self.write_command(Instruction::NORON)?; // turn on display
        delay_source.delay_us(10_000);
        self.write_command(Instruction::DISPON)?; // turn on display
        delay_source.delay_us(10_000);
        Ok(())
    }
pub fn init ( & mut self , delay_source : & mut impl DelayUs < u32 > ) -> Result < ( ) , Error < PinE > > { self . hard_reset ( delay_source ) ? ; if let Some ( bl ) = self . bl . as_mut ( ) { bl . set_low ( ) . map_err ( Error :: Pin ) ? ; delay_source . delay_us ( 10_000 ) ; bl . set_high ( ) . map_err ( Error :: Pin ) ? ; } self . write_command ( Instruction :: SWRESET ) ? ; // reset display delay_source . delay_us ( 150_000 ) ; self . write_command ( Instruction :: SLPOUT ) ? ; // turn off sleep delay_source . delay_us ( 10_000 ) ; self . write_command ( Instruction :: INVOFF ) ? ; // turn off invert self . write_command ( Instruction :: VSCRDER ) ? ; // vertical scroll definition self . write_data ( & [ 0u8 , 0u8 , 0x14u8 , 0u8 , 0u8 , 0u8 ] ) ? ; // 0 TSA, 320 VSA, 0 BSA self . write_command ( Instruction :: MADCTL ) ? ; // left -> right, bottom -> top RGB self . write_data ( & [ 0b0000_0000 ] ) ? ; self . write_command ( Instruction :: COLMOD ) ? ; // 16bit 65k colors self . write_data ( & [ 0b0101_0101 ] ) ? ; self . write_command ( Instruction :: INVON ) ? ; // hack? delay_source . delay_us ( 10_000 ) ; self . write_command ( Instruction :: NORON ) ? ; // turn on display delay_source . delay_us ( 10_000 ) ; self . write_command ( Instruction :: DISPON ) ? ; // turn on display delay_source . delay_us ( 10_000 ) ; Ok ( ( ) ) }
Runs commands to initialize the display
Runs commands to initialize the display
&mut self
delay_source
&mut impl DelayUs<u32>
&mut self
delay_source
&mut impl DelayUs<u32>