Renamed MD_REncoder to MD_REncoderPlus for avoiding complications with updated original

MD_REncoder.
dev
Holger Wirtz 1 year ago
parent c8a8959419
commit 85ef63db9c
  1. 4
      UI.hpp
  2. 0
      third-party/MD_REncoderPlus/ISSUE_TEMPLATE.md
  3. 0
      third-party/MD_REncoderPlus/LICENSE
  4. 0
      third-party/MD_REncoderPlus/PULL_REQUEST.md
  5. 0
      third-party/MD_REncoderPlus/README.md
  6. 0
      third-party/MD_REncoderPlus/examples/Polling/Polling.ino
  7. 0
      third-party/MD_REncoderPlus/keywords.txt
  8. 0
      third-party/MD_REncoderPlus/library.properties
  9. 18
      third-party/MD_REncoderPlus/src/MD_REncoderPlus.cpp
  10. 8
      third-party/MD_REncoderPlus/src/MD_REncoderPlus.h

@ -26,12 +26,12 @@
#include "config.h" #include "config.h"
#include <LCDMenuLib2.h> #include <LCDMenuLib2.h>
#include <MD_REncoder.h>
#include <effect_modulated_delay.h> #include <effect_modulated_delay.h>
#include <effect_stereo_mono.h> #include <effect_stereo_mono.h>
#include <effect_mono_stereo.h> #include <effect_mono_stereo.h>
#include <effect_platervbstereo.h> #include <effect_platervbstereo.h>
#include <template_mixer.hpp> #include <template_mixer.hpp>
#include "MD_REncoderPlus.h"
#include "disp_plus.h" #include "disp_plus.h"
#include "midi_devices.hpp" #include "midi_devices.hpp"
#include "synth_dexed.h" #include "synth_dexed.h"
@ -473,7 +473,7 @@ private:
bool down; bool down;
}; };
MD_REncoder ENCODER[NUM_ENCODER] = { MD_REncoder(ENC_R_PIN_B, ENC_R_PIN_A), MD_REncoder(ENC_L_PIN_B, ENC_L_PIN_A) }; MD_REncoderPlus ENCODER[NUM_ENCODER] = { MD_REncoderPlus(ENC_R_PIN_B, ENC_R_PIN_A), MD_REncoderPlus(ENC_L_PIN_B, ENC_L_PIN_A) };
EncoderDirection encoderDir[NUM_ENCODER]; EncoderDirection encoderDir[NUM_ENCODER];
long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = { 0, 0 }; long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = { 0, 0 };

@ -1,5 +1,5 @@
/* /*
MD_REncoder - Library for Rotary Encoders MD_REncoderPlus - Library for Rotary Encoders
See header file for comments See header file for comments
@ -25,9 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** /**
* \file * \file
* \brief Implements core MD_REncoder class methods * \brief Implements core MD_REncoderPlus class methods
*/ */
#include <MD_REncoder.h> #include <MD_REncoderPlus.h>
/* /*
* The below state table has, for each state (row), the new state * The below state table has, for each state (row), the new state
@ -77,7 +77,7 @@ const unsigned char ttable[][4] =
}; };
#endif #endif
MD_REncoder::MD_REncoder(uint8_t pinA, uint8_t pinB): MD_REncoderPlus::MD_REncoderPlus(uint8_t pinA, uint8_t pinB):
_pinA (pinA), _pinB (pinB), _state(R_START) _pinA (pinA), _pinB (pinB), _state(R_START)
#if ENABLE_SPEED #if ENABLE_SPEED
, _period(DEFAULT_PERIOD), _count(0), _spd(0), _timeLast(0) , _period(DEFAULT_PERIOD), _count(0), _spd(0), _timeLast(0)
@ -85,7 +85,7 @@ _pinA (pinA), _pinB (pinB), _state(R_START)
{ {
} }
void MD_REncoder::begin(void) void MD_REncoderPlus::begin(void)
{ {
pinMode(_pinA, (ENABLE_PULLUPS ? INPUT_PULLUP : INPUT)); pinMode(_pinA, (ENABLE_PULLUPS ? INPUT_PULLUP : INPUT));
pinMode(_pinB, (ENABLE_PULLUPS ? INPUT_PULLUP : INPUT)); pinMode(_pinB, (ENABLE_PULLUPS ? INPUT_PULLUP : INPUT));
@ -93,7 +93,7 @@ void MD_REncoder::begin(void)
last_dir=DIR_NONE; last_dir=DIR_NONE;
} }
void MD_REncoder::update(void) void MD_REncoderPlus::update(void)
// Grab state of input pins, determine new state from the pins // Grab state of input pins, determine new state from the pins
// and state table, and return the emit bits (ie the generated event). // and state table, and return the emit bits (ie the generated event).
{ {
@ -125,12 +125,12 @@ void MD_REncoder::update(void)
} }
} }
int32_t MD_REncoder::read_value(void) int32_t MD_REncoderPlus::read_value(void)
{ {
return (value); return (value);
} }
int8_t MD_REncoder::read(void) int8_t MD_REncoderPlus::read(void)
{ {
switch(last_dir) switch(last_dir)
{ {
@ -145,7 +145,7 @@ int8_t MD_REncoder::read(void)
} }
void MD_REncoder::write(int32_t v) void MD_REncoderPlus::write(int32_t v)
{ {
value=v; value=v;
} }

@ -94,7 +94,7 @@ direction or the other.
It's also possible to use 'half-step' mode. This just emits an event at both the It's also possible to use 'half-step' mode. This just emits an event at both the
0-0 and 1-1 positions. This might be useful for some encoders where you want to 0-0 and 1-1 positions. This might be useful for some encoders where you want to
detect all positions. In MD_REncoder.h set ENABLE_HALF_STEP to 1 to enable detect all positions. In MD_REncoderPlus.h set ENABLE_HALF_STEP to 1 to enable
half-step mode. half-step mode.
If an invalid state happens (for example we go from '0-1' straight to '1-0'), the If an invalid state happens (for example we go from '0-1' straight to '1-0'), the
@ -187,9 +187,9 @@ speed = ClickCount * (1000 / period)
#define DIR_CCW 0x20 #define DIR_CCW 0x20
/** /**
* Core object for the MD_REncoder library * Core object for the MD_REncoderPlus library
*/ */
class MD_REncoder class MD_REncoderPlus
{ {
public: public:
/** /**
@ -200,7 +200,7 @@ class MD_REncoder
* \param pinA the pin number for the encoder A output * \param pinA the pin number for the encoder A output
* \param pinB the pin number for the encoder B output * \param pinB the pin number for the encoder B output
*/ */
MD_REncoder(uint8_t pinA, uint8_t pinB); MD_REncoderPlus(uint8_t pinA, uint8_t pinB);
/** /**
* Initialize the object. * Initialize the object.
Loading…
Cancel
Save