forked from romeo987/TouchDRO_Interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathESP32_Touch_Tacho.h
48 lines (37 loc) · 864 Bytes
/
ESP32_Touch_Tacho.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// ESP32_Touch_Tacho.h
#ifndef _ESP32_TOUCH_TACHO_h
#define _ESP32_TOUCH_TACHO_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#ifndef _ESP32TACHO_h
#define _ESP32TACHO_h
#endif
#include "ESP32_Quad_Encoder.h"
class ESP32Tacho {
private:
unsigned long maxPulseInterval;
//int nopulseCount;
gpio_num_t tachoPinA;
enum pullupType puType;
void(setupPin(gpio_num_t pin));
public:
ESP32Tacho(int pinA, int pinB, float pulsePerRev, pullupType uip);
ESP32Tacho();
void attachTacho();
float get_ppm();
float pulsesPerRev;
float pulsesPerMinute;
volatile unsigned long timeOfLastPulse;
volatile unsigned long aggregateMicros;
unsigned long pulseInterval;
volatile int pulseCount;
bool running;
bool directionEnabled;
int direction;
gpio_num_t tachoPinB;
};
void IRAM_ATTR tacho_isr();
#endif