com.google.android.things.pio.Gpio.close()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中com.google.android.things.pio.Gpio.close()方法的一些代码示例,展示了Gpio.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gpio.close()方法的具体详情如下:
包路径:com.google.android.things.pio.Gpio
类名称:Gpio
方法名:close

Gpio.close介绍

暂无

代码示例

代码示例来源:origin: macdidi5/Android-Things-Tutorial

public void close() throws IOException {
  serialDataOutput.close();
  serialDataInput.close();
  serialClock.close();
  chipSelect.close();
}

代码示例来源:origin: stefanhaustein/flowgrid

@Override
public void detach() {
  try {
    if (gpio != null) {
      gpio.close();
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: Nilhcem/1602A-androidthings

if (rsGpio != null) {
  try {
    rsGpio.close();
  } finally {
    rsGpio = null;
    rwGpio.close();
  } finally {
    rwGpio = null;
    enableGpio.close();
  } finally {
    enableGpio = null;
  if (dataGpios[i] != null) {
    try {
      dataGpios[i].close();
    } finally {
      dataGpios[i] = null;

代码示例来源:origin: androidthings/sample-simpleui

@Override
  protected void onDestroy() {
    super.onDestroy();

    for (Map.Entry<String, Gpio> entry : mGpioMap.entrySet()) {
      try {
        entry.getValue().close();
      } catch (IOException e) {
        Log.e(TAG, "Error closing GPIO " + entry.getKey(), e);
      }
    }
    mGpioMap.clear();
  }
}

代码示例来源:origin: macdidi5/Android-Things-Tutorial

@Override
protected void onDestroy() {
  super.onDestroy();
  Log.i(TAG, "onDestroy");
  if (miniReedGpio != null) {
    try {
      // 關閉GPIO物件
      miniReedGpio.close();
    }
    catch (IOException e) {
      Log.e(TAG, e.toString());
    }
    finally {
      miniReedGpio = null;
    }
  }
}

代码示例来源:origin: macdidi5/Android-Things-Tutorial

@Override
protected void onDestroy() {
  super.onDestroy();
  Log.i(TAG, "onDestroy");
  // 移除控制LED閃爍的Handler物件
  ledHandler.removeCallbacks(ledRunnable);
  try {
    // 關閉GPIO物件
    ledGpio.close();
  }
  catch (IOException e) {
    Log.e(TAG, e.toString());
  }
  finally {
    ledGpio = null;
  }
}

代码示例来源:origin: macdidi5/Android-Things-Tutorial

@Override
protected void onDestroy() {
  super.onDestroy();
  Log.i(TAG, "onDestroy");
  // 移除控制數字顯示的Handler物件
  numberHandler.removeCallbacks(numberRunnable);
  try {
    // 關閉GPIO物件
    for (Gpio gpio : gpios) {
      gpio.close();
    }
  }
  catch (IOException e) {
    Log.e(TAG, e.toString());
  }
  finally {
    gpios = null;
  }
}

代码示例来源:origin: androidthings/sample-button

@Override
  protected void onStop(){
    Log.d(TAG, "onStop called.");
    if (mButtonInputDriver != null) {
      mButtonInputDriver.unregister();
      try {
        Log.d(TAG, "Unregistering button");
        mButtonInputDriver.close();
      } catch (IOException e) {
        Log.e(TAG, "Error closing Button driver", e);
      } finally{
        mButtonInputDriver = null;
      }
    }

    if (mLedGpio != null) {
      try {
        Log.d(TAG, "Unregistering LED.");
        mLedGpio.close();
      } catch (IOException e) {
        Log.e(TAG, "Error closing LED GPIO", e);
      } finally{
        mLedGpio = null;
      }
    }
    super.onStop();
  }
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

gpio.close();
} catch (IOException e) {
  e.printStackTrace();

相关文章