當前位置: 首頁>>代碼示例>>Java>>正文


Java PeripheralManagerService.getGpioList方法代碼示例

本文整理匯總了Java中com.google.android.things.pio.PeripheralManagerService.getGpioList方法的典型用法代碼示例。如果您正苦於以下問題:Java PeripheralManagerService.getGpioList方法的具體用法?Java PeripheralManagerService.getGpioList怎麽用?Java PeripheralManagerService.getGpioList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.things.pio.PeripheralManagerService的用法示例。


在下文中一共展示了PeripheralManagerService.getGpioList方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBoardVariant

import com.google.android.things.pio.PeripheralManagerService; //導入方法依賴的package包/類
/**
 * Get board variant.
 *
 * @return Name of the board.
 */
private static String getBoardVariant() {
    if (!sBoardVariant.isEmpty()) {
        return sBoardVariant;
    }
    sBoardVariant = Build.DEVICE;
    // For the edison check the pin prefix
    // to always return Edison Breakout pin name when applicable.
    if (sBoardVariant.equals(DEVICE_EDISON)) {
        PeripheralManagerService pioService = new PeripheralManagerService();
        List<String> gpioList = pioService.getGpioList();
        if (gpioList.size() != 0) {
            String pin = gpioList.get(0);
            if (pin.startsWith("IO")) {
                sBoardVariant = DEVICE_EDISON_ARDUINO;
            }
        }
    }
    return sBoardVariant;
}
 
開發者ID:kevalpatel2106,項目名稱:smartswitch,代碼行數:25,代碼來源:BoardDefaults.java

示例2: getBoardVariant

import com.google.android.things.pio.PeripheralManagerService; //導入方法依賴的package包/類
private static String getBoardVariant() {
    if (!sBoardVariant.isEmpty()) {
        return sBoardVariant;
    }
    sBoardVariant = Build.DEVICE;
    // For the edison check the pin prefix
    // to always return Edison Breakout pin name when applicable.
    if (sBoardVariant.equals(DEVICE_EDISON)) {
        PeripheralManagerService pioService = new PeripheralManagerService();
        List<String> gpioList = pioService.getGpioList();
        if (gpioList.size() != 0) {
            String pin = gpioList.get(0);
            if (pin.startsWith("IO")) {
                sBoardVariant = DEVICE_EDISON_ARDUINO;
            }
        }
    }
    return sBoardVariant;
}
 
開發者ID:FoxLabMakerSpace,項目名稱:SIGHT-For-the-Blind,代碼行數:20,代碼來源:BoardDefaults.java

示例3: getBoardVariant

import com.google.android.things.pio.PeripheralManagerService; //導入方法依賴的package包/類
private static String getBoardVariant() {
    if (!sBoardVariant.isEmpty()) {
        return sBoardVariant;
    }
    sBoardVariant = Build.DEVICE;
    // For the edison check the pin prefix
    // to always return Edison Breakout pin name when applicable.
    if (sBoardVariant.equals(DEVICE_EDISON)) {
        final PeripheralManagerService pioService = new PeripheralManagerService();
        final List<String> gpioList = pioService.getGpioList();
        if (gpioList.size() != 0) {
            final String pin = gpioList.get(0);
            if (pin.startsWith("IO")) {
                sBoardVariant = DEVICE_EDISON_ARDUINO;
            }
        }
    }
    return sBoardVariant;
}
 
開發者ID:dennisg,項目名稱:i2c-address-scanner,代碼行數:20,代碼來源:BoardDefaults.java

示例4: initialize

import com.google.android.things.pio.PeripheralManagerService; //導入方法依賴的package包/類
@Override
protected void initialize() {
    PeripheralManagerService peripheralManagerService = new PeripheralManagerService();
    List<String> portList = peripheralManagerService.getGpioList();
    if (portList.isEmpty()) {
        Log.i(TAG, "No GPIO port available on this device.");
    } else {
        Log.i(TAG, "List of available ports: " + portList);
    }
}
 
開發者ID:nosmurf,項目名稱:lightgaro,代碼行數:11,代碼來源:ThingsPresenter.java

示例5: OLEDBlock

import com.google.android.things.pio.PeripheralManagerService; //導入方法依賴的package包/類
public OLEDBlock() throws IOException {
    PeripheralManagerService peripheralManagerService = new PeripheralManagerService();

    // Make sure GPIO is available for buttons
    List<String> gpioList = peripheralManagerService.getGpioList();
    if (gpioList.isEmpty()) {
        Log.i(TAG, "No GPIO available on this device.");
        throw new IOException("GPIO interface is require");
    } else {
        Log.i(TAG, "List of available GPIO : " + gpioList);
        for ( int i = 0; i < GPIOButtons.length; i ++ ) {
            if ( gpioList.contains(GPIOButtons[i]) == false )
                Log.i(TAG, "GPIO "+GPIOButtons[i]+" is not available on this device.");
        }
        // SSD1306
        if (gpioList.contains("GP14")== false )
            Log.i(TAG, "GPIO GP14 is not available on this device.");
        if (gpioList.contains("GP15")== false )
            Log.i(TAG, "GPIO GP15 is not available on this device.");
    }

    // SPI will be use by SSD1306 OLED display
    List<String> spiList = peripheralManagerService.getSpiBusList();
    if (spiList.isEmpty()) {
        Log.i(TAG, "No SPI available on this device.");
        throw new IOException("SPI interface is require");
    } else {
        Log.i(TAG, "List of available SPI : " + spiList);
    }

    // Setup button
    for ( int i = 0 ; i < GPIOButtons.length; i++ ) {
        ButtonInputDriver buttonInputDriver = new ButtonInputDriver(GPIOButtons[i],
                Button.LogicState.PRESSED_WHEN_LOW,
                buttons[i] // the keycode to send
        );
        buttonInputDriver.register();
        buttonInputDriverList.add(buttonInputDriver);
    }

    try {
        ssd1306 = new SSD1306(spiList.get(0));
    } catch (InterruptedException e) {
        Log.e(TAG,"error",e);
        throw new IOException("Unable to init SSD1306");
    }

    Log.i(TAG, "Completed init");
}
 
開發者ID:hongcheng79,項目名稱:androidthings,代碼行數:50,代碼來源:OLEDBlock.java


注:本文中的com.google.android.things.pio.PeripheralManagerService.getGpioList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。