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.
rotary_encoder.cpp
- Committer:
- inst
- Date:
- 2016-06-25
- Revision:
- 10:684e1604e5ea
- Parent:
- 7:3b51e2c660b6
File content as of revision 10:684e1604e5ea:
#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_;
}
float rotary_encoder::read() const {
return get_revol_num();
}