Contains code for debouncing noisy ditital inputs, like buttons. More...
Go to the source code of this file.
Contains code for debouncing noisy ditital inputs, like buttons.
Functions for debouncing noisy digital inputs, like buttons for example. See Usage for details how to use it. This module is automatically enabled in the system as soon as any DEBOUNCE_GET_PORTn defines are added to the projdefs.h file (as described in "Usage" section).
The following defines are used to configure this module, and should be placed in projdefs.h. Note that all items marked [-DEFAULT-] are defaults, and do not have to be placed in projdefs.h if they contain desired configuration! For details, see Project Configuration.
To use this module, the following must be done:
An example how to use this module to debounce buttons connected to ports 4 and 7 (old port names X4 and X7). First, the following must be added to the projdefs.h file:
After doing this, this module will automatically be enabled in the system (debounceService() is called every 20ms). We can now use the debounceGetLatchedPort() function to get the debounced port values. For example:
If a button is attached to pin 4 (old port name X4), it should be tied to 3.3V via a resistor(10k for example). And, the internal pull-down resistor of port 4 (X4) should be enabled.
The software supplied herewith is owned by Modtronix Engineering, and is protected under applicable copyright laws. The software supplied herewith is intended and supplied to you, the Company customer, for use solely and exclusively on products manufactured by Modtronix Engineering. The code may be modified and can be used free of charge for commercial and non commercial applications. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
File History
2013-10-28, David H. (DH):