Dependents: serial_connected_mcu_nucleo rotary_encoder_mbed serial_connected_mcu_nucleo omuni_speed_pid ... more
Fork of rotary_encoder by
このライブラリは以下のプログラムに基いています https://developer.mbed.org/users/gregeric/code/Nucleo_Hello_Encoder/
rotary_encoder.cpp@10:684e1604e5ea, 2016-06-25 (annotated)
- Committer:
- inst
- Date:
- Sat Jun 25 05:40:31 2016 +0000
- Revision:
- 10:684e1604e5ea
- Parent:
- 7:3b51e2c660b6
add read() to rotary_encoder;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
inst | 0:caf1d0bc4b90 | 1 | #include "mbed.h" |
inst | 0:caf1d0bc4b90 | 2 | #include "rotary_encoder.hpp" |
inst | 0:caf1d0bc4b90 | 3 | |
inst | 0:caf1d0bc4b90 | 4 | const size_t rotary_encoder::max_counts_ = 0xFFFF; |
inst | 0:caf1d0bc4b90 | 5 | |
inst | 0:caf1d0bc4b90 | 6 | rotary_encoder::rotary_encoder(size_t resolution) : |
inst | 0:caf1d0bc4b90 | 7 | resolution_(resolution) {} |
inst | 0:caf1d0bc4b90 | 8 | rotary_encoder::~rotary_encoder() {} |
inst | 0:caf1d0bc4b90 | 9 | |
inst | 0:caf1d0bc4b90 | 10 | float rotary_encoder::get_revol_num() const { |
inst | 0:caf1d0bc4b90 | 11 | return static_cast<float>(get_counts()) / resolution_; |
inst | 0:caf1d0bc4b90 | 12 | } |
inst | 10:684e1604e5ea | 13 | |
inst | 10:684e1604e5ea | 14 | float rotary_encoder::read() const { |
inst | 10:684e1604e5ea | 15 | return get_revol_num(); |
inst | 10:684e1604e5ea | 16 | } |