Stay organized with collections
Save and categorize content based on your preferences.
GpioCallback
public
interface
GpioCallback
com.google.android.things.pio.GpioCallback
|
GPIO interrupt callback.
First call setEdgeTriggerType(int)
to set an interrupt edge to watch, then
registerGpioCallback(Handler, GpioCallback)
to start getting callbacks.
Summary
Public methods |
abstract
boolean
|
onGpioEdge(Gpio gpio)
Called when an edge event triggers.
|
default
void
|
onGpioError(Gpio gpio, int error)
Called when an error occurs with the interrupt event listener.
|
Public methods
onGpioEdge
boolean onGpioEdge (Gpio gpio)
Called when an edge event triggers.
Parameters |
gpio |
Gpio : The Gpio that received an edge event. |
Returns |
boolean |
True to keep watching for events, false to stop.
|
onGpioError
void onGpioError (Gpio gpio,
int error)
Called when an error occurs with the interrupt event listener.
At this point the receiver should assume that this Gpio is no longer usable. No further
callbacks will be received on this object.
Parameters |
gpio |
Gpio : The Gpio that received an error. |
error |
int : An OsConstants errno code.
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# GpioCallback\n============\n\n\n`\npublic\n\n\ninterface\nGpioCallback\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------|\n| com.google.android.things.pio.GpioCallback |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nGPIO interrupt callback.\n\nFirst call [setEdgeTriggerType(int)](/reference/com/google/android/things/pio/Gpio#setEdgeTriggerType(int)) to set an interrupt edge to watch, then\n[registerGpioCallback(Handler, GpioCallback)](/reference/com/google/android/things/pio/Gpio#registerGpioCallback(android.os.Handler, com.google.android.things.pio.GpioCallback)) to start getting callbacks.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onGpioEdge](/reference/com/google/android/things/pio/GpioCallback#onGpioEdge(com.google.android.things.pio.Gpio))`(`[Gpio](/reference/com/google/android/things/pio/Gpio)` gpio) ` Called when an edge event triggers. |\n| ` default void` | ` `[onGpioError](/reference/com/google/android/things/pio/GpioCallback#onGpioError(com.google.android.things.pio.Gpio, int))`(`[Gpio](/reference/com/google/android/things/pio/Gpio)` gpio, int error) ` Called when an error occurs with the interrupt event listener. |\n\nPublic methods\n--------------\n\n### onGpioEdge\n\n```\nboolean onGpioEdge (Gpio gpio)\n```\n\nCalled when an edge event triggers.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|------------------------------------------------------|\n| `gpio` | `Gpio`: The Gpio that received an edge event. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|---------------------------------------------------------|\n| `boolean` | True to keep watching for events, false to stop. \u003cbr /\u003e |\n\n### onGpioError\n\n```\nvoid onGpioError (Gpio gpio, \n int error)\n```\n\nCalled when an error occurs with the interrupt event listener.\n\nAt this point the receiver should assume that this Gpio is no longer usable. No further\ncallbacks will be received on this object.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|---------------------------------------------------------------------------------------------------------------------|\n| `gpio` | `Gpio`: The Gpio that received an error. \u003cbr /\u003e |\n| `error` | `int`: An [OsConstants](https://developer.android.com/reference/android/system/OsConstants.html) errno code. \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [Gpio](/reference/com/google/android/things/pio/Gpio)\n - [GpioCallback](/reference/com/google/android/things/pio/GpioCallback)\n - [I2cDevice](/reference/com/google/android/things/pio/I2cDevice)\n - [Pwm](/reference/com/google/android/things/pio/Pwm)\n - [SpiDevice](/reference/com/google/android/things/pio/SpiDevice)\n - [UartDevice](/reference/com/google/android/things/pio/UartDevice)\n - [UartDeviceCallback](/reference/com/google/android/things/pio/UartDeviceCallback)\n-\n\n Classes\n -------\n\n - [PeripheralManager](/reference/com/google/android/things/pio/PeripheralManager)"]]