mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-03 11:22:38 +02:00
Updated the way RMT channels are assigned
RMT channels are now dynamically assigned by init_RMT() by the #defined pins it sees.
This commit is contained in:
@@ -44,11 +44,11 @@ Some features should not be changed. See notes below.
|
|||||||
// The CPU map is the main definition of the machine/controller you want to use
|
// The CPU map is the main definition of the machine/controller you want to use
|
||||||
// These are typically found in the cpu_map.h file.
|
// These are typically found in the cpu_map.h file.
|
||||||
// See Github repo wiki for more details
|
// See Github repo wiki for more details
|
||||||
#define CPU_MAP_TEST_DRIVE // these are defined in cpu_map.h
|
#define CPU_MAP_ESP32 // these are defined in cpu_map.h
|
||||||
|
|
||||||
// Number of axes defined (steppers, servos, etc) (valid range: 3 to 6)
|
// Number of axes defined (steppers, servos, etc) (valid range: 3 to 6)
|
||||||
// Even if your machine only uses less than the minimum of 3, you should select 3
|
// Even if your machine only uses less than the minimum of 3, you should select 3
|
||||||
#define N_AXIS 3
|
#define N_AXIS 3
|
||||||
|
|
||||||
#define VERBOSE_HELP // Currently this doesn't do anything
|
#define VERBOSE_HELP // Currently this doesn't do anything
|
||||||
#define GRBL_MSG_LEVEL MSG_LEVEL_INFO // what level of [MSG:....] do you want to see 0=all off
|
#define GRBL_MSG_LEVEL MSG_LEVEL_INFO // what level of [MSG:....] do you want to see 0=all off
|
||||||
@@ -288,7 +288,7 @@ Some features should not be changed. See notes below.
|
|||||||
#define IGNORE_CONTROL_PINS
|
#define IGNORE_CONTROL_PINS
|
||||||
|
|
||||||
#define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
|
#define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
|
||||||
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
|
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
|
||||||
|
|
||||||
|
|
||||||
// Inverts select limit pin states based on the following mask. This effects all limit pin functions,
|
// Inverts select limit pin states based on the following mask. This effects all limit pin functions,
|
||||||
|
@@ -585,19 +585,20 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_GANGED_AXES // allow two motors on an axis
|
#define USE_GANGED_AXES // allow two motors on an axis
|
||||||
|
#define USE_RMT_STEPS
|
||||||
|
|
||||||
#define X_STEP_PIN GPIO_NUM_12
|
#define X_STEP_PIN GPIO_NUM_12
|
||||||
#define X_STEP_B_PIN GPIO_NUM_22 // ganged motor
|
#define X2_STEP_PIN GPIO_NUM_22 // ganged motor
|
||||||
#define X_AXIS_SQUARING
|
#define X_AXIS_SQUARING
|
||||||
|
|
||||||
#define Y_STEP_PIN GPIO_NUM_14
|
#define Y_STEP_PIN GPIO_NUM_14
|
||||||
#define Y_STEP_B_PIN GPIO_NUM_21 // ganged motor
|
#define Y2_STEP_PIN GPIO_NUM_21 // ganged motor
|
||||||
#define Y_AXIS_SQUARING
|
#define Y_AXIS_SQUARING
|
||||||
|
|
||||||
#define Z_STEP_PIN GPIO_NUM_27
|
#define Z_STEP_PIN GPIO_NUM_27
|
||||||
|
|
||||||
#define X_DIRECTION_PIN GPIO_NUM_26
|
#define X_DIRECTION_PIN GPIO_NUM_26
|
||||||
#define Y_DIRECTION_PIN GPIO_NUM_25
|
#define Y_DIRECTION_PIN GPIO_NUM_25
|
||||||
#define Z_DIRECTION_PIN GPIO_NUM_33
|
#define Z_DIRECTION_PIN GPIO_NUM_33
|
||||||
|
|
||||||
// OK to comment out to use pin for other features
|
// OK to comment out to use pin for other features
|
||||||
@@ -736,14 +737,14 @@
|
|||||||
#define X_DIRECTION_PIN GPIO_NUM_33 // use Z labeled connector
|
#define X_DIRECTION_PIN GPIO_NUM_33 // use Z labeled connector
|
||||||
|
|
||||||
#define Y_STEP_PIN GPIO_NUM_14
|
#define Y_STEP_PIN GPIO_NUM_14
|
||||||
#define Y_STEP_B_PIN GPIO_NUM_21 // ganged motor
|
#define Y2_STEP_PIN GPIO_NUM_21 // ganged motor
|
||||||
#define Y_DIRECTION_PIN GPIO_NUM_25
|
#define Y_DIRECTION_PIN GPIO_NUM_25
|
||||||
#define Y_AXIS_SQUARING
|
#define Y_AXIS_SQUARING
|
||||||
|
|
||||||
#define Z_STEP_PIN GPIO_NUM_12 // use X labeled connector
|
#define Z_STEP_PIN GPIO_NUM_12 // use X labeled connector
|
||||||
#define Z_STEP_B_PIN GPIO_NUM_22 // use X labeled connector
|
#define Z2_STEP_PIN GPIO_NUM_22 // use X labeled connector
|
||||||
#define Z_DIRECTION_PIN GPIO_NUM_26 // use X labeled connector
|
#define Z_DIRECTION_PIN GPIO_NUM_26 // use X labeled connector
|
||||||
#define Z_AXIS_SQUARING
|
#define Z_AXIS_SQUARING
|
||||||
|
|
||||||
// OK to comment out to use pin for other features
|
// OK to comment out to use pin for other features
|
||||||
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
|
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
|
||||||
@@ -1082,6 +1083,52 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXTERNAL_DRIVER_4X
|
||||||
|
#define CPU_MAP_NAME "External Driver Board V1.1"
|
||||||
|
|
||||||
|
#ifdef N_AXIS
|
||||||
|
#undef N_AXIS
|
||||||
|
#endif
|
||||||
|
#define N_AXIS 4
|
||||||
|
|
||||||
|
#define USE_RMT_STEPS
|
||||||
|
#define X_STEP_PIN GPIO_NUM_0
|
||||||
|
#define X_DIRECTION_PIN GPIO_NUM_2
|
||||||
|
#define Y_STEP_PIN GPIO_NUM_26
|
||||||
|
#define Y_DIRECTION_PIN GPIO_NUM_15
|
||||||
|
#define Z_STEP_PIN GPIO_NUM_27
|
||||||
|
#define Z_DIRECTION_PIN GPIO_NUM_33
|
||||||
|
#define A_STEP_PIN GPIO_NUM_14
|
||||||
|
#define A_DIRECTION_PIN GPIO_NUM_12
|
||||||
|
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
|
||||||
|
|
||||||
|
|
||||||
|
#define SPINDLE_PWM_PIN GPIO_NUM_25
|
||||||
|
#define SPINDLE_PWM_CHANNEL 0
|
||||||
|
#define SPINDLE_PWM_BIT_PRECISION 8
|
||||||
|
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
|
||||||
|
|
||||||
|
#define MODBUS_TX GPIO_NUM_17
|
||||||
|
#define MODBUS_RX GPIO_NUM_4
|
||||||
|
#define MODBUS_CTRL GPIO_NUM_16
|
||||||
|
|
||||||
|
#define X_LIMIT_PIN GPIO_NUM_34
|
||||||
|
#define Y_LIMIT_PIN GPIO_NUM_35
|
||||||
|
#define Z_LIMIT_PIN GPIO_NUM_36
|
||||||
|
|
||||||
|
#if (N_AXIS == 3)
|
||||||
|
#define LIMIT_MASK B0111
|
||||||
|
#else
|
||||||
|
#define A_LIMIT_PIN GPIO_NUM_39
|
||||||
|
#define LIMIT_MASK B1111
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PROBE_PIN GPIO_NUM_32
|
||||||
|
#define COOLANT_MIST_PIN GPIO_NUM_21
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CPU_MAP_ATARI_1020
|
#ifdef CPU_MAP_ATARI_1020
|
||||||
#include "atari_1020.h"
|
#include "atari_1020.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
// Grbl versioning system
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "1.1f"
|
#define GRBL_VERSION "1.1f"
|
||||||
#define GRBL_VERSION_BUILD "20200219"
|
#define GRBL_VERSION_BUILD "20200221"
|
||||||
|
|
||||||
//#include <sdkconfig.h>
|
//#include <sdkconfig.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
@@ -152,6 +152,21 @@ typedef struct {
|
|||||||
} st_prep_t;
|
} st_prep_t;
|
||||||
static st_prep_t prep;
|
static st_prep_t prep;
|
||||||
|
|
||||||
|
// RMT channel numbers. These are assigned dynamically as needed via the CPU MAP
|
||||||
|
// Only 8 are available (0-7)
|
||||||
|
// They are Initialized with an invalid number to prevent unitended consequences
|
||||||
|
uint8_t X_rmt_chan_num = 255;
|
||||||
|
uint8_t X2_rmt_chan_num = 255; // Ganged axes have the "2"
|
||||||
|
uint8_t Y_rmt_chan_num = 255;
|
||||||
|
uint8_t Y2_rmt_chan_num = 255;
|
||||||
|
uint8_t Z_rmt_chan_num = 255;
|
||||||
|
uint8_t Z2_rmt_chan_num = 255;
|
||||||
|
uint8_t A_rmt_chan_num = 255;
|
||||||
|
uint8_t A2_rmt_chan_num = 255;
|
||||||
|
uint8_t B_rmt_chan_num = 255;
|
||||||
|
uint8_t B2_rmt_chan_num = 255;
|
||||||
|
uint8_t C_rmt_chan_num = 255;
|
||||||
|
uint8_t C2_rmt_chan_num = 255;
|
||||||
|
|
||||||
/* "The Stepper Driver Interrupt" - This timer interrupt is the workhorse of Grbl. Grbl employs
|
/* "The Stepper Driver Interrupt" - This timer interrupt is the workhorse of Grbl. Grbl employs
|
||||||
the venerable Bresenham line algorithm to manage and exactly synchronize multi-axis moves.
|
the venerable Bresenham line algorithm to manage and exactly synchronize multi-axis moves.
|
||||||
@@ -458,22 +473,22 @@ void stepper_init()
|
|||||||
#ifdef X_STEP_PIN
|
#ifdef X_STEP_PIN
|
||||||
pinMode(X_STEP_PIN, OUTPUT);
|
pinMode(X_STEP_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
#ifdef X_STEP_B_PIN // ganged motor
|
#ifdef X2_STEP_PIN // ganged motor
|
||||||
pinMode(X_STEP_B_PIN, OUTPUT);
|
pinMode(X2_STEP_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Y_STEP_PIN
|
#ifdef Y_STEP_PIN
|
||||||
pinMode(Y_STEP_PIN, OUTPUT);
|
pinMode(Y_STEP_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Y_STEP_B_PIN
|
#ifdef Y2_STEP_PIN
|
||||||
pinMode(Y_STEP_B_PIN, OUTPUT);
|
pinMode(Y2_STEP_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_STEP_PIN
|
#ifdef Z_STEP_PIN
|
||||||
pinMode(Z_STEP_PIN, OUTPUT);
|
pinMode(Z_STEP_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Z_STEP_B_PIN
|
#ifdef Z2_STEP_PIN
|
||||||
pinMode(Z_STEP_B_PIN, OUTPUT);
|
pinMode(Z2_STEP_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef A_STEP_PIN
|
#ifdef A_STEP_PIN
|
||||||
@@ -536,8 +551,6 @@ void stepper_init()
|
|||||||
timer_set_counter_value(STEP_TIMER_GROUP, STEP_TIMER_INDEX, 0x00000000ULL);
|
timer_set_counter_value(STEP_TIMER_GROUP, STEP_TIMER_INDEX, 0x00000000ULL);
|
||||||
timer_enable_intr(STEP_TIMER_GROUP, STEP_TIMER_INDEX);
|
timer_enable_intr(STEP_TIMER_GROUP, STEP_TIMER_INDEX);
|
||||||
timer_isr_register(STEP_TIMER_GROUP, STEP_TIMER_INDEX, onStepperDriverTimer, NULL, 0, NULL);
|
timer_isr_register(STEP_TIMER_GROUP, STEP_TIMER_INDEX, onStepperDriverTimer, NULL, 0, NULL);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RMT_STEPS
|
#ifdef USE_RMT_STEPS
|
||||||
@@ -567,8 +580,9 @@ void initRMT()
|
|||||||
rmtItem[1].duration1 = 0;
|
rmtItem[1].duration1 = 0;
|
||||||
|
|
||||||
#ifdef X_STEP_PIN
|
#ifdef X_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)X_RMT_CHANNEL, RMT_BASECLK_APB);
|
X_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)X_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)X_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)X_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, X_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, X_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = X_STEP_PIN;
|
rmtConfig.gpio_num = X_STEP_PIN;
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
@@ -577,11 +591,12 @@ void initRMT()
|
|||||||
rmt_fill_tx_items(rmtConfig.channel, &rmtItem[0], rmtConfig.mem_block_num, 0);
|
rmt_fill_tx_items(rmtConfig.channel, &rmtItem[0], rmtConfig.mem_block_num, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef X_STEP_B_PIN
|
#ifdef X2_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)X_B_RMT_CHANNEL, RMT_BASECLK_APB);
|
X2_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)X_B_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)X2_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)X2_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, X_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, X_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = X_STEP_B_PIN;
|
rmtConfig.gpio_num = X2_STEP_PIN;
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
rmtItem[0].level1 = !rmtConfig.tx_config.idle_level;
|
rmtItem[0].level1 = !rmtConfig.tx_config.idle_level;
|
||||||
rmt_config(&rmtConfig);
|
rmt_config(&rmtConfig);
|
||||||
@@ -589,8 +604,9 @@ void initRMT()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Y_STEP_PIN
|
#ifdef Y_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)Y_RMT_CHANNEL, RMT_BASECLK_APB);
|
Y_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)Y_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)Y_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)Y_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, Y_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, Y_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = Y_STEP_PIN;
|
rmtConfig.gpio_num = Y_STEP_PIN;
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
@@ -599,11 +615,12 @@ void initRMT()
|
|||||||
rmt_fill_tx_items(rmtConfig.channel, &rmtItem[0], rmtConfig.mem_block_num, 0);
|
rmt_fill_tx_items(rmtConfig.channel, &rmtItem[0], rmtConfig.mem_block_num, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Y_STEP_B_PIN
|
#ifdef Y2_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)Y_B_RMT_CHANNEL, RMT_BASECLK_APB);
|
Y2_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)Y_B_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)Y2_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)Y2_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, Y_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, Y_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = Y_STEP_B_PIN;
|
rmtConfig.gpio_num = Y2_STEP_PIN;
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
rmtItem[0].level1 = !rmtConfig.tx_config.idle_level;
|
rmtItem[0].level1 = !rmtConfig.tx_config.idle_level;
|
||||||
rmt_config(&rmtConfig);
|
rmt_config(&rmtConfig);
|
||||||
@@ -611,8 +628,9 @@ void initRMT()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_STEP_PIN
|
#ifdef Z_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)Z_RMT_CHANNEL, RMT_BASECLK_APB);
|
Z_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)Z_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)Z_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)Z_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, Z_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, Z_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = Z_STEP_PIN;
|
rmtConfig.gpio_num = Z_STEP_PIN;
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
@@ -622,8 +640,9 @@ void initRMT()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef A_STEP_PIN
|
#ifdef A_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)A_RMT_CHANNEL, RMT_BASECLK_APB);
|
A_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)A_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)A_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)A_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, A_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, A_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = A_STEP_PIN; // TODO
|
rmtConfig.gpio_num = A_STEP_PIN; // TODO
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
@@ -633,8 +652,9 @@ void initRMT()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef B_STEP_PIN
|
#ifdef B_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)B_RMT_CHANNEL, RMT_BASECLK_APB);
|
B_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)B_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)B_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)B_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, B_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, B_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = B_STEP_PIN; // TODO
|
rmtConfig.gpio_num = B_STEP_PIN; // TODO
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
@@ -644,8 +664,9 @@ void initRMT()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef C_STEP_PIN
|
#ifdef C_STEP_PIN
|
||||||
rmt_set_source_clk( (rmt_channel_t)C_RMT_CHANNEL, RMT_BASECLK_APB);
|
C_rmt_chan_num = sys_get_next_RMT_chan_num();
|
||||||
rmtConfig.channel = (rmt_channel_t)C_RMT_CHANNEL;
|
rmt_set_source_clk( (rmt_channel_t)C_rmt_chan_num, RMT_BASECLK_APB);
|
||||||
|
rmtConfig.channel = (rmt_channel_t)C_rmt_chan_num;
|
||||||
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, C_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
rmtConfig.tx_config.idle_level = bit_istrue(settings.step_invert_mask, C_AXIS) ? RMT_IDLE_LEVEL_HIGH : RMT_IDLE_LEVEL_LOW;
|
||||||
rmtConfig.gpio_num = C_STEP_PIN; // TODO
|
rmtConfig.gpio_num = C_STEP_PIN; // TODO
|
||||||
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
rmtItem[0].level0 = rmtConfig.tx_config.idle_level;
|
||||||
@@ -725,97 +746,117 @@ void set_direction_pins_on(uint8_t onMask)
|
|||||||
#ifdef X_DIRECTION_PIN
|
#ifdef X_DIRECTION_PIN
|
||||||
digitalWrite(X_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
digitalWrite(X_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef X2_DIRECTION_PIN // optional ganged axis
|
||||||
|
digitalWrite(X2_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Y_DIRECTION_PIN
|
#ifdef Y_DIRECTION_PIN
|
||||||
digitalWrite(Y_DIRECTION_PIN, (onMask & (1<<Y_AXIS)));
|
digitalWrite(Y_DIRECTION_PIN, (onMask & (1<<Y_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Y2_DIRECTION_PIN // optional ganged axis
|
||||||
|
digitalWrite(Y2_DIRECTION_PIN, (onMask & (1<<Y_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Z_DIRECTION_PIN
|
#ifdef Z_DIRECTION_PIN
|
||||||
digitalWrite(Z_DIRECTION_PIN, (onMask & (1<<Z_AXIS)));
|
digitalWrite(Z_DIRECTION_PIN, (onMask & (1<<Z_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Z2_DIRECTION_PIN // optional ganged axis
|
||||||
|
digitalWrite(Z2_DIRECTION_PIN, (onMask & (1<<Z_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef A_DIRECTION_PIN
|
#ifdef A_DIRECTION_PIN
|
||||||
digitalWrite(A_DIRECTION_PIN, (onMask & (1<<A_AXIS)));
|
digitalWrite(A_DIRECTION_PIN, (onMask & (1<<A_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef A2_DIRECTION_PIN // optional ganged axis
|
||||||
|
digitalWrite(A2_DIRECTION_PIN, (onMask & (1<<A_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef B_DIRECTION_PIN
|
#ifdef B_DIRECTION_PIN
|
||||||
digitalWrite(B_DIRECTION_PIN, (onMask & (1<<B_AXIS)));
|
digitalWrite(B_DIRECTION_PIN, (onMask & (1<<B_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef B2_DIRECTION_PIN // optional ganged axis
|
||||||
|
digitalWrite(B2_DIRECTION_PIN, (onMask & (1<<B_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef C_DIRECTION_PIN
|
#ifdef C_DIRECTION_PIN
|
||||||
digitalWrite(C_DIRECTION_PIN, (onMask & (1<<C_AXIS)));
|
digitalWrite(C_DIRECTION_PIN, (onMask & (1<<C_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef C2_DIRECTION_PIN // optional ganged axis
|
||||||
|
digitalWrite(C2_DIRECTION_PIN, (onMask & (1<<C_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_GANGED_AXES
|
#ifndef USE_GANGED_AXES
|
||||||
// basic one motor per axis
|
// basic one motor per axis
|
||||||
void set_stepper_pins_on(uint8_t onMask)
|
void set_stepper_pins_on(uint8_t onMask)
|
||||||
{
|
{
|
||||||
onMask ^= settings.step_invert_mask; // invert pins as required by invert mask
|
onMask ^= settings.step_invert_mask; // invert pins as required by invert mask
|
||||||
|
|
||||||
#ifdef X_STEP_PIN
|
#ifdef X_STEP_PIN
|
||||||
digitalWrite(X_STEP_PIN, (onMask & (1<<X_AXIS)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Y_STEP_PIN
|
|
||||||
digitalWrite(Y_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Z_STEP_PIN
|
|
||||||
digitalWrite(Z_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef A_STEP_PIN
|
|
||||||
digitalWrite(A_STEP_PIN, (onMask & (1<<A_AXIS)));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else // we use ganged axes
|
|
||||||
void set_stepper_pins_on(uint8_t onMask)
|
|
||||||
{
|
|
||||||
onMask ^= settings.step_invert_mask; // invert pins as required by invert mask
|
|
||||||
|
|
||||||
#ifdef X_STEP_PIN
|
|
||||||
#ifndef X_STEP_B_PIN // if not a ganged axis
|
|
||||||
digitalWrite(X_STEP_PIN, (onMask & (1<<X_AXIS)));
|
|
||||||
#else // is a ganged axis
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
|
||||||
digitalWrite(X_STEP_PIN, (onMask & (1<<X_AXIS)));
|
digitalWrite(X_STEP_PIN, (onMask & (1<<X_AXIS)));
|
||||||
}
|
#endif
|
||||||
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
#ifdef Y_STEP_PIN
|
||||||
digitalWrite(X_STEP_B_PIN, (onMask & (1<<X_AXIS)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Y_STEP_PIN
|
|
||||||
#ifndef Y_STEP_B_PIN // if not a ganged axis
|
|
||||||
digitalWrite(Y_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
|
||||||
#else // is a ganged axis
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
|
||||||
digitalWrite(Y_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
digitalWrite(Y_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
||||||
}
|
#endif
|
||||||
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
#ifdef Z_STEP_PIN
|
||||||
digitalWrite(Y_STEP_B_PIN, (onMask & (1<<Y_AXIS)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Z_STEP_PIN
|
|
||||||
#ifndef Z_STEP_B_PIN // if not a ganged axis
|
|
||||||
digitalWrite(Z_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
|
||||||
#else // is a ganged axis
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
|
||||||
digitalWrite(Z_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
digitalWrite(Z_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef A_STEP_PIN
|
||||||
|
digitalWrite(A_STEP_PIN, (onMask & (1<<A_AXIS)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#else // we use ganged axes
|
||||||
|
void set_stepper_pins_on(uint8_t onMask)
|
||||||
|
{
|
||||||
|
onMask ^= settings.step_invert_mask; // invert pins as required by invert mask
|
||||||
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
#ifdef X_STEP_PIN
|
||||||
digitalWrite(Z_STEP_B_PIN, (onMask & (1<<Z_AXIS)));
|
#ifndef X2_STEP_PIN // if not a ganged axis
|
||||||
|
digitalWrite(X_STEP_PIN, (onMask & (1<<X_AXIS)));
|
||||||
|
#else // is a ganged axis
|
||||||
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
||||||
|
digitalWrite(X_STEP_PIN, (onMask & (1<<X_AXIS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
||||||
|
digitalWrite(X2_STEP_PIN, (onMask & (1<<X_AXIS)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Y_STEP_PIN
|
||||||
|
#ifndef Y2_STEP_PIN // if not a ganged axis
|
||||||
|
digitalWrite(Y_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
||||||
|
#else // is a ganged axis
|
||||||
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
||||||
|
digitalWrite(Y_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
||||||
|
digitalWrite(Y2_STEP_PIN, (onMask & (1<<Y_AXIS)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Z_STEP_PIN
|
||||||
|
#ifndef Z2_STEP_PIN // if not a ganged axis
|
||||||
|
digitalWrite(Z_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
||||||
|
#else // is a ganged axis
|
||||||
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
||||||
|
digitalWrite(Z_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
||||||
|
digitalWrite(Z2_STEP_PIN, (onMask & (1<<Z_AXIS)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_RMT_STEPS
|
#ifdef USE_RMT_STEPS
|
||||||
// Set stepper pulse output pins
|
// Set stepper pulse output pins
|
||||||
@@ -824,17 +865,17 @@ inline IRAM_ATTR static void stepperRMT_Outputs()
|
|||||||
|
|
||||||
#ifdef X_STEP_PIN
|
#ifdef X_STEP_PIN
|
||||||
if(st.step_outbits & (1<<X_AXIS)) {
|
if(st.step_outbits & (1<<X_AXIS)) {
|
||||||
#ifndef X_STEP_B_PIN // if not a ganged axis
|
#ifndef X2_STEP_PIN // if not a ganged axis
|
||||||
RMT.conf_ch[X_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[X_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[X_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[X_rmt_chan_num].conf1.tx_start = 1;
|
||||||
#else // it is a ganged axis
|
#else // it is a ganged axis
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
||||||
RMT.conf_ch[X_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[X_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[X_RMT_CHANNEL].conf1.tx_start = 1; }
|
RMT.conf_ch[X_rmt_chan_num].conf1.tx_start = 1; }
|
||||||
|
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
||||||
RMT.conf_ch[X_B_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[X2_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[X_B_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[X2_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -843,17 +884,17 @@ inline IRAM_ATTR static void stepperRMT_Outputs()
|
|||||||
|
|
||||||
#ifdef Y_STEP_PIN
|
#ifdef Y_STEP_PIN
|
||||||
if(st.step_outbits & (1<<Y_AXIS)) {
|
if(st.step_outbits & (1<<Y_AXIS)) {
|
||||||
#ifndef Y_STEP_B_PIN // if not a ganged axis
|
#ifndef Y2_STEP_PIN // if not a ganged axis
|
||||||
RMT.conf_ch[Y_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[Y_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[Y_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[Y_rmt_chan_num].conf1.tx_start = 1;
|
||||||
#else // it is a ganged axis
|
#else // it is a ganged axis
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_A) ) {
|
||||||
RMT.conf_ch[Y_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[Y_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[Y_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[Y_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
if ( (ganged_mode == SQUARING_MODE_DUAL) || (ganged_mode == SQUARING_MODE_B) ) {
|
||||||
RMT.conf_ch[Y_B_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[Y2_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[Y_B_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[Y2_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -861,32 +902,32 @@ inline IRAM_ATTR static void stepperRMT_Outputs()
|
|||||||
|
|
||||||
#ifdef Z_STEP_PIN
|
#ifdef Z_STEP_PIN
|
||||||
if(st.step_outbits & (1<<Z_AXIS)) {
|
if(st.step_outbits & (1<<Z_AXIS)) {
|
||||||
RMT.conf_ch[Z_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[Z_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[Z_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[Z_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef A_STEP_PIN
|
#ifdef A_STEP_PIN
|
||||||
if(st.step_outbits & (1<<A_AXIS)) {
|
if(st.step_outbits & (1<<A_AXIS)) {
|
||||||
|
|
||||||
RMT.conf_ch[A_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[A_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[A_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[A_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef B_STEP_PIN
|
#ifdef B_STEP_PIN
|
||||||
if(st.step_outbits & (1<<B_AXIS)) {
|
if(st.step_outbits & (1<<B_AXIS)) {
|
||||||
|
|
||||||
RMT.conf_ch[B_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[B_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[B_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[B_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef C_STEP_PIN
|
#ifdef C_STEP_PIN
|
||||||
if(st.step_outbits & (1<<C_AXIS)) {
|
if(st.step_outbits & (1<<C_AXIS)) {
|
||||||
|
|
||||||
RMT.conf_ch[C_RMT_CHANNEL].conf1.mem_rd_rst = 1;
|
RMT.conf_ch[C_rmt_chan_num].conf1.mem_rd_rst = 1;
|
||||||
RMT.conf_ch[C_RMT_CHANNEL].conf1.tx_start = 1;
|
RMT.conf_ch[C_rmt_chan_num].conf1.tx_start = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1535,7 +1576,4 @@ bool get_stepper_disable() // returns true if steppers are disabled
|
|||||||
|
|
||||||
return disabled;
|
return disabled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -47,14 +47,6 @@
|
|||||||
#define PREP_FLAG_PARKING bit(2)
|
#define PREP_FLAG_PARKING bit(2)
|
||||||
#define PREP_FLAG_DECEL_OVERRIDE bit(3)
|
#define PREP_FLAG_DECEL_OVERRIDE bit(3)
|
||||||
|
|
||||||
// which RMT channels to use with the axes
|
|
||||||
#define X_RMT_CHANNEL 0
|
|
||||||
#define Y_RMT_CHANNEL 1
|
|
||||||
#define Z_RMT_CHANNEL 2
|
|
||||||
#define A_RMT_CHANNEL 3
|
|
||||||
#define B_RMT_CHANNEL 4
|
|
||||||
#define C_RMT_CHANNEL 5
|
|
||||||
|
|
||||||
// Define Adaptive Multi-Axis Step-Smoothing(AMASS) levels and cutoff frequencies. The highest level
|
// Define Adaptive Multi-Axis Step-Smoothing(AMASS) levels and cutoff frequencies. The highest level
|
||||||
// frequency bin starts at 0Hz and ends at its cutoff frequency. The next lower level frequency bin
|
// frequency bin starts at 0Hz and ends at its cutoff frequency. The next lower level frequency bin
|
||||||
// starts at the next higher cutoff frequency, and so on. The cutoff frequencies for each level must
|
// starts at the next higher cutoff frequency, and so on. The cutoff frequencies for each level must
|
||||||
|
@@ -623,4 +623,19 @@ void sys_io_control(uint8_t io_num_mask, bool turnOn) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call this function to get an RMT channel number
|
||||||
|
// returns -1 for error
|
||||||
|
int8_t sys_get_next_RMT_chan_num()
|
||||||
|
{
|
||||||
|
static uint8_t next_RMT_chan_num = 0; // channels 0-7 are valid
|
||||||
|
|
||||||
|
if (next_RMT_chan_num< 8) { // 7 is the max PWM channel number
|
||||||
|
return next_RMT_chan_num++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
grbl_msg_sendf(CLIENT_SERIAL, MSG_LEVEL_ERROR, "Error: out of RMT channels");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
@@ -227,5 +227,7 @@ void system_exec_control_pin(uint8_t pin);
|
|||||||
|
|
||||||
void sys_io_control(uint8_t io_num_mask, bool turnOn);
|
void sys_io_control(uint8_t io_num_mask, bool turnOn);
|
||||||
|
|
||||||
|
//
|
||||||
|
int8_t sys_get_next_RMT_chan_num();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user