It is based on https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/

rotary_encoder.cpp

Committer:
inst
Date:
2016-04-09
Revision:
5:fae9a340d212
Parent:
2:4580c3869b7b

File content as of revision 5:fae9a340d212:

#include "mbed.h"
#include "rotary_encoder.hpp"

namespace mbed_stl {

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_;
}

} /* namespace mbed_stl */