Added spindle sync support (for test/verification) for modified T41U5XBB board, initial refactoring of input handling for crossbar option
This commit is contained in:
parent
a40b60936d
commit
ac96edd4cf
|
@ -5,11 +5,11 @@
|
|||
<provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-354975797569" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1822820439273" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
</project>
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Board by Phil Barrett: https://github.com/phil-barrett/grblHAL-teensy-4.x
|
||||
|
||||
Copyright (c) 2020 Terje Io
|
||||
Copyright (c) 2020-2021 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,6 +31,10 @@
|
|||
#error No pins available for encoder input!
|
||||
#endif
|
||||
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
#error Spindle sync is not supported for T40X101
|
||||
#endif
|
||||
|
||||
// Default pin assignments allow only one axis to be ganged or auto squared.
|
||||
// A axis pin numbers are used for the ganged/auto squared axis.
|
||||
// If a second axis is to be ganged/auto squared pin assignments needs to be changed!
|
||||
|
@ -113,6 +117,6 @@
|
|||
|
||||
#if EEPROM_ENABLE || KEYPAD_ENABLE
|
||||
#define I2C_PORT 4
|
||||
#define I2C_SCL4 (24u) // Not used, for info only
|
||||
#define I2C_SDA4 (25u) // Not used, for info only
|
||||
#define I2C_SCL4 (24u) // Not referenced, for info only
|
||||
#define I2C_SDA4 (25u) // Not referenced, for info only
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "driver.h"
|
||||
|
||||
#ifdef BOARD_T41U5XBB
|
||||
#if defined(BOARD_T41U5XBB) || defined(BOARD_T41U5XBB_SS)
|
||||
|
||||
//#include "Arduino.h"
|
||||
#include <math.h>
|
||||
|
@ -31,32 +31,20 @@
|
|||
|
||||
#include "grbl/protocol.h"
|
||||
|
||||
static gpio_t stx[AUX_N_IN];
|
||||
static input_signal_t *stx;
|
||||
static gpio_t aux_out[AUX_N_OUT];
|
||||
|
||||
static void aux_settings_load (void);
|
||||
static status_code_t aux_set_invert_out (setting_id_t id, uint_fast16_t int_value);
|
||||
static uint32_t aux_get_invert_out (setting_id_t setting);
|
||||
|
||||
static input_signal_t aux_in[] = {
|
||||
{ .id = Input_Aux0, .port = &stx[0], .pin = AUXINPUT0_PIN, .group = 0 }
|
||||
#if AUX_N_IN == 4
|
||||
, { .id = Input_Aux1, .port = &stx[1], .pin = AUXINPUT1_PIN, .group = 0 },
|
||||
{ .id = Input_Aux2, .port = &stx[2], .pin = AUXINPUT2_PIN, .group = 0 },
|
||||
{ .id = Input_Aux3, .port = &stx[3], .pin = AUXINPUT3_PIN, .group = 0 }
|
||||
#endif
|
||||
};
|
||||
static char input_ports[30]; //
|
||||
|
||||
static const setting_group_detail_t aux_groups[] = {
|
||||
{ Group_Root, Group_AuxPorts, "Aux ports"}
|
||||
};
|
||||
|
||||
static const setting_detail_t aux_settings[] = {
|
||||
#if AUX_N_IN == 4
|
||||
{ Settings_IoPort_InvertIn, Group_AuxPorts, "Invert I/O Port inputs", NULL, Format_Bitfield, "Port 0,Port 1,Port 2,Port 3", NULL, NULL, Setting_NonCore, &settings.ioport.invert_in.mask },
|
||||
#else
|
||||
{ Settings_IoPort_InvertIn, Group_AuxPorts, "Invert I/O Port inputs", NULL, Format_Bitfield, "Port 0", NULL, NULL, Setting_NonCore, &settings.ioport.invert_in.mask },
|
||||
#endif
|
||||
{ Settings_IoPort_InvertIn, Group_AuxPorts, "Invert I/O Port inputs", NULL, Format_Bitfield, input_ports, NULL, NULL, Setting_NonCore, &settings.ioport.invert_in.mask },
|
||||
{ Settings_IoPort_InvertOut, Group_AuxPorts, "Invert I/O Port outputs", NULL, Format_Bitfield, "Port 0,Port 1,Port 2", NULL, NULL, Setting_NonCoreFn, aux_set_invert_out, aux_get_invert_out },
|
||||
};
|
||||
|
||||
|
@ -142,8 +130,8 @@ static int32_t wait_on_input (bool digital, uint8_t port, wait_mode_t wait_mode,
|
|||
int32_t value = -1;
|
||||
|
||||
if(digital) {
|
||||
if(port < AUX_N_IN)
|
||||
value = get_input(aux_in[port].port, (settings.ioport.invert_in.mask << port) & 0x01, wait_mode, timeout);
|
||||
if(port < hal.port.num_digital_in)
|
||||
value = get_input(stx[port].port, (settings.ioport.invert_in.mask << port) & 0x01, wait_mode, timeout);
|
||||
}
|
||||
// else if(port == 0)
|
||||
// value = analogRead(41);
|
||||
|
@ -157,32 +145,25 @@ static int32_t wait_on_input (bool digital, uint8_t port, wait_mode_t wait_mode,
|
|||
return value;
|
||||
}
|
||||
|
||||
void board_init (void)
|
||||
void board_init (pin_group_pins_t *aux_inputs)
|
||||
{
|
||||
stx = aux_inputs->pins;
|
||||
|
||||
hal.port.digital_out = digital_out;
|
||||
hal.port.wait_on_input = wait_on_input;
|
||||
// hal.port.num_analog_in = 1;
|
||||
hal.port.num_digital_in = AUX_N_IN;
|
||||
hal.port.num_digital_in = aux_inputs->n_pins;
|
||||
hal.port.num_digital_out = AUX_N_OUT;
|
||||
|
||||
details.on_get_settings = grbl.on_get_settings;
|
||||
grbl.on_get_settings = on_get_settings;
|
||||
|
||||
bool pullup;
|
||||
uint32_t i = AUX_N_IN;
|
||||
input_signal_t *signal;
|
||||
do {
|
||||
pullup = true; //??
|
||||
signal = &aux_in[--i];
|
||||
signal->irq_mode = IRQ_Mode_None;
|
||||
uint32_t i;
|
||||
|
||||
pinMode(signal->pin, pullup ? INPUT_PULLUP : INPUT_PULLDOWN);
|
||||
signal->gpio.reg = (gpio_reg_t *)digital_pin_to_info_PGM[signal->pin].reg;
|
||||
signal->gpio.bit = digital_pin_to_info_PGM[signal->pin].mask;
|
||||
|
||||
if(signal->port != NULL)
|
||||
memcpy(signal->port, &signal->gpio, sizeof(gpio_t));
|
||||
} while(i);
|
||||
for(i = 0; i < hal.port.num_digital_in; i++) {
|
||||
strcat(input_ports, i == 0 ? "Port " : ",Port ");
|
||||
strcat(input_ports, uitoa(i));
|
||||
}
|
||||
|
||||
pinModeOutput(&aux_out[0], AUXOUTPUT0_PIN);
|
||||
pinModeOutput(&aux_out[1], AUXOUTPUT1_PIN);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Board by Phil Barrett: https://github.com/phil-barrett/grblHAL-teensy-4.x
|
||||
|
||||
Copyright (c) 2020 Terje Io
|
||||
Copyright (c) 2020-2021 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,12 +24,14 @@
|
|||
#define BOARD_NAME "T41U5XBB"
|
||||
#define HAS_BOARD_INIT
|
||||
|
||||
void board_init (void);
|
||||
|
||||
#if N_AXIS > 5
|
||||
#error Max number of axes is 5 for T41U5XBB
|
||||
#endif
|
||||
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
#error Spindle sync is not supported for T41U5XBB
|
||||
#endif
|
||||
|
||||
// Default pin assignments allow only one axis to be ganged or auto squared.
|
||||
// B axis pin numbers are used for the ganged/auto squared axis.
|
||||
// If a second axis is to be ganged/auto squared pin assignments needs to be changed!
|
||||
|
@ -37,7 +39,7 @@ void board_init (void);
|
|||
#define X_GANGED 0
|
||||
#define X_AUTO_SQUARE 0
|
||||
#define Y_GANGED 0
|
||||
#define Y_AUTO_SQUARE 0
|
||||
#define Y_AUTO_SQUARE 1
|
||||
#define Z_GANGED 0
|
||||
#define Z_AUTO_SQUARE 0
|
||||
//
|
||||
|
@ -61,12 +63,13 @@ void board_init (void);
|
|||
#define Y_ENABLE_PIN (40u)
|
||||
#define Y_LIMIT_PIN (21u)
|
||||
|
||||
// Changed to use A pins rather than B pins
|
||||
#if Y_GANGED || Y_AUTO_SQUARE
|
||||
#define Y2_STEP_PIN (26u)
|
||||
#define Y2_DIRECTION_PIN (27u)
|
||||
#define Y2_ENABLE_PIN (37u)
|
||||
#define Y2_STEP_PIN (8u)
|
||||
#define Y2_DIRECTION_PIN (9u)
|
||||
#define Y2_ENABLE_PIN (38u)
|
||||
#if Y_AUTO_SQUARE
|
||||
#define Y2_LIMIT_PIN (28u)
|
||||
#define Y2_LIMIT_PIN (23u)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -112,7 +115,13 @@ void board_init (void);
|
|||
#define SAFETY_DOOR_PIN (29u)
|
||||
|
||||
// Define probe switch input pin.
|
||||
#define PROBE_PIN (15U)
|
||||
#define PROBE_PIN (15u)
|
||||
|
||||
#if QEI_ENABLE
|
||||
#define QEI_A_PIN (30u) // ST1
|
||||
#define QEI_B_PIN (34u) // ST2
|
||||
#define QEI_SELECT_PIN (35u) // ST3
|
||||
#endif
|
||||
|
||||
// Define auxillary input pins
|
||||
#define AUXINPUT0_PIN (36u) // ST0
|
||||
|
@ -120,11 +129,6 @@ void board_init (void);
|
|||
#define AUXINPUT1_PIN (30u) // ST1
|
||||
#define AUXINPUT2_PIN (34u) // ST2
|
||||
#define AUXINPUT3_PIN (35u) // ST3
|
||||
#define AUX_N_IN 4
|
||||
#define AUX_IN_MASK 0b1111
|
||||
#else
|
||||
#define AUX_N_IN 1
|
||||
#define AUX_IN_MASK 0b1
|
||||
#endif
|
||||
|
||||
#define AUXOUTPUT0_PIN (31u) // AUX0
|
||||
|
@ -139,12 +143,6 @@ void board_init (void);
|
|||
|
||||
#if EEPROM_ENABLE || KEYPAD_ENABLE
|
||||
#define I2C_PORT 4
|
||||
#define I2C_SCL4 (24u) // Not used, for info only
|
||||
#define I2C_SDA4 (25u) // Not used, for info only
|
||||
#endif
|
||||
|
||||
#if QEI_ENABLE
|
||||
#define QEI_A_PIN (30u) // ST1
|
||||
#define QEI_B_PIN (34u) // ST2
|
||||
#define QEI_SELECT_PIN (35u) // ST3
|
||||
#define I2C_SCL4 (24u) // Not referenced, for info only
|
||||
#define I2C_SDA4 (25u) // Not referenced, for info only
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
T41U5XBB_ss_map.h - driver code for IMXRT1062 processor (on Teensy 4.1 board)
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
!!IMPORTANT!! This map is for a modified board, see https://github.com/terjeio/grblHAL/discussions/289 for details.
|
||||
|
||||
Board by Phil Barrett: https://github.com/phil-barrett/grblHAL-teensy-4.x
|
||||
|
||||
Copyright (c) 2020-2021 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Grbl is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define BOARD_NAME "T41U5XBB"
|
||||
#define HAS_BOARD_INIT
|
||||
|
||||
#if N_AXIS > 5
|
||||
#error Max number of axes is 5 for T41U5XBB
|
||||
#endif
|
||||
|
||||
#if QEI_ENABLE && SPINDLE_SYNC_ENABLE
|
||||
#error Quadrature encoder and spindle sync cannot be enabled at the same time
|
||||
#endif
|
||||
|
||||
// Default pin assignments allow only one axis to be ganged or auto squared.
|
||||
// B axis pin numbers are used for the ganged/auto squared axis.
|
||||
// If a second axis is to be ganged/auto squared pin assignments needs to be changed!
|
||||
// Set to 1 to enable, 0 to disable.
|
||||
#define X_GANGED 0
|
||||
#define X_AUTO_SQUARE 0
|
||||
#define Y_GANGED 0
|
||||
#define Y_AUTO_SQUARE 1
|
||||
#define Z_GANGED 0
|
||||
#define Z_AUTO_SQUARE 0
|
||||
//
|
||||
|
||||
#define X_STEP_PIN (2u)
|
||||
#define X_DIRECTION_PIN (3u)
|
||||
#define X_ENABLE_PIN (10u)
|
||||
#define X_LIMIT_PIN (20u)
|
||||
|
||||
#if X_GANGED || X_AUTO_SQUARE
|
||||
#define X2_STEP_PIN (26u)
|
||||
#define X2_DIRECTION_PIN (27u)
|
||||
#define X2_ENABLE_PIN (37u)
|
||||
#if X_AUTO_SQUARE
|
||||
#define X2_LIMIT_PIN (28u)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Y_STEP_PIN (4u)
|
||||
#define Y_DIRECTION_PIN (5u)
|
||||
#define Y_ENABLE_PIN (40u)
|
||||
#define Y_LIMIT_PIN (21u)
|
||||
|
||||
// Changed to use A pins rather than B pins
|
||||
#if Y_GANGED || Y_AUTO_SQUARE
|
||||
#define Y2_STEP_PIN (8u)
|
||||
#define Y2_DIRECTION_PIN (9u)
|
||||
#define Y2_ENABLE_PIN (38u)
|
||||
#if Y_AUTO_SQUARE
|
||||
#define Y2_LIMIT_PIN (23u)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Z_STEP_PIN (6u)
|
||||
#define Z_DIRECTION_PIN (7u)
|
||||
#define Z_ENABLE_PIN (39u)
|
||||
#define Z_LIMIT_PIN (22u)
|
||||
|
||||
#if Z_GANGED || Z_AUTO_SQUARE
|
||||
#define Z2_STEP_PIN (26u)
|
||||
#define Z2_DIRECTION_PIN (27u)
|
||||
#define Z2_ENABLE_PIN (37u)
|
||||
#define Z2_LIMIT_PIN (28u)
|
||||
#endif
|
||||
|
||||
#if N_AXIS > 3
|
||||
#define A_STEP_PIN (8u)
|
||||
#define A_DIRECTION_PIN (9u)
|
||||
#define A_ENABLE_PIN (38u)
|
||||
#define A_LIMIT_PIN (23u)
|
||||
#endif
|
||||
|
||||
#if N_AXIS > 4
|
||||
#define B_STEP_PIN (26u)
|
||||
#define B_DIRECTION_PIN (27u)
|
||||
#define B_ENABLE_PIN (37u)
|
||||
#define B_LIMIT_PIN (28u)
|
||||
#endif
|
||||
|
||||
// Define spindle enable and spindle direction output pins.
|
||||
#define SPINDLE_ENABLE_PIN (12u)
|
||||
#define SPINDLE_DIRECTION_PIN (11u)
|
||||
#define SPINDLEPWMPIN (13u) // NOTE: only pin 12 or pin 13 can be assigned!
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_PIN (19u)
|
||||
#define COOLANT_MIST_PIN (18u)
|
||||
|
||||
// Define user-control CONTROLs (cycle start, reset, feed hold, door) input pins.
|
||||
#define RESET_PIN (35u)
|
||||
#define FEED_HOLD_PIN (16u)
|
||||
#define CYCLE_START_PIN (17u)
|
||||
#define SAFETY_DOOR_PIN (29u)
|
||||
|
||||
// Define probe switch input pin.
|
||||
#define PROBE_PIN (15u)
|
||||
|
||||
#if QEI_ENABLE
|
||||
#define QEI_A_PIN (30u) // ST1
|
||||
#define QEI_B_PIN (34u) // ST2
|
||||
#define QEI_SELECT_PIN (35u) // ST3
|
||||
#endif
|
||||
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
#define SPINDLE_INDEX_PIN (34u) // ST2
|
||||
#define SPINDLE_PULSE_PIN (14u) // ST3
|
||||
#endif
|
||||
|
||||
// Define auxillary input pins
|
||||
#define AUXINPUT0_PIN (36u) // ST0
|
||||
#if !QEI_ENABLE
|
||||
#define AUXINPUT1_PIN (30u) // ST1
|
||||
#if !SPINDLE_SYNC_ENABLE
|
||||
#define AUXINPUT2_PIN (34u) // ST2
|
||||
#define AUXINPUT3_PIN (14u) // ST3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define AUXOUTPUT0_PIN (31u) // AUX0
|
||||
#define AUXOUTPUT1_PIN (32u) // AUX1
|
||||
#define AUXOUTPUT2_PIN (33u) // AUX2
|
||||
#define AUX_N_OUT 3
|
||||
#define AUX_OUT_MASK 0b111
|
||||
|
||||
#if KEYPAD_ENABLE
|
||||
#define KEYPAD_STROBE_PIN (41u) // I2C ST
|
||||
#endif
|
||||
|
||||
#if EEPROM_ENABLE || KEYPAD_ENABLE
|
||||
#define I2C_PORT 4
|
||||
#define I2C_SCL4 (24u) // Not referenced, for info only
|
||||
#define I2C_SDA4 (25u) // Not referenced, for info only
|
||||
#endif
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2020 Terje Io
|
||||
Copyright (c) 2020-2021 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,6 +25,10 @@
|
|||
#error Max number of axes is 3 for CNC BoosterPack
|
||||
#endif
|
||||
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
#error Spindle sync is not supported for CNC BoosterPack
|
||||
#endif
|
||||
|
||||
#ifdef EEPROM_ENABLE
|
||||
#undef EEPROM_ENABLE
|
||||
#endif
|
||||
|
@ -73,13 +77,13 @@
|
|||
|
||||
#if EEPROM_ENABLE || KEYPAD_ENABLE
|
||||
#define I2C_PORT 0
|
||||
#define I2C_SCL0 (19u) // Not used, for info only
|
||||
#define I2C_SDA0 (18u) // Not used, for info only
|
||||
#define I2C_SCL0 (19u) // Not referenced, for info only
|
||||
#define I2C_SDA0 (18u) // Not referenced, for info only
|
||||
#endif
|
||||
|
||||
#define UART_PORT 5
|
||||
#define UART_RX5 (21u) // Not used, for info only
|
||||
#define UART_TX5 (20u) // Not used, for info only
|
||||
#define UART_RX5 (21u) // Not referenced, for info only
|
||||
#define UART_TX5 (20u) // Not referenced, for info only
|
||||
|
||||
#define GPIO0_PIN (3u)
|
||||
#define GPIO1_PIN (29u)
|
||||
|
|
|
@ -104,15 +104,6 @@ static void ppi_timeout_isr (void);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define INPUT_GROUP_CONTROL (1 << 0)
|
||||
#define INPUT_GROUP_PROBE (1 << 1)
|
||||
#define INPUT_GROUP_LIMIT (1 << 2)
|
||||
#define INPUT_GROUP_KEYPAD (1 << 3)
|
||||
#define INPUT_GROUP_MPG (1 << 4)
|
||||
#define INPUT_GROUP_QEI (1 << 5)
|
||||
#define INPUT_GROUP_QEI_SELECT (1 << 6)
|
||||
#define INPUT_GROUP_SPINDLE_INDEX (1 << 7)
|
||||
|
||||
typedef struct {
|
||||
volatile uint_fast8_t head;
|
||||
volatile uint_fast8_t tail;
|
||||
|
@ -259,63 +250,93 @@ static gpio_t QEI_A, QEI_B;
|
|||
static gpio_t SpindleIndex;
|
||||
#endif
|
||||
|
||||
static input_signal_t inputpin[] = {
|
||||
#if ESTOP_ENABLE
|
||||
{ .id = Input_EStop, .port = &Reset, .pin = RESET_PIN, .group = INPUT_GROUP_CONTROL },
|
||||
#else
|
||||
{ .id = Input_Reset, .port = &Reset, .pin = RESET_PIN, .group = INPUT_GROUP_CONTROL },
|
||||
#ifdef AUXINPUT0_PIN
|
||||
static gpio_t AuxIn0;
|
||||
#endif
|
||||
{ .id = Input_FeedHold, .port = &FeedHold, .pin = FEED_HOLD_PIN, .group = INPUT_GROUP_CONTROL },
|
||||
{ .id = Input_CycleStart, .port = &CycleStart, .pin = CYCLE_START_PIN, .group = INPUT_GROUP_CONTROL },
|
||||
#ifdef AUXINPUT1_PIN
|
||||
static gpio_t AuxIn1;
|
||||
#endif
|
||||
#ifdef AUXINPUT2_PIN
|
||||
static gpio_t AuxIn2;
|
||||
#endif
|
||||
#ifdef AUXINPUT3_PIN
|
||||
static gpio_t AuxIn3;
|
||||
#endif
|
||||
|
||||
input_signal_t inputpin[] = {
|
||||
#if ESTOP_ENABLE
|
||||
{ .id = Input_EStop, .port = &Reset, .pin = RESET_PIN, .group = PinGroup_Control },
|
||||
#else
|
||||
{ .id = Input_Reset, .port = &Reset, .pin = RESET_PIN, .group = PinGroup_Control },
|
||||
#endif
|
||||
{ .id = Input_FeedHold, .port = &FeedHold, .pin = FEED_HOLD_PIN, .group = PinGroup_Control },
|
||||
{ .id = Input_CycleStart, .port = &CycleStart, .pin = CYCLE_START_PIN, .group = PinGroup_Control },
|
||||
#if SAFETY_DOOR_ENABLE
|
||||
{ .id = Input_SafetyDoor, .port = &SafetyDoor, .pin = SAFETY_DOOR_PIN, .group = INPUT_GROUP_CONTROL },
|
||||
{ .id = Input_SafetyDoor, .port = &SafetyDoor, .pin = SAFETY_DOOR_PIN, .group = PinGroup_Control },
|
||||
#endif
|
||||
#if defined(LIMITS_OVERRIDE_PIN)
|
||||
{ .id = Input_LimitsOverride, .port = &LimitsOverride, .pin = LIMITS_OVERRIDE_PIN, .group = INPUT_GROUP_CONTROL },
|
||||
{ .id = Input_LimitsOverride, .port = &LimitsOverride, .pin = LIMITS_OVERRIDE_PIN, .group = PinGroup_Control },
|
||||
#endif
|
||||
{ .id = Input_Probe, .port = &Probe, .pin = PROBE_PIN, .group = INPUT_GROUP_PROBE },
|
||||
{ .id = Input_LimitX, .port = &LimitX, .pin = X_LIMIT_PIN, .group = INPUT_GROUP_LIMIT },
|
||||
{ .id = Input_Probe, .port = &Probe, .pin = PROBE_PIN, .group = PinGroup_Probe },
|
||||
// Limit input pins must be consecutive
|
||||
{ .id = Input_LimitX, .port = &LimitX, .pin = X_LIMIT_PIN, .group = PinGroup_Limit },
|
||||
#ifdef X2_LIMIT_PIN
|
||||
{ .id = Input_LimitX_Max, .port = &LimitX2, .pin = X2_LIMIT_PIN, .group = INPUT_GROUP_LIMIT },
|
||||
{ .id = Input_LimitX_Max, .port = &LimitX2, .pin = X2_LIMIT_PIN, .group = PinGroup_Limit },
|
||||
#endif
|
||||
{ .id = Input_LimitY, .port = &LimitY, .pin = Y_LIMIT_PIN, .group = INPUT_GROUP_LIMIT },
|
||||
{ .id = Input_LimitY, .port = &LimitY, .pin = Y_LIMIT_PIN, .group = PinGroup_Limit },
|
||||
#ifdef Y2_LIMIT_PIN
|
||||
{ .id = Input_LimitY_Max, .port = &LimitY2, .pin = Y2_LIMIT_PIN, .group = INPUT_GROUP_LIMIT },
|
||||
{ .id = Input_LimitY_Max, .port = &LimitY2, .pin = Y2_LIMIT_PIN, .group = PinGroup_Limit },
|
||||
#endif
|
||||
{ .id = Input_LimitZ, .port = &LimitZ, .pin = Z_LIMIT_PIN, .group = INPUT_GROUP_LIMIT }
|
||||
{ .id = Input_LimitZ, .port = &LimitZ, .pin = Z_LIMIT_PIN, .group = PinGroup_Limit }
|
||||
#ifdef Z2_LIMIT_PIN
|
||||
, { .id = Input_LimitZ_Max, .port = &LimitZ2, .pin = Z2_LIMIT_PIN, .group = INPUT_GROUP_LIMIT }
|
||||
, { .id = Input_LimitZ_Max, .port = &LimitZ2, .pin = Z2_LIMIT_PIN, .group = PinGroup_Limit }
|
||||
#endif
|
||||
#ifdef A_LIMIT_PIN
|
||||
, { .id = Input_LimitA, .port = &LimitA, .pin = A_LIMIT_PIN, .group = INPUT_GROUP_LIMIT }
|
||||
, { .id = Input_LimitA, .port = &LimitA, .pin = A_LIMIT_PIN, .group = PinGroup_Limit }
|
||||
#endif
|
||||
#ifdef B_LIMIT_PIN
|
||||
, { .id = Input_LimitB, .port = &LimitB, .pin = B_LIMIT_PIN, .group = INPUT_GROUP_LIMIT }
|
||||
, { .id = Input_LimitB, .port = &LimitB, .pin = B_LIMIT_PIN, .group = PinGroup_Limit }
|
||||
#endif
|
||||
#ifdef C_LIMIT_PIN
|
||||
, { .id = Input_LimitC, .port = &LimitC, .pin = C_LIMIT_PIN, .group = INPUT_GROUP_LIMIT }
|
||||
, { .id = Input_LimitC, .port = &LimitC, .pin = C_LIMIT_PIN, .group = PinGroup_Limit }
|
||||
#endif
|
||||
// End limit pin definitions
|
||||
#if MPG_MODE_ENABLE
|
||||
, { .id = Input_ModeSelect, .port = &ModeSelect, .pin = MODE_PIN, .group = INPUT_GROUP_MPG }
|
||||
, { .id = Input_ModeSelect, .port = &ModeSelect, .pin = MODE_PIN, .group = PinGroup_MPG }
|
||||
#endif
|
||||
#if KEYPAD_ENABLE && defined(KEYPAD_STROBE_PIN)
|
||||
, { .id = Input_KeypadStrobe, .port = &KeypadStrobe, .pin = KEYPAD_STROBE_PIN, .group = INPUT_GROUP_KEYPAD }
|
||||
, { .id = Input_KeypadStrobe, .port = &KeypadStrobe, .pin = KEYPAD_STROBE_PIN, .group = PinGroup_Keypad }
|
||||
#endif
|
||||
#ifdef SPINDLE_INDEX_PIN
|
||||
, { .id = Input_SpindleIndex, .port = &SpindleIndex, .pin = SPINDLE_INDEX_PIN, .group = INPUT_GROUP_SPINDLE_INDEX }
|
||||
, { .id = Input_SpindleIndex, .port = &SpindleIndex, .pin = SPINDLE_INDEX_PIN, .group = PinGroup_SpindleIndex }
|
||||
#endif
|
||||
#if QEI_ENABLE
|
||||
, { .id = Input_QEI_A, .port = &QEI_A, .pin = QEI_A_PIN, .group = INPUT_GROUP_QEI }
|
||||
, { .id = Input_QEI_B, .port = &QEI_B, .pin = QEI_B_PIN, .group = INPUT_GROUP_QEI }
|
||||
, { .id = Input_QEI_A, .port = &QEI_A, .pin = QEI_A_PIN, .group = PinGroup_QEI }
|
||||
, { .id = Input_QEI_B, .port = &QEI_B, .pin = QEI_B_PIN, .group = PinGroup_QEI }
|
||||
#if QEI_SELECT_ENABLED
|
||||
, { .id = Input_QEI_Select, .port = &QEI_Select, .pin = QEI_SELECT_PIN, .group = INPUT_GROUP_QEI_SELECT }
|
||||
, { .id = Input_QEI_Select, .port = &QEI_Select, .pin = QEI_SELECT_PIN, .group = PinGroup_QEI_Select }
|
||||
#endif
|
||||
#if QEI_INDEX_ENABLED
|
||||
, { .id = Input_QEI_Index, .port = &QEI_Index, .pin = QEI_INDEX_PIN, .group = INPUT_GROUP_QEI }
|
||||
, { .id = Input_QEI_Index, .port = &QEI_Index, .pin = QEI_INDEX_PIN, .group = PinGroup_QEI }
|
||||
#endif
|
||||
#endif
|
||||
// Aux input pins must be consecutive
|
||||
#ifdef AUXINPUT0_PIN
|
||||
, { .id = Input_Aux0, .port = &AuxIn0, .pin = AUXINPUT0_PIN, .group = PinGroup_AuxInput }
|
||||
#endif
|
||||
#ifdef AUXINPUT1_PIN
|
||||
, { .id = Input_Aux1, .port = &AuxIn1, .pin = AUXINPUT1_PIN, .group = PinGroup_AuxInput }
|
||||
#endif
|
||||
#ifdef AUXINPUT2_PIN
|
||||
, { .id = Input_Aux2, .port = &AuxIn2, .pin = AUXINPUT2_PIN, .group = PinGroup_AuxInput }
|
||||
#endif
|
||||
#ifdef AUXINPUT3_PIN
|
||||
, { .id = Input_Aux3, .port = &AuxIn3, .pin = AUXINPUT3_PIN, .group = PinGroup_AuxInput }
|
||||
#endif
|
||||
};
|
||||
|
||||
static pin_group_pins_t aux_inputs = {0}, limit_inputs = {0};
|
||||
|
||||
#if USB_SERIAL_CDC || QEI_ENABLE
|
||||
#define ADD_MSEVENT 1
|
||||
static volatile bool ms_event = false;
|
||||
|
@ -344,7 +365,7 @@ static void spindle_set_speed (uint_fast16_t pwm_value);
|
|||
static modbus_stream_t modbus_stream = {0};
|
||||
#endif
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
|
||||
#include "grbl/spindle_sync.h"
|
||||
|
||||
|
@ -698,7 +719,7 @@ static void stepperCyclesPerTick (uint32_t cycles_per_tick)
|
|||
// stepper_t struct is defined in grbl/stepper.h
|
||||
static void stepperPulseStart (stepper_t *stepper)
|
||||
{
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
if(stepper->new_block && stepper->exec_segment->spindle_sync) {
|
||||
spindle_tracker.stepper_pulse_start_normal = hal.stepper.pulse_start;
|
||||
hal.stepper.pulse_start = stepperPulseStartSynchronized;
|
||||
|
@ -723,7 +744,7 @@ static void stepperPulseStart (stepper_t *stepper)
|
|||
// stepper_t struct is defined in grbl/stepper.h
|
||||
static void stepperPulseStartDelayed (stepper_t *stepper)
|
||||
{
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
if(stepper->new_block && stepper->exec_segment->spindle_sync) {
|
||||
spindle_tracker.stepper_pulse_start_normal = hal.stepper.pulse_start;
|
||||
hal.stepper.pulse_start = stepperPulseStartSynchronized;
|
||||
|
@ -755,7 +776,7 @@ static void stepperPulseStartDelayed (stepper_t *stepper)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
|
||||
// Spindle sync version: sets stepper direction and pulse pins and starts a step pulse.
|
||||
// Switches back to "normal" version if spindle synchronized motion is finished.
|
||||
|
@ -975,18 +996,17 @@ static void StepperDisableMotors (axes_signals_t axes, squaring_mode_t mode)
|
|||
// stepper drivers for sensorless homing.
|
||||
static void limitsEnable (bool on, bool homing)
|
||||
{
|
||||
uint32_t i = sizeof(inputpin) / sizeof(input_signal_t);
|
||||
uint32_t i = limit_inputs.n_pins;
|
||||
|
||||
on &= settings.limits.flags.hard_enabled;
|
||||
|
||||
do {
|
||||
if(inputpin[--i].group == INPUT_GROUP_LIMIT) {
|
||||
inputpin[i].gpio.reg->ISR = inputpin[i].gpio.bit; // Clear interrupt.
|
||||
if(on)
|
||||
inputpin[i].gpio.reg->IMR |= inputpin[i].gpio.bit; // Enable interrupt.
|
||||
else
|
||||
inputpin[i].gpio.reg->IMR &= ~inputpin[i].gpio.bit; // Disable interrupt.
|
||||
}
|
||||
i--;
|
||||
limit_inputs.pins[i].gpio.reg->ISR = limit_inputs.pins[i].gpio.bit; // Clear interrupt.
|
||||
if(on)
|
||||
limit_inputs.pins[i].gpio.reg->IMR |= limit_inputs.pins[i].gpio.bit; // Enable interrupt.
|
||||
else
|
||||
limit_inputs.pins[i].gpio.reg->IMR &= ~limit_inputs.pins[i].gpio.bit; // Disable interrupt.
|
||||
} while(i);
|
||||
}
|
||||
|
||||
|
@ -1055,7 +1075,7 @@ inline static void spindle_off ()
|
|||
inline static void spindle_on ()
|
||||
{
|
||||
DIGITAL_OUT(spindleEnable, !settings.spindle.invert.on);
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
spindleDataReset();
|
||||
#endif
|
||||
}
|
||||
|
@ -1155,7 +1175,7 @@ static void spindleSetStateVariable (spindle_state_t state, float rpm)
|
|||
spindle_set_speed(spindle_compute_pwm_value(&spindle_pwm, rpm, false));
|
||||
}
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
if(settings.spindle.at_speed_tolerance > 0.0f) {
|
||||
float tolerance = rpm * settings.spindle.at_speed_tolerance / 100.0f;
|
||||
spindle_data.rpm_low_limit = rpm - tolerance;
|
||||
|
@ -1181,7 +1201,7 @@ static spindle_state_t spindleGetState (void)
|
|||
if(pwmEnabled)
|
||||
state.on |= pwmEnabled;
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
float rpm = spindleGetData(SpindleData_RPM)->rpm;
|
||||
state.at_speed = settings.spindle.at_speed_tolerance <= 0.0f || (rpm >= spindle_data.rpm_low_limit && rpm <= spindle_data.rpm_high_limit);
|
||||
#endif
|
||||
|
@ -1206,7 +1226,7 @@ static void spindlePulseOn (uint_fast16_t pulse_length)
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
|
||||
static spindle_data_t *spindleGetData (spindle_data_request_t request)
|
||||
{
|
||||
|
@ -1397,7 +1417,7 @@ static void settings_changed (settings_t *settings)
|
|||
hal.spindle.set_state = spindleSetState;
|
||||
#endif
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
|
||||
if((hal.spindle.get_data = settings->spindle.ppr > 0 ? spindleGetData : NULL) && spindle_encoder.ppr != settings->spindle.ppr) {
|
||||
|
||||
|
@ -1630,7 +1650,7 @@ static void settings_changed (settings_t *settings)
|
|||
|
||||
signal->gpio.reg->ISR = signal->gpio.bit; // Clear interrupt.
|
||||
|
||||
if(signal->group != INPUT_GROUP_LIMIT) // If pin is not a limit pin
|
||||
if(signal->group != PinGroup_Limit) // If pin is not a limit pin
|
||||
signal->gpio.reg->IMR |= signal->gpio.bit; // enable interrupt
|
||||
|
||||
signal->active = (signal->gpio.reg->DR & signal->gpio.bit) != 0;
|
||||
|
@ -1877,7 +1897,7 @@ static bool driver_setup (settings_t *settings)
|
|||
|
||||
*(portConfigRegister(SPINDLEPWMPIN)) = 1;
|
||||
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
|
||||
CCM_CCGR1 |= CCM_CCGR1_GPT1_BUS(CCM_CCGR_ON);
|
||||
CCM_CMEOR |= CCM_CMEOR_MOD_EN_OV_GPT;
|
||||
|
@ -2078,7 +2098,7 @@ bool driver_init (void)
|
|||
options[strlen(options) - 1] = '\0';
|
||||
|
||||
hal.info = "iMXRT1062";
|
||||
hal.driver_version = "210313";
|
||||
hal.driver_version = "210414";
|
||||
#ifdef BOARD_NAME
|
||||
hal.board = BOARD_NAME;
|
||||
#endif
|
||||
|
@ -2122,7 +2142,7 @@ bool driver_init (void)
|
|||
hal.spindle.pulse_on = spindlePulseOn;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SPINDLE_SYNC_ENABLE
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
hal.driver_cap.spindle_sync = On;
|
||||
hal.driver_cap.spindle_at_speed = On;
|
||||
#endif
|
||||
|
@ -2226,8 +2246,27 @@ bool driver_init (void)
|
|||
uart_debug_write(ASCII_EOL "UART Debug:" ASCII_EOL);
|
||||
#endif
|
||||
|
||||
uint32_t i;
|
||||
input_signal_t *signal;
|
||||
|
||||
for(i = 0 ; i < sizeof(inputpin) / sizeof(input_signal_t); i++) {
|
||||
signal = &inputpin[i];
|
||||
|
||||
if(signal->group == PinGroup_AuxInput) {
|
||||
if(aux_inputs.pins == NULL)
|
||||
aux_inputs.pins = signal;
|
||||
aux_inputs.n_pins++;
|
||||
}
|
||||
|
||||
if(signal->group == PinGroup_Limit) {
|
||||
if(limit_inputs.pins == NULL)
|
||||
limit_inputs.pins = signal;
|
||||
limit_inputs.n_pins++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAS_BOARD_INIT
|
||||
board_init();
|
||||
board_init(&aux_inputs);
|
||||
#endif
|
||||
|
||||
#if ETHERNET_ENABLE
|
||||
|
@ -2298,7 +2337,7 @@ static void stepper_pulse_isr_delayed (void)
|
|||
TMR4_CTRL0 |= TMR_CTRL_CM(0b001);
|
||||
}
|
||||
|
||||
#if defined(SPINDLE_SYNC_ENABLE) && SPINDLE_PULSE_PIN == 14
|
||||
#if SPINDLE_SYNC_ENABLE && SPINDLE_PULSE_PIN == 14
|
||||
|
||||
static void spindle_pulse_isr (void)
|
||||
{
|
||||
|
@ -2386,15 +2425,15 @@ static void debounce_isr (void)
|
|||
grp |= signal->group;
|
||||
}
|
||||
|
||||
if(grp & INPUT_GROUP_LIMIT)
|
||||
if(grp & PinGroup_Limit)
|
||||
hal.limits.interrupt_callback(limitsGetState());
|
||||
|
||||
if(grp & INPUT_GROUP_CONTROL)
|
||||
if(grp & PinGroup_Control)
|
||||
hal.control.interrupt_callback(systemGetState());
|
||||
|
||||
#if QEI_SELECT_ENABLED
|
||||
|
||||
if(grp & INPUT_GROUP_QEI_SELECT) {
|
||||
if(grp & PinGroup_QEI_Select) {
|
||||
if(!qei.dbl_click_timeout)
|
||||
qei.dbl_click_timeout = qei.encoder.settings->dbl_click_window;
|
||||
else if(qei.dbl_click_timeout < qei.encoder.settings->dbl_click_window - 40) {
|
||||
|
@ -2437,7 +2476,7 @@ static void gpio_isr (void)
|
|||
debounce = true;
|
||||
} else {
|
||||
#if QEI_ENABLE
|
||||
if(inputpin[i].group & INPUT_GROUP_QEI) {
|
||||
if(inputpin[i].group & PinGroup_QEI) {
|
||||
qei_update();
|
||||
/*
|
||||
QEI_A.reg->IMR &= ~QEI_A.bit; // Switch off
|
||||
|
@ -2450,8 +2489,8 @@ static void gpio_isr (void)
|
|||
} else
|
||||
#endif
|
||||
|
||||
#if defined(SPINDLE_SYNC_ENABLE) && defined(SPINDLE_INDEX_PIN)
|
||||
if(inputpin[i].group & INPUT_GROUP_SPINDLE_INDEX) {
|
||||
#if SPINDLE_SYNC_ENABLE && defined(SPINDLE_INDEX_PIN)
|
||||
if(inputpin[i].group & PinGroup_SpindleIndex) {
|
||||
spindleLock = true;
|
||||
spindle_encoder.counter.index_count++;
|
||||
spindle_encoder.counter.last_index = GPT2_CNT;
|
||||
|
@ -2469,18 +2508,18 @@ static void gpio_isr (void)
|
|||
TMR3_CTRL0 |= TMR_CTRL_CM(0b001);
|
||||
}
|
||||
|
||||
if(grp & INPUT_GROUP_LIMIT) {
|
||||
if(grp & PinGroup_Limit) {
|
||||
limit_signals_t state = limitsGetState();
|
||||
if(limit_signals_merge(state).value) //TODO: add check for limit switches having same state as when limit_isr were invoked?
|
||||
hal.limits.interrupt_callback(state);
|
||||
}
|
||||
|
||||
if(grp & INPUT_GROUP_CONTROL)
|
||||
if(grp & PinGroup_Control)
|
||||
hal.control.interrupt_callback(systemGetState());
|
||||
|
||||
#if QEI_SELECT_ENABLED
|
||||
|
||||
if(grp & INPUT_GROUP_QEI_SELECT) {
|
||||
if(grp & PinGroup_QEI_Select) {
|
||||
if(!qei.dbl_click_timeout)
|
||||
qei.dbl_click_timeout = qei.encoder.settings->dbl_click_window;
|
||||
else if(qei.dbl_click_timeout < qei.encoder.settings->dbl_click_window - 40) {
|
||||
|
@ -2496,7 +2535,7 @@ static void gpio_isr (void)
|
|||
|
||||
static bool mpg_mutex = false;
|
||||
|
||||
if((grp & INPUT_GROUP_MPG) && !mpg_mutex) {
|
||||
if((grp & PinGroup_MPG) && !mpg_mutex) {
|
||||
mpg_mutex = true;
|
||||
modeChange();
|
||||
// hal.delay_ms(50, modeChange);
|
||||
|
@ -2505,7 +2544,7 @@ static void gpio_isr (void)
|
|||
#endif
|
||||
|
||||
#if KEYPAD_ENABLE
|
||||
if(grp & INPUT_GROUP_KEYPAD)
|
||||
if(grp & PinGroup_Keypad)
|
||||
keypad_keyclick_handler(!(KeypadStrobe.reg->DR & KeypadStrobe.bit));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
driver.h - driver code for IMXRT1062 processor (on Teensy 4.0 board)
|
||||
driver.h - driver code for IMXRT1062 processor (on Teensy 4.x board)
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "grbl/hal.h"
|
||||
#include "grbl/nuts_bolts.h"
|
||||
|
||||
#include "grbl/crossbar.h"
|
||||
|
||||
#define DIGITAL_IN(gpio) (!!(gpio.reg->DR & gpio.bit))
|
||||
#define DIGITAL_OUT(gpio, on) { if(on) gpio.reg->DR_SET = gpio.bit; else gpio.reg->DR_CLEAR = gpio.bit; }
|
||||
|
@ -89,6 +89,9 @@
|
|||
#ifndef EEPROM_IS_FRAM
|
||||
#define EEPROM_IS_FRAM 0
|
||||
#endif
|
||||
#ifndef SPINDLE_SYNC_ENABLE
|
||||
#define SPINDLE_SYNC_ENABLE 0
|
||||
#endif
|
||||
#ifndef TRINAMIC_ENABLE
|
||||
#define TRINAMIC_ENABLE 0
|
||||
#endif
|
||||
|
@ -160,8 +163,8 @@
|
|||
#include "T40X101_map.h"
|
||||
#elif defined(BOARD_T41U5XBB)
|
||||
#include "T41U5XBB_map.h"
|
||||
#elif defined(BOARD_T41U5XSS)
|
||||
#include "T41U5XSS_map.h"
|
||||
#elif defined(BOARD_T41U5XBB_SS)
|
||||
#include "T41U5XBB_ss_map.h"
|
||||
#elif defined(BOARD_T41PROBB)
|
||||
#include "T41ProBB_map.h"
|
||||
#elif defined(BOARD_MY_MACHINE)
|
||||
|
@ -245,46 +248,6 @@
|
|||
#error "QEI_ENABLE requires encoder input pins A and B to be defined!"
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
Input_Probe = 0,
|
||||
Input_Reset,
|
||||
Input_FeedHold,
|
||||
Input_CycleStart,
|
||||
Input_SafetyDoor,
|
||||
Input_LimitsOverride,
|
||||
Input_EStop,
|
||||
Input_ModeSelect,
|
||||
Input_LimitX,
|
||||
Input_LimitX_Max,
|
||||
Input_LimitY,
|
||||
Input_LimitY_Max,
|
||||
Input_LimitZ,
|
||||
Input_LimitZ_Max,
|
||||
Input_LimitA,
|
||||
Input_LimitA_Max,
|
||||
Input_LimitB,
|
||||
Input_LimitB_Max,
|
||||
Input_LimitC,
|
||||
Input_LimitC_Max,
|
||||
Input_KeypadStrobe,
|
||||
Input_QEI_A,
|
||||
Input_QEI_B,
|
||||
Input_QEI_Select,
|
||||
Input_QEI_Index,
|
||||
Input_SpindleIndex,
|
||||
Input_Aux0,
|
||||
Input_Aux1,
|
||||
Input_Aux2,
|
||||
Input_Aux3
|
||||
} input_t;
|
||||
|
||||
typedef enum {
|
||||
IRQ_Mode_None = 0b00,
|
||||
IRQ_Mode_Change = 0b01,
|
||||
IRQ_Mode_Rising = 0b10,
|
||||
IRQ_Mode_Falling = 0b11
|
||||
} irq_mode_t;
|
||||
|
||||
typedef struct {
|
||||
volatile uint32_t DR;
|
||||
volatile uint32_t GDIR;
|
||||
|
@ -306,17 +269,22 @@ typedef struct {
|
|||
} gpio_t;
|
||||
|
||||
typedef struct {
|
||||
input_t id;
|
||||
uint8_t group;
|
||||
pin_function_t id;
|
||||
pin_group_t group;
|
||||
uint8_t pin;
|
||||
gpio_t *port;
|
||||
gpio_t gpio; // doubled up for now for speed...
|
||||
irq_mode_t irq_mode;
|
||||
pin_irq_mode_t irq_mode;
|
||||
uint8_t offset;
|
||||
volatile bool active;
|
||||
volatile bool debounce;
|
||||
} input_signal_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t n_pins;
|
||||
input_signal_t *pins;
|
||||
} pin_group_pins_t;
|
||||
|
||||
// The following struct is pulled from the Teensy Library core, Copyright (c) 2019 PJRC.COM, LLC.
|
||||
|
||||
typedef struct {
|
||||
|
@ -330,9 +298,12 @@ typedef struct {
|
|||
|
||||
void selectStream (stream_type_t stream);
|
||||
void pinModeOutput (gpio_t *gpio, uint8_t pin);
|
||||
|
||||
uint32_t xTaskGetTickCount();
|
||||
|
||||
#ifdef HAS_BOARD_INIT
|
||||
void board_init(pin_group_pins_t *aux_inputs);
|
||||
#endif
|
||||
|
||||
#ifdef UART_DEBUG
|
||||
void uart_debug_write (char *s);
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
generic_map.h - driver code for IMXRT1062 processor (on Teensy 4.0 board)
|
||||
generic_map.h - driver code for IMXRT1062 processor (on Teensy 4.x board)
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2020 Terje Io
|
||||
Copyright (c) 2020-2021 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,6 +19,10 @@
|
|||
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if SPINDLE_SYNC_ENABLE
|
||||
#error Spindle sync is not supported
|
||||
#endif
|
||||
|
||||
// Define step pulse output pins.
|
||||
#define X_STEP_PIN (2u)
|
||||
#define Y_STEP_PIN (4u)
|
||||
|
@ -69,8 +73,8 @@
|
|||
|
||||
#if EEPROM_ENABLE || KEYPAD_ENABLE
|
||||
#define I2C_PORT 4
|
||||
#define I2C_SCL4 (24u) // Not used, for info only
|
||||
#define I2C_SDA4 (25u) // Not used, for info only
|
||||
#define I2C_SCL4 (24u) // Not referenced, for info only
|
||||
#define I2C_SDA4 (25u) // Not referenced, for info only
|
||||
#endif
|
||||
|
||||
#if QEI_ENABLE
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
// If none is enabled pin mappings from generic_map.h will be used
|
||||
//#define BOARD_T40X101
|
||||
#define BOARD_T41U5XBB
|
||||
//#define BOARD_T41U5XBB_SS // For a modified T41U5XBB board, allows spindle sync to be enabled.
|
||||
//#define BOARD_CNC_BOOSTERPACK
|
||||
//#define BOARD_MY_MACHINE // Add my_machine_map.h before enabling this!
|
||||
|
||||
|
@ -38,7 +39,7 @@ BOARD_T40X101 | no | no | yes | yes
|
|||
BOARD_T41U5XBB | yes | yes | yes | yes³ | max 5 |
|
||||
BOARD_CNC_BOOSTERPACK | yes² | yes | yes | yes | max 3 |
|
||||
|
||||
¹ Teensy 4.1 only.
|
||||
¹ Teensy 4.1 only
|
||||
² External magjack.
|
||||
³ EEPROM is optional and must be added to the board.
|
||||
|
||||
|
@ -46,21 +47,22 @@ N_AXIS has a default value of 3, edit grbl\config.h to increase.
|
|||
|
||||
*/
|
||||
|
||||
#define USB_SERIAL_CDC 2 // 1 for Arduino class library and 2 for PJRC C library. Comment out to use UART communication.
|
||||
//#define USB_SERIAL_WAIT 1 // Wait for USB connection before starting grblHAL.
|
||||
//#define SPINDLE_HUANYANG 1 // Set to 1 or 2 for Huanyang VFD spindle. Requires spindle plugin.
|
||||
//#define QEI_ENABLE 1 // Enable quadrature encoder interfaces. Max value is 1. Requires encoder plugin.
|
||||
//#define ETHERNET_ENABLE 1 // Ethernet streaming. Requires networking plugin.
|
||||
//#define SDCARD_ENABLE 1 // Run gcode programs from SD card, requires sdcard plugin.
|
||||
//#define KEYPAD_ENABLE 1 // I2C keypad for jogging etc., requires keypad plugin.
|
||||
//#define PLASMA_ENABLE 1 // Plasma/THC plugin. To be completed.
|
||||
//#define PPI_ENABLE 1 // Laser PPI plugin. To be completed.
|
||||
//#define ODOMETER_ENABLE 1 // Odometer plugin. To be completed.
|
||||
//#define EEPROM_ENABLE 1 // I2C EEPROM support. Set to 1 for 24LC16(2K), 2 for larger sizes. Requires eeprom plugin.
|
||||
//#define EEPROM_IS_FRAM 1 // Uncomment when EEPROM is enabled and chip is FRAM, this to remove write delay.
|
||||
|
||||
//#define ESTOP_ENABLE 0 // When enabled only real-time report requests will be executed when the reset pin is asserted.
|
||||
// Note: if left commented out the default setting is determined from COMPATIBILITY_LEVEL.
|
||||
#define USB_SERIAL_CDC 2 // 1 for Arduino class library and 2 for PJRC C library. Comment out to use UART communication.
|
||||
//#define USB_SERIAL_WAIT 1 // Wait for USB connection before starting grblHAL.
|
||||
//#define SPINDLE_HUANYANG 1 // Set to 1 or 2 for Huanyang VFD spindle. Requires spindle plugin.
|
||||
//#define QEI_ENABLE 1 // Enable quadrature encoder interfaces. Max value is 1. Requires encoder plugin.
|
||||
//#define ETHERNET_ENABLE 1 // Ethernet streaming. Requires networking plugin.
|
||||
//#define SDCARD_ENABLE 1 // Run gcode programs from SD card, requires sdcard plugin.
|
||||
//#define KEYPAD_ENABLE 1 // I2C keypad for jogging etc., requires keypad plugin.
|
||||
//#define PLASMA_ENABLE 1 // Plasma/THC plugin. To be completed.
|
||||
//#define PPI_ENABLE 1 // Laser PPI plugin. To be completed.
|
||||
//#define ODOMETER_ENABLE 1 // Odometer plugin. To be completed.
|
||||
//#define EEPROM_ENABLE 1 // I2C EEPROM support. Set to 1 for 24LC16(2K), 2 for larger sizes. Requires eeprom plugin.
|
||||
//#define EEPROM_IS_FRAM 1 // Uncomment when EEPROM is enabled and chip is FRAM, this to remove write delay.
|
||||
//#define SPINDLE_SYNC_ENABLE 1 // Enable spindle sync support (G33, G76). !! NOTE: Alpha quality - enable only for test or verification.
|
||||
// Currently only available for BOARD_T41U5XBB_SS.
|
||||
//#define ESTOP_ENABLE 0 // When enabled only real-time report requests will be executed when the reset pin is asserted.
|
||||
// Note: if left commented out the default setting is determined from COMPATIBILITY_LEVEL.
|
||||
|
||||
#if ETHERNET_ENABLE > 0
|
||||
#define TELNET_ENABLE 1 // Telnet daemon - requires Ethernet streaming enabled.
|
||||
|
|
Loading…
Reference in New Issue