finished new encoder

This commit is contained in:
2023-03-23 19:31:02 +01:00
parent 2f0027b68b
commit e4cdc5f98d
8 changed files with 104 additions and 13 deletions
+30
View File
@@ -0,0 +1,30 @@
#pragma once
#include <Arduino.h>
#include <driver/pcnt.h>
#define COUNTER_HIGH_LIMIT INT16_MAX
#define COUNTER_LOW_LIMIT 0
class Counter {
public:
Counter(uint8_t pin);
void pause();
void resume();
void clear();
int16_t getValue();
void setFilterValue(uint16_t value);
void filterEnable();
void filterDisable();
private:
static uint8_t amountOfCounter;
bool initalised = false;
uint8_t pulsePin;
pcnt_unit_t unit;
};