com.motorola.oem.hapi
Class GpioInput

java.lang.Object
  extended by com.motorola.oem.hapi.Gpio
      extended by com.motorola.oem.hapi.GpioInput

public final class GpioInput
extends Gpio

 GpioInput enables configuring each available gpio in the system as an input one.
In order to enable interrupt notifications on a GpioInput object, the developer should call enableInterrupt(com.motorola.oem.hapi.GpioInterruptConfig) with GpioInterruptConfig object (which holds all interrupt relevant data) as a parameter.

In order to enable counter notifications on a GpioInput object, the developer should call enableCounter(com.motorola.oem.hapi.GpioCounterConfig)with GpioCounterConfig object as a parameter.

Note: GpioInput cannot be configured to operate as an interrupt and a counter at the same time.


Constructor Summary
GpioInput(int gpioNum)
          Constructs a GpioInput object and configures the specified gpioNum as input.
 
Method Summary
 void disableCounter()
          Disables GpioCounter .
 void disableInterrupt()
          Disables GpioInterrupt.
 void enableCounter(GpioCounterConfig counter)
          Enables counter by using GpioCounterConfig parameter to access predefined counter configuration.
 void enableInterrupt(GpioInterruptConfig interrupt)
          Enables interrupt by using GpioInterruptConfig parameter to access predefined interrupt configuration.
 boolean isCounterEnable()
          Get Gpio counter status (enabled/disabled).
 boolean isInterruptEnable()
          Get Gpio interrupt status (enabled/disabled).
 boolean read()
          Reads GPIO's value.
 
Methods inherited from class com.motorola.oem.hapi.Gpio
clear, getNumber
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GpioInput

public GpioInput(int gpioNum)
          throws GpioException
Constructs a GpioInput object and configures the specified gpioNum as input.

Parameters:
gpioNum - The Gpio to be configured
Throws:
GpioException - Failed to configure gpio. Error code - OEMException.GENERAL_ERROR
Method Detail

read

public boolean read()
             throws GpioException
Reads GPIO's value.

Returns:
Value corresponding to the input line; true - High, false - Low
Throws:
GpioException - Gpio is not configured properly. Error code - OEMException.CONFIGURATION_ERROR

enableInterrupt

public void enableInterrupt(GpioInterruptConfig interrupt)
                     throws GpioException
Enables interrupt by using GpioInterruptConfig parameter to access predefined interrupt configuration. User must create GpioInterruptConfig object with all relevant data in order to enable interrupts and receive events upon interrupts from this GpioInput object.
In order to reconfigure interrupt, user should first call disableInterrupt() and only then enable interrupt with the new GpioInterruptConfig.

Parameters:
interrupt - GpioInterruptConfig holding interrupt relevant data
Throws:
GpioException - Device failed to enable interrupt. Error code - OEMException.GENERAL_ERROR. Calling enableInterrupt with an illegal parameter. Error code - OEMException.ILLEGAL_PARAM_ERROR

enableCounter

public void enableCounter(GpioCounterConfig counter)
                   throws GpioException
Enables counter by using GpioCounterConfig parameter to access predefined counter configuration. User should create GpioCounterConfig object with all relevant data in order to enable counter and receive events upon counter expiry from this GpioInput object.
In order to reconfigure counter, user should first call disableCounter() and only then enable counter with the new GpioCounterConfig.

Parameters:
counter - GpioCounterConfig holding counter relevant data
Throws:
GpioException - Device failed to enable counter. Error code - OEMException.GENERAL_ERROR Calling enableCounter with an illegal parameter. Error code - OEMException.ILLEGAL_PARAM_ERROR

disableInterrupt

public void disableInterrupt()
                      throws GpioException
Disables GpioInterrupt.

Throws:
GpioException - Gpio is not registered. Error code - OEMException.GENERAL_ERROR
See Also:
enableInterrupt(com.motorola.oem.hapi.GpioInterruptConfig)

disableCounter

public void disableCounter()
                    throws GpioException
Disables GpioCounter .

Throws:
GpioException - Gpio is not registered. Error code - OEMException.GENERAL_ERROR
See Also:
enableCounter(com.motorola.oem.hapi.GpioCounterConfig)

isInterruptEnable

public boolean isInterruptEnable()
Get Gpio interrupt status (enabled/disabled).

Returns:
True if enabled, false otherwise

isCounterEnable

public boolean isCounterEnable()
Get Gpio counter status (enabled/disabled).

Returns:
True if enabled, false otherwise