original_docstring: Polls GPIO until an trigger event occurs.
  
      Args:
        timeout: The timeout in seconds to break the check. Set 0 for forever.
      
docstring: Polls GPIO until an trigger event occurs.
docstring_tokens: Polls GPIO until an trigger event occurs .
code: def Poll(self, timeout=1000):
      """Polls GPIO until an trigger event occurs.
  
      Args:
        timeout: The timeout in seconds to break the check. Set 0 for forever.
      """
      if self._trigger is None:
        raise GpioError('Cannot use Poll() if trigger mode is not selected...')
      # set gpio direction to input mode
      self._SetDirection('in')
      self._state = self.Read()
      end_time = start_time = time.time()
      while not timeout or end_time - start_time < timeout:
        time.sleep(self._POLL_INTERVAL)
        state = self.Read()
        if state == self._trigger:
          return
        if state != self._state:
          if self._trigger == self.EDGE_BOTH:
            return
          if self._trigger == self.EDGE_RISING and state:
            return
          if self._trigger == self.EDGE_FALLING and not state:
            return
        self._state = state
        end_time = time.time()
      raise GpioError('Timeout occured when polling after %f seconds' % timeout)
code_tokens: def Poll ( self , timeout = 1000 ) : if self . _trigger is None : raise GpioError ( 'Cannot use Poll() if trigger mode is not selected...' ) self . _SetDirection ( 'in' ) self . _state = self . Read ( ) end_time = start_time = time . time ( ) while not timeout or end_time - start_time < timeout : time . sleep ( self . _POLL_INTERVAL ) state = self . Read ( ) if state == self . _trigger : return if state != self . _state : if self . _trigger == self . EDGE_BOTH : return if self . _trigger == self . EDGE_RISING and state : return if self . _trigger == self . EDGE_FALLING and not state : return self . _state = state end_time = time . time ( ) raise GpioError ( 'Timeout occured when polling after %f seconds' % timeout )
short_docstring: Polls GPIO until an trigger event occurs.
short_docstring_tokens: Polls GPIO until an trigger event occurs .
comment: """Polls GPIO until an trigger event occurs.
  
      Args:
        timeout: The timeout in seconds to break the check. Set 0 for forever.
      """$SEP$# set gpio direction to input mode