Debounce Functions

Describes the debounce functions involved in implementing the GPIO interface class.

Debouncing means filtering out distortions of the signal caused, for instance, by physical pressure on a key. Some platforms provide hardware mechanisms for debouncing, otherwise implementers must provide for debouncing by software. Both hardware and software debouncing involve sampling the signal at a specified interval. The GPIO interface class provides a function SetDebounceTime() to supply that interval but does not impose any restrictions on the implementation. Software debouncing can be performed at the level of the pin rather than the module, and this is strongly recommended where debouncing is performed by software.

Implement the debounce functions

  • Implement SetDebounceTime() with return value KErrNone.

    Verify that the platform supports debouncing either by hardware or software. Use the passed in value as the sampling interval in milliseconds.

    Only implement this if the platform supports debouncing.

  • Implement GetDebounceTime() with return value KErrNone.

    Determine value in milliseconds of the sampling interval used in debouncing and set aTime to that value.

    Only implement this if the platform supports debouncing.

  • Implement these functions with return value KErrNotSupported.

    • SetDebounceTime()

    • GetDebounceTime()

    Return KErrNotSupported if the pin does not support debouncing.