14#include <QuadEncoder.h>
19#define MAX_NUM_ENCODERS 3
27struct encoder_info_struct{
28 uint8_t CHANNEL_A_TEENSY_PIN;
29 uint8_t CHANNEL_B_TEENSY_PIN;
40class Encoder :
public Plugin{
47 void begin(uint8_t encoder_index);
65 void set(DecimalPosition value);
71 void set_latch(DecimalPosition value_world_units, uint8_t min_or_max);
72 void set_ratio(
float output_units,
float encoder_units = 1.0);
77 bool min_latch_enabled =
false;
78 bool max_latch_enabled =
false;
79 int32_t min_latch_value = 0;
80 int32_t max_latch_value = 0;
82 void enroll(
RPC *rpc,
const String& instance_name);
85 static const struct encoder_info_struct encoder_info[];
86 static QuadEncoder* all_encoders[MAX_NUM_ENCODERS];
87 void QuadEncoder_configure(uint8_t encoder_index);
88 QuadEncoder* quad_encoder;
89 uint8_t invert_flag = 0;
90 DecimalPosition encoder_value;
BlockPorts provide a unified interface for mapping inputs and outputs of different StepDance componen...
Definition core.hpp:148
void set(DecimalPosition value)
Sets the encoder position to a specified value in world units.
void set_latch(DecimalPosition value_world_units, uint8_t min_or_max)
Sets latching behavior for the encoder at specified world unit values.
void reset()
Resets the encoder position to zero.
void begin(uint8_t encoder_index)
Initializes the Encoder with the specified encoder index.
DecimalPosition read()
Returns the current position of the encoder in world units.
void invert()
Inverts the encoder direction. Useful for changing the direction without rewiring.
RPC class for handling remote procedure calls over serial streams.
Definition rpc.hpp:35