pub fn poll(&mut self) -> Option<Event> {
        let mut ev: Option<Event> = None;
        if let Ok(z1) = read(&self.i2c, command::LOW_POWER_READ_Z1) {
            if z1 > TOUCH_THR_MIN && z1 < TOUCH_THR_MAX {
                if let (Ok(x), Ok(y)) = (read(&self.i2c, command::LOW_POWER_READ_X), read(&self.i2c, command::LOW_POWER_READ_Y)) {
                    let (x, y) = self.filter.update(x, y);
                    if !self.press
                    {
                        self.press = true;
                        ev = Some(Event { kind: EventKind::Begin, x, y, z: z1 as i32 });
                    }
                    else if self.x != x || self.y != y {
                        ev = Some(Event { kind: EventKind::Move, x, y, z: z1 as i32 });
                    }
                    self.x = x;
                    self.y = y;
                }
            } else {
                if self.press
                {
                    self.filter.clear();
                    self.press = false;
                    ev = Some(Event { kind: EventKind::End, x: self.x, y: self.y, z: 0 });
                }
            }
        }
        ev
    }
/** Poll for touch screen event, return the current event (Begin, Move, End) or None */
Poll for touch screen event, return the current event (Begin, Move, End) or None
Poll for touch screen event return the current event ( Begin Move End ) or None
pub fn poll(&mut self) -> Option<Event> {
        let mut ev: Option<Event> = None;
        if let Ok(z1) = read(&self.i2c, command::LOW_POWER_READ_Z1) {
            if z1 > TOUCH_THR_MIN && z1 < TOUCH_THR_MAX {
                if let (Ok(x), Ok(y)) = (read(&self.i2c, command::LOW_POWER_READ_X), read(&self.i2c, command::LOW_POWER_READ_Y)) {
                    let (x, y) = self.filter.update(x, y);
                    if !self.press
                    {
                        self.press = true;
                        ev = Some(Event { kind: EventKind::Begin, x, y, z: z1 as i32 });
                    }
                    else if self.x != x || self.y != y {
                        ev = Some(Event { kind: EventKind::Move, x, y, z: z1 as i32 });
                    }
                    self.x = x;
                    self.y = y;
                }
            } else {
                if self.press
                {
                    self.filter.clear();
                    self.press = false;
                    ev = Some(Event { kind: EventKind::End, x: self.x, y: self.y, z: 0 });
                }
            }
        }
        ev
    }
pub fn poll ( & mut self ) -> Option < Event > { let mut ev : Option < Event > = None ; if let Ok ( z1 ) = read ( & self . i2c , command :: LOW_POWER_READ_Z1 ) { if z1 > TOUCH_THR_MIN && z1 < TOUCH_THR_MAX { if let ( Ok ( x ) , Ok ( y ) ) = ( read ( & self . i2c , command :: LOW_POWER_READ_X ) , read ( & self . i2c , command :: LOW_POWER_READ_Y ) ) { let ( x , y ) = self . filter . update ( x , y ) ; if ! self . press { self . press = true ; ev = Some ( Event { kind : EventKind :: Begin , x , y , z : z1 as i32 } ) ; } else if self . x != x || self . y != y { ev = Some ( Event { kind : EventKind :: Move , x , y , z : z1 as i32 } ) ; } self . x = x ; self . y = y ; } } else { if self . press { self . filter . clear ( ) ; self . press = false ; ev = Some ( Event { kind : EventKind :: End , x : self . x , y : self . y , z : 0 } ) ; } } } ev }
Poll for touch screen event, return the current event (Begin, Move, End) or None
Poll for touch screen event return the current event ( Begin Move End ) or None
&mut self
&mut self