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.
counter.cpp
00001 /* 00002 * 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 00003 * 00004 * Includes 00005 */ 00006 #include "counter.h" 00007 00008 counter::counter(PinName channelA) : channelA_(channelA){ 00009 00010 pulses_ = 0; 00011 channelA_.rise(this, &counter::encode); 00012 00013 } 00014 00015 void counter::reset(void) { 00016 00017 pulses_ = 0; 00018 00019 } 00020 00021 int counter::getPulses(void) { 00022 00023 return pulses_; 00024 00025 } 00026 00027 void counter::encode(void) { 00028 00029 pulses_++; 00030 00031 }
Generated on Mon Jul 18 2022 02:03:22 by
1.7.2