Pin Direction Functions

Describes the pin direction functions involved in implementing the GPIO interface class.

Pins are used as inputs or outputs of binary signals. The GPIO interface class does not support bidirectional pins. However, some platforms allow pins to be in a quiescent state (also called floating or tri-stated). In this case a pin can be in one of three logical states namely, True, False or quiescent as specified in the enumeration TGpioDirection. The relevant three-valued logic is specified in this table.

Input

Output

A

B

C

0

0

Z

1

0

Z

0

1

0

1

1

1

Implement the pin direction functions

  • Implement SetPinDirection() for each value of the enumeration TGpioDirection.

    • Implement SetPinDirection() with aDirection == EInput and return value KErrNone.

      Set the pin to behave as an input binary signal.

    • Implement SetPinDirection() with aDirection == EOutput and return value KErrNone.

      Set the pin to behave as an output binary signal.

    • Implement SetPinDirection() with aDirection == ETriStated and return value KErrNone.

      Set the pin to be in a quiescent state (also called floating or deactivated).

      Only implement this if the platform supports the quiescent state. The physical state of the pin will be determined by the drive on the line.

    • Implement SetPinDirection() with return value KErrNotSupported.

      Return KErrNotSupported if the pin cannot operate in the direction specified, for instance if ETriStated has been passed and the platform does not support the quiescent state.

  • Implement GetPinDirection() for each value of the enumeration TGpioDirection.

    • Implement GetPinDirection() with aDirection containing EInput and return value KErrNone.

      Verify that the pin is behaving as a binary input signal. Set aDirection to EInput

    • Implement GetPinDirection() with aDirection containing EOutput and return value KErrNone.

      Verify that the pin is behaving as a binary output signal. Set aDirection to EInput

    • Implement GetPinDirection() with aDirection containing ETriStated and return value KErrNone.

      Verify that the pin is in the quiescent state. Set aDirection to ETriStated

    • Implement GetPinDirection() with return value KErrNotSupported.

      Return KErrNotSupported if reading the pin direction is not supported.