Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ExioMcp23s17DebounceIn Class Reference
DebounceIn adds mechanical switch debouncing to DigitialIn. More...
#include <ExioMcp23s17DebounceIn.h>
Inherits ExioMcp23s17DigitalIn.
Public Member Functions | |
| void | set_debounce_us (int i) |
| set_debounce_us | |
| void | set_samples (int i) |
| set_samples | |
| int | read (void) |
| read | |
| operator int () | |
| operator int() | |
| ExioMcp23s17DebounceIn (ExioMcp23s17 *_pDevice, ExioPort _port, int _pin) | |
| Constructor. | |
Detailed Description
DebounceIn adds mechanical switch debouncing to DigitialIn.
Example:
#include "mbed.h" #include "DebounceIn.h" DebounceIn d(p5); DigitialOut led1(LED1); DigitialOut led2(LED2); int main() { while(1) { led1 = d; led2 = d.read(); } }
- See also:
- set_debounce_us() To change the sampling frequency.
- set_samples() To alter the number of samples.
Users of this library may also be interested in PinDetect library:-
This example shows one input displayed by two outputs. The input is debounced by the default 10ms.
Definition at line 62 of file ExioMcp23s17DebounceIn.h.
Constructor & Destructor Documentation
| ExioMcp23s17DebounceIn | ( | ExioMcp23s17 * | _pDevice, |
| ExioPort | _port, | ||
| int | _pin | ||
| ) |
Constructor.
- Parameters:
-
_pDevice The ExioMcp23s17 object _port The port _pin The pin number
Definition at line 102 of file ExioMcp23s17DebounceIn.h.
Member Function Documentation
| operator int | ( | ) |
operator int()
Read the value of the debounced pin.
Definition at line 93 of file ExioMcp23s17DebounceIn.h.
| int read | ( | void | ) |
| void set_debounce_us | ( | int | i ) |
set_debounce_us
Sets the debounce sample period time in microseconds, default is 1000 (1ms)
- Parameters:
-
int i The debounce sample period time to set.
Definition at line 71 of file ExioMcp23s17DebounceIn.h.
| void set_samples | ( | int | i ) |
set_samples
Defines the number of samples before switching the shadow definition of the pin.
- Parameters:
-
int i The number of samples.
Definition at line 80 of file ExioMcp23s17DebounceIn.h.
Generated on Thu Jul 14 2022 16:20:00 by
1.7.2