David Lloyd / Mbed 2 deprecated SF800_flowmeter

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers counter.cpp Source File

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 }