TIMn:
- Combined Channels を Encoder Mode に設定
- Counter Period を好きな値に設定する
- Encoder:
- A相とB相があるエンコーダーの場合、Encoder Mode を TI1 and TI2 に設定してください
- カウントアップとダウンの方向は Polarity で逆にすることができます
Encoder( TIM_HandleTypeDef *htim );
Encoder( TIM_HandleTypeDef &htim );
ピンを設定します
// 例 Encoder encoder(&htim2); Encoder encoder(htim2);
void start() noexcept;カウントを開始します
// 例 encoder.start();
void stop() noexcept;カウントを停止します
// 例 encoder.stop();
void update() noexcept;カウントを更新します
// 例 encoder.update();
int32_t getCount() const noexcept;カウントを取得します
// 例 encoder.getCount();
void setCount( int32_t count ) noexcept;カウントを任意の値に変更します
// 例 encoder.resetCount();
void resetCount() noexcept;カウントを 0 に変更します
// 例 encoder.resetCount();