Extends DigitalIn to DebounceIn to provide mechanical switch debouncing. Fork of original https://os.mbed.com/users/AjK/code/DebounceIn/ and modification for compatibility under MbedOS6+
Revision 3:f58cd7168693, committed 2022-06-09
- Comitter:
- JohnnyK
- Date:
- Thu Jun 09 17:52:39 2022 +0000
- Parent:
- 2:31ae5cfb44a4
- Commit message:
- First under MbedOS6+
Changed in this revision
DebounceIn.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 31ae5cfb44a4 -r f58cd7168693 DebounceIn.h --- a/DebounceIn.h Fri May 31 17:31:17 2013 +0000 +++ b/DebounceIn.h Thu Jun 09 17:52:39 2022 +0000 @@ -1,5 +1,6 @@ /* Copyright (c) 2010 Andy Kirkham + Copyright (c) 2022 Jan Kamidra Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -47,9 +48,6 @@ * @see set_debounce_us() To change the sampling frequency. * @see set_samples() To alter the number of samples. * - * Users of this library may also be interested in PinDetect library:- - * @see http://mbed.org/users/AjK/libraries/PinDetect/latest - * * This example shows one input displayed by two outputs. The input * is debounced by the default 10ms. */ @@ -63,7 +61,7 @@ * * @param int i The debounce sample period time to set. */ - void set_debounce_us(int i) { _ticker.attach_us(this, &DebounceIn::_callback, i); } + void set_debounce_us(int i) { _ticker.attach(callback(this, &DebounceIn::_callback), std::chrono::microseconds(i)); } /** set_samples *