JMotor
Loading...
Searching...
No Matches
JEncoderSingleAttachInterrupt.h
Go to the documentation of this file.
1#ifndef J_ENCODER_SINGLE_ATTACH_INTERRUPT_H
2#define J_ENCODER_SINGLE_ATTACH_INTERRUPT_H
3#include "JEncoderSingle.h"
4#include <Arduino.h>
11public:
21 JEncoderSingleAttachInterrupt(byte _encoderPin, float _distPerCountFactor = 1.0, bool _reverse = false, unsigned long _slowestIntervalMicros = 100000UL, unsigned long _switchBounceIntervalMicros = 0, byte _interruptType = CHANGE)
22 : JEncoderSingle(_encoderPin, _distPerCountFactor, _reverse, _slowestIntervalMicros, _switchBounceIntervalMicros, _interruptType)
23 {
24 }
28 void setUpInterrupts(void (*_isrPointer)(void))
29 {
30
31 pinMode(encoderPin, INPUT);
32
33 attachInterrupt(encoderPin, _isrPointer, interruptType);
34 }
36 {
37 detachInterrupt(encoderPin);
38 }
39};
40#endif
uses attachInterrupt() platform: esp32, teensy (could be used with standard avr arduinos but only wit...
Definition JEncoderSingleAttachInterrupt.h:10
JEncoderSingleAttachInterrupt(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 JEncoderSingleAttachInterrupt.h:21
void turnOffInterrupts()
disable interrupts and stop monitoring encoder
Definition JEncoderSingleAttachInterrupt.h:35
void setUpInterrupts(void(*_isrPointer)(void))
Definition JEncoderSingleAttachInterrupt.h:28
reads a single channel (incremental) encoder
Definition JEncoderSingle.h:15
byte interruptType
Definition JEncoderSingle.h:19
unsigned char encoderPin
Definition JEncoderSingle.h:18