Pin Bias Functions

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

Many platforms will provide programmable bias capability. This means programmable hardware to stabilize the state of a pin to its high or low state. For input pins the mechanism is usually a resistor: a pull-up resistor causes a pin to default to the high state and a pull-down resistor to the low state. Output pins may also be stabilized by resistors or sometimes by a weak drive. The GPIO class supports three bias modes specified in the enumeration TGpioBias:

  • pull-up (EPullUp), a bias to the high state

  • pull-down (EPullDown), a bias to the low state

  • no drive (ENoDrive), an absence of bias

Implement the pin bias functions

  • Implement SetPinBias() for each value of the enumeration TGpioBias.

    Only implement this function to return KErrNone if the pin has a programmable device to stabilise its electric state. Otherwise just implement it with return value KErrNotSupported.

    • Implement SetPinBias() with aBias == ENoDrive and return value KErrNone.

      Disable any resistor or weak drive forcing the pin to a default electrical state.

    • Implement SetPinBias() with aBias == EPullDown and return value .KErrNone.

      Cause the pin to default to its low electrical state by pull-down resistor, weak drive or other means.

    • Implement SetPinBias() with aBias == EPullUp and return value .KErrNone.

      Cause the pin to default to its high electrical state by pull-down resistor, weak drive or other means.

    • Implement SetPinBias() with return value KErrNotSupported.

      Return KErrNotSupported if the pin does not support setting the drive.

  • Implement GetPinBias() for each value of the enumeration TGpioBias.

    Only implement this function to return KErrNone if the pin has a programmable device to stabilise its electric state. Otherwise just implement it with return value KErrNotSupported.

    • Implement GetPinBias() with aBias containing ENoDrive and return value KErrNone.

      Verify that any stabilising device on the pin has been disabled. Set aBias to ENoDrive.

    • Implement GetPinBias() with aBias containing EPullDown and return value KErrNone.

      Verify that the pin has been set to default to its low electric state. Set aBias to EPullDown.

    • Implement GetPinBias() with aBias containing EPullUp and return value KErrNone.

      Verify that the pin has been set to default to its high electric state. Set aBias to EPullUp.

    • Implement GetPinBias() with return value KErrNotSupported.

      Return KErrNotSupported if the pin does not support reading the pin bias.