JMotor
Loading...
Searching...
No Matches
JEncoderPWMAbsolutePinChange.h
Go to the documentation of this file.
1#include "EnableInterrupt.h" //https://github.com/GreyGnome/EnableInterrupt
3#include <Arduino.h>
4#ifndef J_ENCODER_PWM_ABSOLUTE_PIN_CHANGE_H
5#define J_ENCODER_PWM_ABSOLUTE_PIN_CHANGE_H
14public:
26 JEncoderPWMAbsolutePinChange(byte _encoderPin, pwmSettings _ps, bool _reverse = false, float _distPerCountFactor = 1.0, unsigned long _velEnoughTime = 0, unsigned long _velEnoughTicks = 0, bool _resetAngleOnStart = false, uint16_t _zeroPos = 0)
27 : JEncoderPWMAbsolute(_encoderPin, _ps, _reverse, _distPerCountFactor, _velEnoughTime, _velEnoughTicks, _resetAngleOnStart, _zeroPos)
28 {
29 }
30
31 void setUpInterrupts(void (*_isrPointer)(void))
32 {
33 pinMode(encoderPin, INPUT);
34 enableInterrupt(encoderPin, _isrPointer, CHANGE);
35 }
37 {
38 disableInterrupt(encoderPin);
39 }
40};
41#endif
reads a PWM signal from an absolute encoder
Definition JEncoderPWMAbsolute.h:23
byte encoderPin
Definition JEncoderPWMAbsolute.h:56
uses a pin change interrupt library to support more pins than attachInterrupt().
Definition JEncoderPWMAbsolutePinChange.h:13
void turnOffInterrupts()
disable interrupts and stop monitoring encoder
Definition JEncoderPWMAbsolutePinChange.h:36
JEncoderPWMAbsolutePinChange(byte _encoderPin, pwmSettings _ps, bool _reverse=false, float _distPerCountFactor=1.0, unsigned long _velEnoughTime=0, unsigned long _velEnoughTicks=0, bool _resetAngleOnStart=false, uint16_t _zeroPos=0)
sets pins and settings for reading the encoder
Definition JEncoderPWMAbsolutePinChange.h:26
void setUpInterrupts(void(*_isrPointer)(void))
set up pins and interrupts
Definition JEncoderPWMAbsolutePinChange.h:31
struct for holding parameters for reading PWM Absolute Encoders
Definition JEncoderPWMAbsolute.h:28