mirs_esp_pio
Toggle main menu visibility
読み取り中…
検索中…
一致する文字列を見つけられません
Encoder.hpp
[詳解]
1
#pragma once
2
#include <stdint.h>
3
#include <Arduino.h>
4
5
#include "driver/pulse_cnt.h"
6
15
class
Encoder
{
16
public
:
17
static
constexpr
uint32_t
PULSES_PER_REV
= 2048;
18
static
constexpr
uint32_t
MULTIPLIER
= 4;
// X4 4逓倍
19
static
constexpr
int16_t
PCNT_LIMIT
= 20000;
20
21
Encoder
(uint8_t pin_a, uint8_t pin_b);
22
23
void
begin
();
24
int64_t
getCount
()
const
;
25
void
reset
();
26
uint32_t
countsPerRev
()
const
{
return
PULSES_PER_REV
*
MULTIPLIER
; }
27
28
private
:
29
uint8_t pin_a_;
30
uint8_t pin_b_;
31
pcnt_unit_handle_t unit_ =
nullptr
;
32
pcnt_channel_handle_t channel_a_ =
nullptr
;
33
pcnt_channel_handle_t channel_b_ =
nullptr
;
34
mutable
int32_t last_pcnt_count_ = 0;
35
mutable
int64_t extended_count_ = 0;
36
bool
initialized_ =
false
;
37
};
Encoder::getCount
int64_t getCount() const
定義
Encoder.cpp:65
Encoder::PCNT_LIMIT
static constexpr int16_t PCNT_LIMIT
定義
Encoder.hpp:19
Encoder::begin
void begin()
定義
Encoder.cpp:14
Encoder::countsPerRev
uint32_t countsPerRev() const
定義
Encoder.hpp:26
Encoder::reset
void reset()
定義
Encoder.cpp:85
Encoder::MULTIPLIER
static constexpr uint32_t MULTIPLIER
定義
Encoder.hpp:18
Encoder::PULSES_PER_REV
static constexpr uint32_t PULSES_PER_REV
定義
Encoder.hpp:17
Encoder::Encoder
Encoder(uint8_t pin_a, uint8_t pin_b)
定義
Encoder.cpp:9
lib
Encoder
Encoder.hpp
構築:
1.18.0