Esempio n. 1
0
    void startSwitchingToReadMode(ReadWindow window) {
      readCacheStatus = READ_CACHE_STATUS.SWITCHINGTOREADMODE;
      i2cDevice.enableI2cReadMode(window.getIregFirst(), window.getCreg());
      enabledReadMode = true;

      // Remember what we actually told the controller
      readWindowSentToController = window;
      readWindowSentToControllerInitialized = true;

      setActionFlag = true; // causes an I2C read to happen
      queueFullWrite = true; // for just the mode bytes
      queueRead = true; // read the mode byte so we can tell when the switch is done

      dirtyModeCacheStatus();
    }
Esempio n. 2
0
  /** Set the set of registers that we will read and read and read again on every hardware cycle */
  @Override
  public void setReadWindow(ReadWindow newWindow) {
    synchronized (this.concurrentClientLock) {
      synchronized (this.callbackLock) {
        if (this.readWindow == null
            || !this.readWindow.isOkToRead()
            || !this.readWindow.sameAsIncludingMode(newWindow)) {
          // Remember the new window, but get a fresh copy so we can implement the read mode policy
          this.readWindow = newWindow.freshCopy();
          assertTrue(!BuildConfig.DEBUG || this.readWindow.isOkToRead());

          // Let others know of the update
          this.readWindowChanged = true;
        }
      }
    }
  }