GPIO Interface Overview

Provides a summary of GPIO platform service class and functions.

The General Purpose Input Output (GPIO) platform service is provided by the GPIO class.

Input/Output functions

API Description
GPIO::SetOutputState(TInt aId, TGpioState aState) Set the output pin to one of the supported states described in the TGpioState enumeration. Implement SetOutputState() function for each supported state synchronously.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if the state is not supported or if setting its state synchronously is not supported.

GPIO::GetOutputState(TInt aId, TGpioState& aState) Get the current state of an output pin synchronously.

Return: KErrNone, if successful; KErrArgument, if aId is invalid.

GPIO::GetInputState(TInt aId, TGpioState& aState) Get the current state of an input pin synchronously.

Return: KErrNone, if accepted; KErrArgument, if aId is invalid. KErrNotSupported, if reading the state asynchronously is not supported.

GPIO::GetInputState(TInt aId, TGpioCallback* aCb) Get the current state of an input pin asynchronously. The result of the read operation and the state of the input pin will be passed as an argument to the callback function. This API should be used with off-chip GPIO modules only.

Return: KErrNone, if successful; KErrArgument, if aId is invalid. KErrNotSupported, if reading the state synchronously is not supported.

Pin mode functions

API Description
GPIO::SetPinMode(TInt aId, TGpioMode aMode) Set the pins in one of the modes described in the TGpioMode enumeration.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotReady, when a pin that has requested to be Idle is not ready to do so; KErrNotSupported, if a pin cannot be used as a GPIO because it has been assigned an alternative function. When disabling a pin, the module which the pin is a part of may not be disabled, but KErrNone is still returned.

GPIO::GetPinMode(TInt aId, TGpioMode& aMode) Get the pin mode.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if reading the pin mode is not supported.

Pin direction functions

API Description
GPIO::SetPinDirection(TInt aId, TGpioDirection aDirection) Set the direction of a pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if a pin cannot operate in the direction specified.

GPIO::GetPinDirection(TInt aId, TGpioDirection& aDirection) Get the direction of a pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if reading the pin direction is not supported.

Pin bias functions

API Description
GPIO::SetPinBias(TInt aId, TGpioBias aBias) Set the bias on a pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if a pin does not support setting the drive.

GPIO::GetPinBias(TInt aId, TGpioBias& aBias) Get the bias on a pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if reading the pin bias is not supported.

Pin idle functions

API Description
GPIO::SetPinIdleConfigurationAndState(TInt aId, TInt aConf) Set the idle configuration and state of a pin. The pin configuration is the same that the pin should have when setting the mode to EIdle and the state is the same as it should present when setting the output state to EIdleState.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if setting the pin idle configuration and state are not supported.

GPIO::GetPinIdleConfigurationAndState(TInt aId, TInt& aConf) Get the idle configuration and the state of a pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported, if reading the pin idle configuration and state is not supported.

Interrupt functions

API Description
GPIO::BindInterrupt(TInt aId, TGpioIsr aIsr, TAny* aPtr) Bind an interrupt ID with the interrupt service routine function.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support interrupts; KErrInUse, if an ISR is already bound to this interrupt.

GPIO::UnbindInterrupt(TInt aId) Unbind an interrupt ID from the interrupt service routine function.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support interrupts; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::EnableInterrupt(TInt aId) Enable the interrupt on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support interrupts; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::DisableInterrupt(TInt aId) Disable the interrupt on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support interrupts; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::IsInterruptEnabled(TInt aId, TBool& aEnable) Check if the interrupt is enabled on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support interrupts; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::ClearInterrupt(TInt aId) Clear an interrupt on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if clearing interrupt signal is not supported on this pin; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::GetMaskedInterruptState(TInt aId, TBool& aActive) Get the interrupt state using a mask as the output by the interrupt controller.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if reading interrupt state is not supported; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::GetRawInterruptState(TInt aId, TBool& aActive) Get the interrupt state of a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if reading raw interrupt state is not supported; KErrGeneral, if there is no ISR bound to this interrupt.

GPIO::SetInterruptTrigger(TInt aId, TGpioDetectionTrigger aTrigger) Set the interrupt trigger on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support interrupts.

Wakeup functions

API Description
GPIO::EnableWakeup(TInt aId) Enable the wakeup function on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support wakeup.

GPIO::DisableWakeup(TInt aId) Disable wakeup on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support wakeup.

GPIO::IsWakeupEnabled(TInt aId, TBool& aEnable) Check if wakeup is enabled on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support wakeups.

GPIO::SetWakeupTrigger(TInt aId, TGpioDetectionTrigger aTrigger) Set the wakeup trigger on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support wakeup.

Debounce functions

API Description
GPIO::SetDebounceTime(TInt aId, TInt aTime) Set the debouncing time on a specified pin.

Return: KErrNone, if the time is successfully changed or no change is needed (see below); KErrArgument, if aId is invalid; KErrNotSupported if pin does not support debouncing. If the requested time is greater than the common value for the module, the latter is increased to the value requested. If the requested time is lesser than the common value for the module then the common value is unchanged, unless it is set to the value requested on this pin.

GPIO::GetDebounceTime(TInt aId, TInt& aTime) Get the debouncing time on a specified pin.

Return: KErrNone, if successful; KErrArgument, if aId is invalid; KErrNotSupported if pin does not support debouncing.

The header file for the GPIO can be located here.

Related information