finished new encoder
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user