#include <JoystickSwitchInput.h>
Public Member Functions | |
JoystickSwitchInput (AnalogDevice *analogDevice, pinid_t analogPin, EncoderCallbackFn callback) | |
JoystickSwitchInput (AnalogDevice *analogDevice, pinid_t analogPin, EncoderListener *listener) | |
void | setAccelerationParameters (float initialDelayPeriod, float decreaseDivisor) |
void | setTolerance (float midPoint_, float tolerance_) |
int | nextInterval (int forceApplied) |
void | exec () override |
Public Member Functions inherited from RotaryEncoder | |
RotaryEncoder (EncoderCallbackFn callback) | |
RotaryEncoder (EncoderListener *listener) | |
void | changePrecision (uint16_t maxValue, int currentValue, bool rolloverOnMax=false, int step=1) |
void | replaceCallback (EncoderCallbackFn callbackFn) |
void | replaceCallbackListener (EncoderListener *callbackFn) |
int | getCurrentReading () const |
void | setCurrentReading (int reading) |
void | increment (int8_t incVal) |
virtual void | encoderChanged () |
bool | didLastSyncSucceed () |
void | setUserIntention (EncoderUserIntention intention) |
EncoderUserIntention | getUserIntention () |
void | runCallback (int newVal) |
bsize_t | getMaximumValue () |
Additional Inherited Members | |
Protected Types inherited from RotaryEncoder | |
enum | EncoderFlagBits { LAST_SYNC_STATUS =0 , WRAP_AROUND_MODE , OO_LISTENER_CALLBACK , LAST_ENCODER_DIRECTION_UP } |
Protected Attributes inherited from RotaryEncoder | |
uint16_t | maximumValue |
uint16_t | currentReading |
uint8_t | stepSize |
union { | |
EncoderCallbackFn | callback |
EncoderListener * | encoderListener |
} | notify |
uint8_t | flags |
EncoderUserIntention | intent |
This class provides encoder functionality based on an analog joystick. Where up and down increase and reduce the value proportionally to how far down they are pressed.
Normally prefer to create an instance using setupAnalogJoystickEncoder
in this case there is nothing else to do.
Advanced usages: If you prefer to construct yourself, or want to use more than one encoder, then ensure that you create a task that runs once every 500millis and calls exec.
|
inline |
Constructor that initialises the class for use, prefer to use the set up method setupAnalogJoystickEncoder in simple cases.
analogDevice | the pointer to the analog AnalogDevice for example: &analog |
analogPin | the pin on which the joystick analog pin is connected to |
callback | the callback to provide updates to when the value changes. |
|
inline |
Constructor that initialises the class for use, prefer to use the set up method setupAnalogJoystickEncoder in simple cases.
analogDevice | the pointer to the analog AnalogDevice for example: &analog |
analogPin | the pin on which the joystick analog pin is connected to |
listener | the OO listener class implementation extending from EncoderListener. |
|
inline |
Provide alternative parameters for the initial repeat delay and the amount by which it divides downward toward the maximum speed for the amount the joystick is moved.
initialDelayPeriod | |
decreaseDivisor |
|
inline |
Use this for situations where the tolerance of the joystick slightly off. IE the mid point is not exactly half or the tolerance is not sufficiently large to ignore deviations in the voltage level.
midPoint_ | the new midpoint to use. |
tolerance_ | the size change to ignore around midpoint. |
|
inlineoverride |
Called by taskManager on a frequent basis. Ususally about every 250-500 millis