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: rotary_encoder.cpp
- Revision:
- 0:caf1d0bc4b90
- Child:
- 2:4580c3869b7b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/rotary_encoder.cpp Sat Feb 06 14:24:56 2016 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+#include "rotary_encoder.hpp"
+
+const size_t rotary_encoder::max_counts_ = 0xFFFF;
+
+rotary_encoder::rotary_encoder(size_t resolution) :
+ resolution_(resolution) {}
+rotary_encoder::~rotary_encoder() {}
+
+float rotary_encoder::get_revol_num() const {
+ return static_cast<float>(get_counts()) / resolution_;
+}