Ejemplo n.º 1
0
  private void shutDown() throws InterruptedException {
    chipSelect.setValue(false);
    chipSelect.close();
    try {
      // move this stuff into a function
      configRegister.powerDown();
      SPIFactory.INSTANCE.writeRead(new byte[] {(byte) NRFCommand.FlushTx.getCommand()});
      statusRegister.clearMaxRTFlag();
      activateCommand();
      System.out.println(
          "Status of Config register " + String.format("%02X ", configRegister.readFromRegister()));

      System.out.println(
          "Status of Enable Data pipe register "
              + String.format("%02X ", dataPipeRegister.readFromRegister()));
      System.out.println(
          "Status of Retry register " + String.format("%02X ", retryRegister.readFromRegister()));
      System.out.println(
          "Status of Rx dataload width pipe0 register "
              + String.format("%02X ", rxdataloadinPipe0.readFromRegister()));
      System.out.println(
          "Status of Feature register "
              + String.format("%02X ", featureRegister.readFromRegister()));

      System.out.println(
          "Status of Address PIPE0 register "
              + String.format("%02X ", addressPipe0.readFromRegister()));

    } catch (SpiDeviceException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }