com.motorola.oem.hapi
Class GpioInterruptConfig

java.lang.Object
  extended by com.motorola.oem.hapi.GpioInterruptConfig
Direct Known Subclasses:
GpioCounterConfig

public class GpioInterruptConfig
extends java.lang.Object

 Encapsulates all GPIO interrupt relevant data: notification type, debounce time and listener.
In order to configure GpioInput to receive interrupt event, one must get GpioInterruptConfig object through GpioInput's GpioInput.enableInterrupt(com.motorola.oem.hapi.GpioInterruptConfig) method.
Nofication type (high to low, low to high) and debounce time configuration is possible.
Nofication type default value will be both edges unless a new one will be configured by accessing setNotificationType(int) method.
Debounce time default value will be DEBOUNCE_NORMAL, unless new one will be configured through the setDebounce(int) method.
Debounce can be enabled/disabled through enableDebounce(boolean).


Interruptable GPIOs are:

GPIO1 - pin number 28 on 70 PIN connector
GPIO14 - pin number 19 on 70 PIN connector
GPIO15 - pin number 17 on 70 PIN connector
GPIO16 - pin number 16 on 70 PIN connector

Setting GpioInterruptListener object to handle events is mandatory.


Field Summary
static int DEBOUNCE_FAST
          A static final variable to specify DEBOUNCE_FAST type.
static int DEBOUNCE_NORMAL
          A static final variable to specify DEBOUNCE_NORMAL type.
static int NOTIFICATION_TYPE_BOTH_EDGES
          A static final variable to specify both edges notification type.
static int NOTIFICATION_TYPE_HIGH_TO_LOW
          A static final variable to specify high to low notification type.
static int NOTIFICATION_TYPE_LOW_TO_HIGH
          A static final variable to specify low to high notification type.
 
Constructor Summary
GpioInterruptConfig(GpioInterruptListener listener)
          Constructs a new GpioInterruptConfig with the listener specified.
 
Method Summary
 void enableDebounce(boolean isEnabled)
          Enables debounce feature.
 int getDebounce()
          Gets Debounce type member.
 int getNotificationType()
          Gets notificationType member.
 boolean isDebounceEnabled()
          Check Debounce status
 void setDebounce(int debounceType)
          Configures debounce time (in milliseconds) in case debounce option is enabled.
 void setGpioInterruptListener(GpioInterruptListener listener)
          Reconfigures existing listener.
 void setNotificationType(int notificationType)
          Sets notificationType member.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTIFICATION_TYPE_LOW_TO_HIGH

public static final int NOTIFICATION_TYPE_LOW_TO_HIGH
A static final variable to specify low to high notification type.

See Also:
Constant Field Values

NOTIFICATION_TYPE_HIGH_TO_LOW

public static final int NOTIFICATION_TYPE_HIGH_TO_LOW
A static final variable to specify high to low notification type.

See Also:
Constant Field Values

NOTIFICATION_TYPE_BOTH_EDGES

public static final int NOTIFICATION_TYPE_BOTH_EDGES
A static final variable to specify both edges notification type.

See Also:
Constant Field Values

DEBOUNCE_NORMAL

public static final int DEBOUNCE_NORMAL
A static final variable to specify DEBOUNCE_NORMAL type.

See Also:
Constant Field Values

DEBOUNCE_FAST

public static final int DEBOUNCE_FAST
A static final variable to specify DEBOUNCE_FAST type.

See Also:
Constant Field Values
Constructor Detail

GpioInterruptConfig

public GpioInterruptConfig(GpioInterruptListener listener)
Constructs a new GpioInterruptConfig with the listener specified.

Parameters:
listener - GpioListener
Method Detail

setNotificationType

public void setNotificationType(int notificationType)
Sets notificationType member.

Parameters:
notificationType - Notification type to trigger interrupt NOTIFICATION_TYPE_BOTH_EDGES, NOTIFICATION_TYPE_HIGH_TO_LOW, NOTIFICATION_TYPE_LOW_TO_HIGH.

getNotificationType

public int getNotificationType()
Gets notificationType member.

Returns:
Notification type to trigger interrupt NOTIFICATION_TYPE_BOTH_EDGES, NOTIFICATION_TYPE_HIGH_TO_LOW, NOTIFICATION_TYPE_LOW_TO_HIGH..

setGpioInterruptListener

public void setGpioInterruptListener(GpioInterruptListener listener)
Reconfigures existing listener. Used to reconfigure a listener existing in the object in order to use GpioInterruptConfig(com.motorola.oem.hapi.GpioInterruptListener) in a sequence of interrupt enabling with the same object but different listeners.

Parameters:
listener - External object for receiving interrupt events

enableDebounce

public void enableDebounce(boolean isEnabled)
Enables debounce feature. Debounce is enabled upon initialization.

Parameters:
isEnabled - boolean value to indicate enable/disable values

setDebounce

public void setDebounce(int debounceType)
                 throws GpioException
Configures debounce time (in milliseconds) in case debounce option is enabled. The initial Debounce value is 40ms.

Parameters:
debounceType - The debounce type to use on interrupt DEBOUNCE_NORMAL - 40 ms with 9 debounce samples DEBOUNCE_FAST - 10 ms with 3 debounce samples
Throws:
GpioException - Calling setDebounce with illegal debounce type. Error code - OEMException.ILLEGAL_PARAM_ERROR

getDebounce

public int getDebounce()
Gets Debounce type member.

Returns:
debounce type. DEBOUNCE_NORMAL - 40 ms with 9 debounce samples. DEBOUNCE_FAST - 10 ms with 3 debounce samples.

isDebounceEnabled

public boolean isDebounceEnabled()
Check Debounce status

Returns:
boolean value which indicates whether debounce is enabled or disabled