lightbulb_outline Please take our October 2018 developer survey. Start survey

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.