JMotor
Loading...
Searching...
No Matches
JEncoderSinglePinChange.h
Go to the documentation of this file.
1#ifndef J_ENCODER_SINGLE_PIN_CHANGE_H
2#define J_ENCODER_SINGLE_PIN_CHANGE_H
3#include "EnableInterrupt.h" //https://github.com/GreyGnome/EnableInterrupt
4#include "JEncoderSingle.h"
5#include <Arduino.h>
14public:
24 JEncoderSinglePinChange(byte _encoderPin, float _distPerCountFactor = 1.0, bool _reverse = false, unsigned long _slowestIntervalMicros = 100000UL, unsigned long _switchBounceIntervalMicros = 0, byte _interruptType = CHANGE)
25 : JEncoderSingle(_encoderPin, _distPerCountFactor, _reverse, _slowestIntervalMicros, _switchBounceIntervalMicros, _interruptType)
26 {
27 }
28
32 void setUpInterrupts(void (*_isrPointer)(void))
33 {
34 pinMode(encoderPin, INPUT);
35
36 enableInterrupt(encoderPin, _isrPointer, interruptType);
37 }
39 {
40 disableInterrupt(encoderPin);
41 }
42};
43#endif
reads a single channel (incremental) encoder
Definition JEncoderSingle.h:15
byte interruptType
Definition JEncoderSingle.h:19
unsigned char encoderPin
Definition JEncoderSingle.h:18
uses a pin change interrupt library to support more pins than attachInterrupt().
Definition JEncoderSinglePinChange.h:13
void setUpInterrupts(void(*_isrPointer)(void))
Definition JEncoderSinglePinChange.h:32
JEncoderSinglePinChange(byte _encoderPin, float _distPerCountFactor=1.0, bool _reverse=false, unsigned long _slowestIntervalMicros=100000UL, unsigned long _switchBounceIntervalMicros=0, byte _interruptType=CHANGE)
constructor, sets pins and settings
Definition JEncoderSinglePinChange.h:24
void turnOffInterrupts()
disable interrupts and stop monitoring encoder
Definition JEncoderSinglePinChange.h:38