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: counter/counter.cpp
- Revision:
- 0:be447af0921d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/counter/counter.cpp Fri Nov 25 14:32:50 2011 +0000
@@ -0,0 +1,31 @@
+/*
+ * Based on Aaron Berk's library for a QEI (http://mbed.org/users/aberk/libraries/QEI/le4bkf), this mainly involved deleting most of the functionality
+ *
+ * Includes
+ */
+#include "counter.h"
+
+counter::counter(PinName channelA) : channelA_(channelA){
+
+ pulses_ = 0;
+ channelA_.rise(this, &counter::encode);
+
+}
+
+void counter::reset(void) {
+
+ pulses_ = 0;
+
+}
+
+int counter::getPulses(void) {
+
+ return pulses_;
+
+}
+
+void counter::encode(void) {
+
+ pulses_++;
+
+}
\ No newline at end of file