Skip to content

Commit

Permalink
Add long_hard_reset function
Browse files Browse the repository at this point in the history
  • Loading branch information
ksedgwic authored and Srg213 committed Oct 3, 2022
1 parent 57dcd80 commit 40d4139
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ft6x06"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["Shantanu Gaikwad"]
categories = ["embedded", "no-std", "hardware-support"]
Expand Down
24 changes: 23 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ use heapless::Vec;
use crate::constant::*;
use core::marker::PhantomData;
use embedded_hal as hal;
use hal::blocking::{delay::DelayMs, i2c};
use hal::blocking::{delay::{DelayMs, DelayUs}, i2c};
use hal::digital::v2::OutputPin;
use rtt_target::rprintln;

#[derive(Copy, Clone, Debug)]
Expand Down Expand Up @@ -185,6 +186,27 @@ pub struct Ft6X06<I2C> {
addr: u8,
}

/// Perform a long hard reset, the FT66206 needs at least 5mS ...
//
// - On the STM32F413 the touchscreen shares the reset GPIO pin w/ the LCD.
// - The ST7789 driver uses a fast (10uS) reset.
// - The touchscreen controller needs 5mS:
// https://www.displayfuture.com/Display/datasheet/controller/FT6206.pdf
pub fn long_hard_reset<'a, RST, DELAY>(
rst: &'a mut RST,
delay: &'a mut DELAY,
) -> Result<(), &'a str>
where
RST: OutputPin,
DELAY: DelayUs<u32>,
{
rst.set_low().map_err(|_| "rst.set_low failed")?;
delay.delay_us(10_000);
rst.set_high().map_err(|_| "rst.set_high failed")?;

Ok(())
}

impl<I2C, E> Ft6X06<I2C>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
Expand Down

0 comments on commit 40d4139

Please sign in to comment.