1#include <sys/_stdint.h>
13#include "channels.hpp"
19#define NUM_AVAILABLE_INPUT_PORTS 6
24#define INPUT_B_LEGACY 4
25#define INPUT_C_LEGACY 5
27#define FLEXPWM_CHANNEL_X 0
28#define FLEXPWM_CHANNEL_A 1
29#define FLEXPWM_CHANNEL_B 2
31#define FLEXPWM_CLOCK_MHZ 150
33#define SIGNAL_MIN_WIDTH_US 2
39struct input_port_info_struct{
41 uint8_t STEP_TEENSY_PIN;
42 uint8_t DIR_TEENSY_PIN;
46 IMXRT_FLEXPWM_t *FLEXPWM;
48 uint8_t FLEXPWM_CHANNEL;
50 volatile uint32_t *SELECT_INPUT_REGISTER;
51 uint32_t SELECT_REGISTER_VALUE;
80 void begin(uint8_t port_number);
104 void set_ratio(
float output_units,
float input_units = 1.0);
109 void enroll(
RPC *rpc,
const String& instance_name);
111 volatile uint32_t input_interrupt_cycles;
151 static const struct input_port_info_struct port_info[];
152 static InputPort *indexed_input_ports[NUM_AVAILABLE_INPUT_PORTS];
154 IMXRT_FLEXPWM_t *FLEXPWM;
156 uint8_t SUBMODULE_BIT;
157 uint8_t FLEXPWM_CHANNEL;
159 volatile uint16_t last_pulse_width_count;
163 bool signal_enable_flags[NUM_SIGNALS] = {
true,
true,
true};
167 static void input_A_isr();
168 static void input_B_isr();
169 static void input_C_isr();
170 static void input_D_isr();
171 static void input_B_legacy_isr();
172 static void input_C_legacy_isr();
176 DecimalPosition position_x;
177 DecimalPosition position_y;
178 DecimalPosition position_r;
179 DecimalPosition position_t;
180 DecimalPosition position_z;
181 DecimalPosition position_e;
BlockPorts provide a unified interface for mapping inputs and outputs of different StepDance componen...
Definition core.hpp:148
RPC class for handling remote procedure calls over serial streams.
Definition rpc.hpp:35