summaryrefslogtreecommitdiff
path: root/src/counter.cpp
blob: 89e597cddfbf2a646887011fb5bfdc3fde94ab8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "counter.h"

Counter::Counter(PinName pin):_interrupt(pin)
{
	_interrupt.rise(this, &Counter::increment);
}

void Counter::increment()
{
	_count++;
}

int Counter::read()
{
	return _count;
}

void Counter::write(int new_count)
{
	_count = new_count;
}