Describes the pin mode functions in GPIO.
The GPIO interface class is specified at the level of the pin and
so are the modes. A pin has three modes namely, Enabled, Disabled and Idle as specified
in the enumeration TGpioMode
. The mode of the pin
affects the mode of the module. When a pin is set to Enabled or Disabled
mode, the implementation should set the module to the same mode. When
a pin is set to Idle, the implementation should attempt to set the
module to Idle, but the state and configuration of the other pins
on the module may override this. When a module is set to Idle the
implementation should set its pins to Idle mode.
Implement SetPinMode()
for each value
of the enumeration TGpioMode
.
Implement SetPinMode()
with aMode
== EEnabled
and return value KErrNone
.
Enable the pin for GPIO. Make any functionality other than GPIO unavailable. Enable the module if it is not already enabled. This typically requires power and clocks to be supplied to the module.
Implement SetPinMode()
with aMode
== EDisabled
and return value KErrNone
.
Disable the pin for GPIO. Disable the module for GPIO.
Only a all to SetPinMode
with aMode
== EEnabled
should return the pin to the enabled
state. If the pin is enabled for another function, that fact is irrelevant.
Implement SetPinMode()
with
aMode
== EIdle
and
return value KErrNone
.
Only implement this if the platform supports the idle state.
When the pin is set to the idle state, the implementation should also attempt to move the module to the idle state.
Implement SetPinMode()
with
return value KErrNotReady
.
Return KErrNotReady
when a pin which has requested a return to the idle
state is not ready to do so.
Implement SetPinMode()
with
return value KErrNotSupported
.
Return KErrNotSupported
if the pin is not available for GPIO because it has
been assigned an alternative function and also where EIdle
is passed and the platform does not
support an idle state.
Implement GetPinMode()
for each
value of the enumeration TGpioMode
.
Implement GetPinMode()
with
aMode
containing EEnabled
and return value KErrNone
.
Verify that the pin is already enabled for
GPIO and able to work according to its configuration.
Set aMode
to EEnabled
.
Implement GetPinMode()
with
aMode
containing EDisabled
and return value KErrNone
.
Verify that the module is already disabled and the pin cannot be used for GPIO. If the pin is enabled for another function, that fact is irrelevant.
Implement GetPinMode()
with
aMode
containing EIdle
and return value KErrNone
.
Only implement this if the platform supports the idle state.
Verify that the module is already in an idle state.
Implement GetPinMode()
with
return value KErrNotSupported
.
Return KErrNotSupported
if the platform does not support reading the pin mode.