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.
Diff: capsense.cpp
- Revision:
- 1:40e5ac1119a6
- Parent:
- 0:4e3ad938564e
- Child:
- 2:d9745be6c253
diff -r 4e3ad938564e -r 40e5ac1119a6 capsense.cpp --- a/capsense.cpp Tue Jun 28 21:32:51 2022 +0000 +++ b/capsense.cpp Tue Jul 12 13:02:25 2022 -0400 @@ -7,16 +7,17 @@ bool CapSense::toggle() { bool last_signal = square_wave.read(); - square_wave.write(!last_signal); - if (!last_signal) { - measured_this_cycle = false; - timer.start(); - } - return !last_signal; + square_wave.write(!last_signal); + if (!last_signal) { + measured_this_cycle = false; + timer.start(); + } + return !last_signal; } bool CapSense::try_measure() { - if (cap_sense_measure.read() == 1 && !measured_this_cycle) { + if (cap_sense_measure.read() == 1 && !measured_this_cycle) + { timer.stop(); last_measurement = timer.read(); measured_this_cycle = true;