Merge pull request #6284 from thinkyhead/rc_wt150_rebase
wt150 (Mightyboard Rev E) & RRD Full Graphic Smart Controller
This commit is contained in:
		
						commit
						7a704af5e6
					
				| @ -720,7 +720,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -770,7 +770,7 @@ static_assert(1 >= 0 | |||||||
|  */ |  */ | ||||||
| #if !HAS_HEATER_0 | #if !HAS_HEATER_0 | ||||||
|   #error "HEATER_0_PIN not defined for this board." |   #error "HEATER_0_PIN not defined for this board." | ||||||
| #elif !PIN_EXISTS(TEMP_0) | #elif !PIN_EXISTS(TEMP_0) && !(defined(MAX6675_SS) && MAX6675_SS >= 0) | ||||||
|   #error "TEMP_0_PIN not defined for this board." |   #error "TEMP_0_PIN not defined for this board." | ||||||
| #elif !PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !PIN_EXISTS(E0_ENABLE) | #elif !PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !PIN_EXISTS(E0_ENABLE) | ||||||
|   #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." |   #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." | ||||||
|  | |||||||
							
								
								
									
										91
									
								
								Marlin/digipot_mcp4018.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								Marlin/digipot_mcp4018.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,91 @@ | |||||||
|  | /**
 | ||||||
|  |  * Marlin 3D Printer Firmware | ||||||
|  |  * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | ||||||
|  |  * | ||||||
|  |  * Based on Sprinter and grbl. | ||||||
|  |  * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm | ||||||
|  |  * | ||||||
|  |  * This program 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. | ||||||
|  |  * | ||||||
|  |  * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "MarlinConfig.h" | ||||||
|  | 
 | ||||||
|  | #if ENABLED(DIGIPOT_I2C) && ENABLED(DIGIPOT_MCP4018) | ||||||
|  | 
 | ||||||
|  | #include "Stream.h" | ||||||
|  | #include "utility/twi.h" | ||||||
|  | #include <SlowSoftI2CMaster.h>  //https://github.com/stawel/SlowSoftI2CMaster
 | ||||||
|  | 
 | ||||||
|  | // Settings for the I2C based DIGIPOT (MCP4018) based on WT150
 | ||||||
|  | 
 | ||||||
|  | #define DIGIPOT_I2C_ADDRESS             0x2f | ||||||
|  | 
 | ||||||
|  | #define DIGIPOT_A4988_Rsx               0.250 | ||||||
|  | #define DIGIPOT_A4988_Vrefmax           5.0 | ||||||
|  | #define DIGIPOT_A4988_MAX_VALUE         127 | ||||||
|  | 
 | ||||||
|  | #define DIGIPOT_A4988_Itripmax(Vref)    ((Vref)/(8.0*DIGIPOT_A4988_Rsx)) | ||||||
|  | 
 | ||||||
|  | #define DIGIPOT_A4988_FACTOR            (DIGIPOT_A4988_MAX_VALUE/DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax)) | ||||||
|  | //TODO: MAX_CURRENT -0.5A ?? (currently set to 2A, max possible current 2.5A)
 | ||||||
|  | #define DIGIPOT_A4988_MAX_CURRENT       (DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax) - 0.5) | ||||||
|  | 
 | ||||||
|  | static byte current_to_wiper(float current) { | ||||||
|  |   return byte(ceil(float((DIGIPOT_A4988_FACTOR * current)))); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static uint8_t sda_pins[DIGIPOT_I2C_NUM_CHANNELS] = { | ||||||
|  |   DIGIPOTS_I2C_SDA_X, | ||||||
|  |   DIGIPOTS_I2C_SDA_Y, | ||||||
|  |   DIGIPOTS_I2C_SDA_Z, | ||||||
|  |   DIGIPOTS_I2C_SDA_E0, | ||||||
|  |   DIGIPOTS_I2C_SDA_E1, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = { | ||||||
|  |   SlowSoftI2CMaster { sda_pins[0], DIGIPOTS_I2C_SCL }, | ||||||
|  |   SlowSoftI2CMaster { sda_pins[1], DIGIPOTS_I2C_SCL }, | ||||||
|  |   SlowSoftI2CMaster { sda_pins[2], DIGIPOTS_I2C_SCL }, | ||||||
|  |   SlowSoftI2CMaster { sda_pins[3], DIGIPOTS_I2C_SCL }, | ||||||
|  |   SlowSoftI2CMaster { sda_pins[4], DIGIPOTS_I2C_SCL } | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | static void i2c_send(int channel, byte v) { | ||||||
|  |   if (WITHIN(channel, 0, DIGIPOT_I2C_NUM_CHANNELS - 1)) { | ||||||
|  |     pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS) << 1) | I2C_WRITE); | ||||||
|  |     pots[channel].i2c_write(v); | ||||||
|  |     pots[channel].i2c_stop(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // This is for the MCP4018 I2C based digipot
 | ||||||
|  | void digipot_i2c_set_current(int channel, float current) { | ||||||
|  |   current = min(max(current, 0.0f), float(DIGIPOT_A4988_MAX_CURRENT)); | ||||||
|  | 
 | ||||||
|  |   i2c_send(channel, current_to_wiper(current)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void digipot_i2c_init() { | ||||||
|  |   const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS; | ||||||
|  | 
 | ||||||
|  |   for (uint8_t i = 0; i < DIGIPOT_I2C_NUM_CHANNELS; i++) | ||||||
|  |     pots[i].i2c_init(); | ||||||
|  | 
 | ||||||
|  |   // setup initial currents as defined in Configuration_adv.h
 | ||||||
|  |   for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++) | ||||||
|  |     digipot_i2c_set_current(i, digipot_motor_current[i]); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif // DIGIPOT_I2C && DIGIPOT_MCP4018
 | ||||||
| @ -22,7 +22,7 @@ | |||||||
| 
 | 
 | ||||||
| #include "MarlinConfig.h" | #include "MarlinConfig.h" | ||||||
| 
 | 
 | ||||||
| #if ENABLED(DIGIPOT_I2C) | #if ENABLED(DIGIPOT_I2C) && DISABLED(DIGIPOT_MCP4018) | ||||||
| 
 | 
 | ||||||
| #include "Stream.h" | #include "Stream.h" | ||||||
| #include "utility/twi.h" | #include "utility/twi.h" | ||||||
|  | |||||||
| @ -719,7 +719,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 1 | #define X_ENABLE_ON 1 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -703,7 +703,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -703,7 +703,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -711,7 +711,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -714,7 +714,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -2 | #define Z_PROBE_OFFSET_RANGE_MIN -2 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX  0 | #define Z_PROBE_OFFSET_RANGE_MAX  0 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -422,6 +421,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -269,7 +269,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -420,8 +419,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -434,6 +433,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -720,7 +720,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -720,7 +720,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -720,7 +720,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -719,7 +719,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -735,7 +735,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -740,7 +740,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -264,7 +264,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -415,8 +414,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -429,6 +428,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -974,7 +974,7 @@ | |||||||
|   #define UBL_PROBE_PT_2_Y 20 |   #define UBL_PROBE_PT_2_Y 20 | ||||||
|   #define UBL_PROBE_PT_3_X 180 |   #define UBL_PROBE_PT_3_X 180 | ||||||
|   #define UBL_PROBE_PT_3_Y 20 |   #define UBL_PROBE_PT_3_Y 20 | ||||||
|   #define UBL_G26_MESH_EDITING     // Enable G26 mesh editing
 |   //#define UBL_G26_MESH_EDITING    // Enable G26 mesh editing
 | ||||||
| 
 | 
 | ||||||
| #elif ENABLED(MESH_BED_LEVELING) | #elif ENABLED(MESH_BED_LEVELING) | ||||||
| 
 | 
 | ||||||
| @ -990,6 +990,17 @@ | |||||||
| 
 | 
 | ||||||
| #endif // BED_LEVELING
 | #endif // BED_LEVELING
 | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * Use the LCD controller for bed leveling | ||||||
|  |  * Requires MESH_BED_LEVELING or PROBE_MANUALLY | ||||||
|  |  */ | ||||||
|  | //#define LCD_BED_LEVELING
 | ||||||
|  | 
 | ||||||
|  | #if ENABLED(LCD_BED_LEVELING) | ||||||
|  |   #define MBL_Z_STEP 0.025    // Step size while manually probing Z axis.
 | ||||||
|  |   #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment
 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Commands to execute at the end of G29 probing. |  * Commands to execute at the end of G29 probing. | ||||||
|  * Useful to retract or move the Z probe out of the way. |  * Useful to retract or move the Z probe out of the way. | ||||||
| @ -1537,13 +1548,13 @@ | |||||||
| 
 | 
 | ||||||
| // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can
 | // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can
 | ||||||
| // be used to mitigate the associated resolution loss. If enabled,
 | // be used to mitigate the associated resolution loss. If enabled,
 | ||||||
| // some of the PWM cycles are stretched so on average the wanted
 | // some of the PWM cycles are stretched so on average the desired
 | ||||||
| // duty cycle is attained.
 | // duty cycle is attained.
 | ||||||
| //#define SOFT_PWM_DITHER
 | //#define SOFT_PWM_DITHER
 | ||||||
| 
 | 
 | ||||||
| // Temperature status LEDs that display the hotend and bed temperature.
 | // Temperature status LEDs that display the hotend and bed temperature.
 | ||||||
| // If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
 | // If all hotends, bed temperature, and target temperature are under 54C
 | ||||||
| // Otherwise the RED led is on. There is 1C hysteresis.
 | // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
 | ||||||
| //#define TEMP_STAT_LEDS
 | //#define TEMP_STAT_LEDS
 | ||||||
| 
 | 
 | ||||||
| // M240  Triggers a camera by emulating a Canon RC-1 Remote
 | // M240  Triggers a camera by emulating a Canon RC-1 Remote
 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -286,6 +285,7 @@ | |||||||
| 
 | 
 | ||||||
|   #if ENABLED(Z_DUAL_ENDSTOPS) |   #if ENABLED(Z_DUAL_ENDSTOPS) | ||||||
|     #define Z2_USE_ENDSTOP _XMAX_ |     #define Z2_USE_ENDSTOP _XMAX_ | ||||||
|  |     #define Z_DUAL_ENDSTOPS_ADJUSTMENT  0  // use M666 command to determine/test this value
 | ||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
| #endif // Z_DUAL_STEPPER_DRIVERS
 | #endif // Z_DUAL_STEPPER_DRIVERS
 | ||||||
| @ -394,18 +394,36 @@ | |||||||
| // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
 | // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
 | ||||||
| #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
 | #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
 | ||||||
| 
 | 
 | ||||||
| // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
 | /**
 | ||||||
| #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
 |  *  @section  stepper motor current | ||||||
| 
 |  * | ||||||
| // Motor Current controlled via PWM (Overridable on supported boards with PWM-driven motor driver current)
 |  *  Some boards have a means of setting the stepper motor current via firmware. | ||||||
|  |  * | ||||||
|  |  *  The power on motor currents are set by: | ||||||
|  |  *    PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 | ||||||
|  |  *                         known compatible chips: A4982 | ||||||
|  |  *    DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H | ||||||
|  |  *                         known compatible chips: AD5206 | ||||||
|  |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  |  *                         known compatible chips: MCP4728 | ||||||
|  |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  |  * | ||||||
|  |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  |  *    M907 - applies to all. | ||||||
|  |  *    M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H | ||||||
|  |  *    M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  |  */ | ||||||
| //#define PWM_MOTOR_CURRENT {1300, 1300, 1250} // Values in milliamps
 | //#define PWM_MOTOR_CURRENT {1300, 1300, 1250} // Values in milliamps
 | ||||||
|  | //#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
 | ||||||
|  | //#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis
 | ||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
| // Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
 | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
| 
 | 
 | ||||||
| //===========================================================================
 | //===========================================================================
 | ||||||
| //=============================Additional Features===========================
 | //=============================Additional Features===========================
 | ||||||
| @ -648,6 +666,7 @@ | |||||||
| //#define BEZIER_CURVE_SUPPORT
 | //#define BEZIER_CURVE_SUPPORT
 | ||||||
| 
 | 
 | ||||||
| // G38.2 and G38.3 Probe Target
 | // G38.2 and G38.3 Probe Target
 | ||||||
|  | // ENABLE PROBE_DOUBLE_TOUCH if you want G38 to double touch
 | ||||||
| //#define G38_PROBE_TARGET
 | //#define G38_PROBE_TARGET
 | ||||||
| #if ENABLED(G38_PROBE_TARGET) | #if ENABLED(G38_PROBE_TARGET) | ||||||
|   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
 |   #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)
 | ||||||
|  | |||||||
| @ -711,7 +711,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -720,7 +720,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -409,8 +408,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -423,6 +422,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -822,7 +822,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -409,8 +408,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -423,6 +422,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -817,7 +817,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -409,8 +408,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -423,6 +422,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -261,7 +261,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -414,8 +413,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -428,6 +427,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -833,7 +833,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -409,8 +408,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -423,6 +422,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
| @ -723,7 +723,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 0 | #define X_ENABLE_ON 0 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 4 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 4 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS { 1.7, 1.7, 1.7, 1.7 }  // 5DPRINT
 | #define DIGIPOT_I2C_MOTOR_CURRENTS { 1.7, 1.7, 1.7, 1.7 }  // 5DPRINT
 | ||||||
|  | |||||||
| @ -716,7 +716,6 @@ | |||||||
| #define Z_PROBE_OFFSET_RANGE_MIN -20 | #define Z_PROBE_OFFSET_RANGE_MIN -20 | ||||||
| #define Z_PROBE_OFFSET_RANGE_MAX 20 | #define Z_PROBE_OFFSET_RANGE_MAX 20 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
 | ||||||
| // :{ 0:'Low', 1:'High' }
 | // :{ 0:'Low', 1:'High' }
 | ||||||
| #define X_ENABLE_ON 1 | #define X_ENABLE_ON 1 | ||||||
|  | |||||||
| @ -256,7 +256,6 @@ | |||||||
|   #define INVERT_X2_VS_X_DIR true |   #define INVERT_X2_VS_X_DIR true | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Dual Y Steppers
 | // Dual Y Steppers
 | ||||||
| // Uncomment this option to drive two Y axis motors.
 | // Uncomment this option to drive two Y axis motors.
 | ||||||
| // The next unused E driver will be assigned to the second Y stepper.
 | // The next unused E driver will be assigned to the second Y stepper.
 | ||||||
| @ -407,8 +406,8 @@ | |||||||
|  *                         known compatible chips: AD5206 |  *                         known compatible chips: AD5206 | ||||||
|  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 |  *    DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 | ||||||
|  *                         known compatible chips: MCP4728 |  *                         known compatible chips: MCP4728 | ||||||
|  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT & AZTEEG_X3_PRO |  *    DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE | ||||||
|  *                         known compatible chips: MCP4451 |  *                         known compatible chips: MCP4451, MCP4018 | ||||||
|  * |  * | ||||||
|  *  Motor currents can also be set by M907 - M910 and by the LCD. |  *  Motor currents can also be set by M907 - M910 and by the LCD. | ||||||
|  *    M907 - applies to all. |  *    M907 - applies to all. | ||||||
| @ -421,6 +420,7 @@ | |||||||
| 
 | 
 | ||||||
| // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
 | ||||||
| //#define DIGIPOT_I2C
 | //#define DIGIPOT_I2C
 | ||||||
|  | //#define DIGIPOT_MCP4018
 | ||||||
| #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
 | ||||||
| // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
 | ||||||
| #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | #define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}  //  AZTEEG_X3_PRO
 | ||||||
|  | |||||||
							
								
								
									
										1590
									
								
								Marlin/example_configurations/wt150/Configuration.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1590
									
								
								Marlin/example_configurations/wt150/Configuration.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1116
									
								
								Marlin/example_configurations/wt150/Configuration_adv.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1116
									
								
								Marlin/example_configurations/wt150/Configuration_adv.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -129,6 +129,9 @@ | |||||||
| #define THERMO_CS1          5 // E3
 | #define THERMO_CS1          5 // E3
 | ||||||
| #define THERMO_CS2          2 // E4
 | #define THERMO_CS2          2 // E4
 | ||||||
| 
 | 
 | ||||||
|  | #define MAX6675_SS          THERMO_CS1 | ||||||
|  | #define MAX6675_SCK_PIN     THERMO_SCK_PIN | ||||||
|  | #define MAX6675_DO_PIN      THERMO_DO_PIN | ||||||
| //
 | //
 | ||||||
| // Augmentation for auto-assigning plugs
 | // Augmentation for auto-assigning plugs
 | ||||||
| //
 | //
 | ||||||
| @ -137,7 +140,7 @@ | |||||||
| // With no heated bed, an additional 24V fan is possible.
 | // With no heated bed, an additional 24V fan is possible.
 | ||||||
| //
 | //
 | ||||||
| #define MOSFET_A_PIN     6 // H3
 | #define MOSFET_A_PIN     6 // H3
 | ||||||
| #define MOSFET_B_PIN     9 // B5
 | #define MOSFET_B_PIN    11 // B5
 | ||||||
| #define MOSFET_C_PIN    45 // L4
 | #define MOSFET_C_PIN    45 // L4
 | ||||||
| #define MOSFET_D_PIN    44 // L5
 | #define MOSFET_D_PIN    44 // L5
 | ||||||
| 
 | 
 | ||||||
| @ -181,8 +184,8 @@ | |||||||
| //
 | //
 | ||||||
| // Extruder Auto Fan Pins
 | // Extruder Auto Fan Pins
 | ||||||
| //
 | //
 | ||||||
| #define EXTRUDER_0_AUTO_FAN  7 // H4
 | #define ORIG_E0_AUTO_FAN_PIN   7 // H4
 | ||||||
| #define EXTRUDER_1_AUTO_FAN 12 // B6
 | #define ORIG_E1_AUTO_FAN_PIN  12 // B6
 | ||||||
| 
 | 
 | ||||||
| //
 | //
 | ||||||
| // Misc. Functions
 | // Misc. Functions
 | ||||||
| @ -194,29 +197,117 @@ | |||||||
| //
 | //
 | ||||||
| // LCD / Controller
 | // LCD / Controller
 | ||||||
| //
 | //
 | ||||||
| // Replicator uses a 3-wire SR controller with HD44780
 |  | ||||||
| // For now, pretend it's the SAV
 |  | ||||||
| //
 |  | ||||||
| #define SAV_3DLCD |  | ||||||
| #define SR_DATA_PIN         34 // C3
 |  | ||||||
| #define SR_CLK_PIN          35 // C2
 |  | ||||||
| #define SR_STROBE_PIN       33 // C4
 |  | ||||||
| 
 | 
 | ||||||
| #define BTN_UP              75 // J4
 | #ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER | ||||||
| #define BTN_DOWN            73 // J3
 |  | ||||||
| #define BTN_LEFT            72 // J2
 |  | ||||||
| #define BTN_RIGHT           14 // J1
 |  | ||||||
| #define BTN_CENTER          15 // J0
 |  | ||||||
| #define BTN_ENC             BTN_CENTER |  | ||||||
| 
 | 
 | ||||||
| #define BEEPER_PIN           4 // G5
 |   #define LCD_PINS_RS           33 // C4, LCD-STROBE
 | ||||||
|  |   #define LCD_PINS_ENABLE       72 // J2, LEFT
 | ||||||
|  |   #define LCD_PINS_D4           35 // C2, LCD-CLK
 | ||||||
|  |   #define LCD_PINS_D5           32 // C5, RLED
 | ||||||
|  |   #define LCD_PINS_D6           34 // C3, LCD-DATA
 | ||||||
|  |   #define LCD_PINS_D7           31 // C6, GLED
 | ||||||
|  | 
 | ||||||
|  |   #define BTN_EN2               75 // J4, UP
 | ||||||
|  |   #define BTN_EN1               73 // J3, DOWN
 | ||||||
|  |   //STOP button connected as KILL_PIN
 | ||||||
|  |   #define KILL_PIN              14 // J1, RIGHT
 | ||||||
|  |   //KILL - not connected
 | ||||||
|  | 
 | ||||||
|  |   #define BEEPER_PIN             8 // H5, SD_WP
 | ||||||
|  | 
 | ||||||
|  |   #define BTN_CENTER            15 // J0
 | ||||||
|  |   #define BTN_ENC               BTN_CENTER | ||||||
|  | 
 | ||||||
|  |   //on board leds
 | ||||||
|  |   #define STAT_LED_RED_LED      SERVO0_PIN // C1 (1280-EX1, DEBUG2)
 | ||||||
|  |   #define STAT_LED_BLUE_PIN     SERVO1_PIN // C0 (1280-EX2, DEBUG3)
 | ||||||
|  | 
 | ||||||
|  | #else | ||||||
|  |   // Replicator uses a 3-wire SR controller with HD44780
 | ||||||
|  |   // For now, pretend it's the SAV
 | ||||||
|  |   //
 | ||||||
|  | 
 | ||||||
|  |   #define SAV_3DLCD | ||||||
|  |   #define SR_DATA_PIN         34 // C3
 | ||||||
|  |   #define SR_CLK_PIN          35 // C2
 | ||||||
|  |   #define SR_STROBE_PIN       33 // C4
 | ||||||
|  | 
 | ||||||
|  |   #define BTN_UP              75 // J4
 | ||||||
|  |   #define BTN_DOWN            73 // J3
 | ||||||
|  |   #define BTN_LEFT            72 // J2
 | ||||||
|  |   #define BTN_RIGHT           14 // J1
 | ||||||
|  |   #define BTN_CENTER          15 // J0
 | ||||||
|  |   #define BTN_ENC             BTN_CENTER | ||||||
|  | 
 | ||||||
|  |   #define BEEPER_PIN           4 // G5
 | ||||||
|  | 
 | ||||||
|  |   #define STAT_LED_RED_PIN    32 // C5
 | ||||||
|  |   #define STAT_LED_BLUE_PIN   31 // C6 (Actually green)
 | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #define STAT_LED_RED        32 // C5
 |  | ||||||
| #define STAT_LED_BLUE       31 // C6 (Actually green)
 |  | ||||||
| 
 | 
 | ||||||
| //
 | //
 | ||||||
| // SD Card
 | // SD Card
 | ||||||
| //
 | //
 | ||||||
| #define SDSS                53 // B0
 | #define SDSS                53 // B0
 | ||||||
| #define SD_DETECT_PIN       30 // C7
 | #define SD_DETECT_PIN       9  // H6
 | ||||||
| 
 | 
 | ||||||
|  | #define MAX_PIN             THERMO_SCK_PIN | ||||||
|  | 
 | ||||||
|  | //check if all pins are defined in mega/pins_arduino.h
 | ||||||
|  | #include <Arduino.h> | ||||||
|  | static_assert(NUM_DIGITAL_PINS > MAX_PIN, "add missing pins to [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h based on fastio.h" | ||||||
|  |                                           "to digital_pin_to_port_PGM, digital_pin_to_bit_mask_PGM, digital_pin_to_timer_PGM, NUM_DIGITAL_PINS, see below"); | ||||||
|  | 
 | ||||||
|  | /* in [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h
 | ||||||
|  | change: | ||||||
|  | #define NUM_DIGITAL_PINS            70 | ||||||
|  | to: | ||||||
|  | #define NUM_DIGITAL_PINS            80 | ||||||
|  | 
 | ||||||
|  | to digital_pin_to_port_PGM add at the end: | ||||||
|  | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||||||
|  | .... | ||||||
|  |         PG      , // PG 4 ** 70 **
 | ||||||
|  |         PG      , // PG 3 ** 71 **
 | ||||||
|  |         PJ      , // PJ 2 ** 72 **
 | ||||||
|  |         PJ      , // PJ 3 ** 73 **
 | ||||||
|  |         PJ      , // PJ 7 ** 74 **
 | ||||||
|  |         PJ      , // PJ 4 ** 75 **
 | ||||||
|  |         PJ      , // PJ 5 ** 76 **
 | ||||||
|  |         PJ      , // PJ 6 ** 77 **
 | ||||||
|  |         PE      , // PE 2 ** 78 **
 | ||||||
|  |         PE      , // PE 6 ** 79 **
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | to digital_pin_to_bit_mask_PGM  add at the end: | ||||||
|  | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||||||
|  | .... | ||||||
|  |         _BV( 4 )        , // PG 4 ** 70 **
 | ||||||
|  |         _BV( 3 )        , // PG 3 ** 71 **
 | ||||||
|  |         _BV( 2 )        , // PJ 2 ** 72 **
 | ||||||
|  |         _BV( 3 )        , // PJ 3 ** 73 **
 | ||||||
|  |         _BV( 7 )        , // PJ 7 ** 74 **
 | ||||||
|  |         _BV( 4 )        , // PJ 4 ** 75 **
 | ||||||
|  |         _BV( 5 )        , // PJ 5 ** 76 **
 | ||||||
|  |         _BV( 6 )        , // PJ 6 ** 77 **
 | ||||||
|  |         _BV( 2 )        , // PE 2 ** 78 **
 | ||||||
|  |         _BV( 6 )        , // PE 6 ** 79 **
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | to digital_pin_to_timer_PGM add at the end: | ||||||
|  | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||||||
|  | .... | ||||||
|  |         NOT_ON_TIMER    , // PG 4 ** 70 **
 | ||||||
|  |         NOT_ON_TIMER    , // PG 3 ** 71 **
 | ||||||
|  |         NOT_ON_TIMER    , // PJ 2 ** 72 **
 | ||||||
|  |         NOT_ON_TIMER    , // PJ 3 ** 73 **
 | ||||||
|  |         NOT_ON_TIMER    , // PJ 7 ** 74 **
 | ||||||
|  |         NOT_ON_TIMER    , // PJ 4 ** 75 **
 | ||||||
|  |         NOT_ON_TIMER    , // PJ 5 ** 76 **
 | ||||||
|  |         NOT_ON_TIMER    , // PJ 6 ** 77 **
 | ||||||
|  |         NOT_ON_TIMER    , // PE 2 ** 78 **
 | ||||||
|  |         NOT_ON_TIMER    , // PE 6 ** 79 **
 | ||||||
|  | }; | ||||||
|  | */ | ||||||
|  | |||||||
							
								
								
									
										770
									
								
								Marlin/softspi.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										770
									
								
								Marlin/softspi.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,770 @@ | |||||||
|  | //https://github.com/niteris/ArduinoSoftSpi
 | ||||||
|  | 
 | ||||||
|  | #include <Arduino.h> | ||||||
|  | #ifdef __arm__ | ||||||
|  | #ifdef CORE_TEENSY | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** read pin value
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @return value read | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | bool fastDigitalRead(uint8_t pin) { | ||||||
|  |   return *portInputRegister(pin); | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** Set pin value
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @param[in] level value to write | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastDigitalWrite(uint8_t pin, bool value) { | ||||||
|  | 	if (value) { | ||||||
|  | 		*portSetRegister(pin) = 1; | ||||||
|  | 	} else { | ||||||
|  | 		*portClearRegister(pin) = 1; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | #else  // CORE_TEENSY
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** read pin value
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @return value read | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | bool fastDigitalRead(uint8_t pin){ | ||||||
|  |   return g_APinDescription[pin].pPort->PIO_PDSR & g_APinDescription[pin].ulPin; | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** Set pin value
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @param[in] level value to write | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastDigitalWrite(uint8_t pin, bool value){ | ||||||
|  |   if(value) { | ||||||
|  |     g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin; | ||||||
|  |   } else { | ||||||
|  |     g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | #endif  // CORE_TEENSY
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | inline void fastDigitalToggle(uint8_t pin) { | ||||||
|  |  fastDigitalWrite(pin, !fastDigitalRead(pin)); | ||||||
|  |  } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | inline void fastPinMode(uint8_t pin, bool mode) {pinMode(pin, mode);} | ||||||
|  | #else  // __arm__
 | ||||||
|  | #include <avr/io.h> | ||||||
|  | #include <util/atomic.h> | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /**
 | ||||||
|  |  * @class pin_map_t | ||||||
|  |  * @brief struct for mapping digital pins | ||||||
|  |  */ | ||||||
|  | struct pin_map_t { | ||||||
|  |   volatile uint8_t* ddr;   /**< address of DDR for this pin */ | ||||||
|  |   volatile uint8_t* pin;   /**< address of PIN for this pin */ | ||||||
|  |   volatile uint8_t* port;  /**< address of PORT for this pin */ | ||||||
|  |   uint8_t bit;             /**< bit number for this pin */ | ||||||
|  | }; | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #if defined(__AVR_ATmega168__)\ | ||||||
|  | ||defined(__AVR_ATmega168P__)\ | ||||||
|  | ||defined(__AVR_ATmega328P__) | ||||||
|  | // 168 and 328 Arduinos
 | ||||||
|  | const static pin_map_t pinMap[] = { | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  0
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  1
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2  2
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3  3
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4  4
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 5},  // D5  5
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6  6
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7  7
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0  8
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1  9
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2 10
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3 11
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4 12
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5 13
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 0},  // C0 14
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 1},  // C1 15
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 2},  // C2 16
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 3},  // C3 17
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 4},  // C4 18
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 5}   // C5 19
 | ||||||
|  | }; | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #elif defined(__AVR_ATmega1280__)\ | ||||||
|  | || defined(__AVR_ATmega2560__) | ||||||
|  | // Mega
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRE, &PINE, &PORTE, 0},  // E0  0
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 1},  // E1  1
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 4},  // E4  2
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 5},  // E5  3
 | ||||||
|  |   {&DDRG, &PING, &PORTG, 5},  // G5  4
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 3},  // E3  5
 | ||||||
|  |   {&DDRH, &PINH, &PORTH, 3},  // H3  6
 | ||||||
|  |   {&DDRH, &PINH, &PORTH, 4},  // H4  7
 | ||||||
|  |   {&DDRH, &PINH, &PORTH, 5},  // H5  8
 | ||||||
|  |   {&DDRH, &PINH, &PORTH, 6},  // H6  9
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4 10
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5 11
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6 12
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7 13
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 1},  // J1 14
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 0},  // J0 15
 | ||||||
|  |   {&DDRH, &PINH, &PORTH, 1},  // H1 16
 | ||||||
|  |   {&DDRH, &PINH, &PORTH, 0},  // H0 17
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3 18
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2 19
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1 20
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0 21
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 0},  // A0 22
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 1},  // A1 23
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 2},  // A2 24
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 3},  // A3 25
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 4},  // A4 26
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 5},  // A5 27
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 6},  // A6 28
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 7},  // A7 29
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 30
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6 31
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 5},  // C5 32
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 4},  // C4 33
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 3},  // C3 34
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 2},  // C2 35
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 1},  // C1 36
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 0},  // C0 37
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7 38
 | ||||||
|  |   {&DDRG, &PING, &PORTG, 2},  // G2 39
 | ||||||
|  |   {&DDRG, &PING, &PORTG, 1},  // G1 40
 | ||||||
|  |   {&DDRG, &PING, &PORTG, 0},  // G0 41
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 7},  // L7 42
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 6},  // L6 43
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 5},  // L5 44
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 4},  // L4 45
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 3},  // L3 46
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 2},  // L2 47
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 1},  // L1 48
 | ||||||
|  |   {&DDRL, &PINL, &PORTL, 0},  // L0 49
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3 50
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2 51
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1 52
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0 53
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 0},  // F0 54
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 1},  // F1 55
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 2},  // F2 56
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 3},  // F3 57
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 4},  // F4 58
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 5},  // F5 59
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 6},  // F6 60
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 7},  // F7 61
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 0},  // K0 62
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 1},  // K1 63
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 2},  // K2 64
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 3},  // K3 65
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 4},  // K4 66
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 5},  // K5 67
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 6},  // K6 68
 | ||||||
|  |   {&DDRK, &PINK, &PORTK, 7},  // K7 69
 | ||||||
|  | 
 | ||||||
|  | //pins_MIGHTYBOARD_REVE.h
 | ||||||
|  |   {&DDRG, &PING, &PORTG, 4},  // G4 70
 | ||||||
|  |   {&DDRG, &PING, &PORTG, 3},  // G3 71
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 2},  // J2 72
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 3},  // J3 73
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 7},  // J7 74
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 4},  // J4 75
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 5},  // J5 76
 | ||||||
|  |   {&DDRJ, &PINJ, &PORTJ, 6},  // J6 77
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 2},  // E2 78
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 6}   // E6 79
 | ||||||
|  | 
 | ||||||
|  | }; | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #elif defined(__AVR_ATmega1284P__)\ | ||||||
|  | || defined(__AVR_ATmega1284__)\ | ||||||
|  | || defined(__AVR_ATmega644P__)\ | ||||||
|  | || defined(__AVR_ATmega644__)\ | ||||||
|  | || defined(__AVR_ATmega64__)\ | ||||||
|  | || defined(__AVR_ATmega32__)\ | ||||||
|  | || defined(__AVR_ATmega324__)\ | ||||||
|  | || defined(__AVR_ATmega16__) | ||||||
|  | 
 | ||||||
|  | #ifdef defined(VARIANT_MIGHTY) | ||||||
|  | // Mighty Layout
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0  0
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1  1
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2  2
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3  3
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4  4
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5  5
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6  6
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7  7
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  8
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  9
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2 10
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3 11
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4 12
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 5},  // D5 13
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6 14
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7 15
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 0},  // C0 16
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 1},  // C1 17
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 2},  // C2 18
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 3},  // C3 19
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 4},  // C4 20
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 5},  // C5 21
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6 22
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 23
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 0},  // A0 24
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 1},  // A1 25
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 2},  // A2 26
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 3},  // A3 27
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 4},  // A4 28
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 5},  // A5 29
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 6},  // A6 30
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 7}   // A7 31
 | ||||||
|  | }; | ||||||
|  | #elif defined(VARIANT_BOBUINO) | ||||||
|  | // Bobuino Layout
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  0
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  1
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2  2
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3  3
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0  4
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1  5
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2  6
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3  7
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 5},  // D5  8
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6  9
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4 10
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5 11
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6 12
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7 13
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 7},  // A7 14
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 6},  // A6 15
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 5},  // A5 16
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 4},  // A4 17
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 3},  // A3 18
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 2},  // A2 19
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 1},  // A1 20
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 0},  // A0 21
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 0},  // C0 22
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 1},  // C1 23
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 2},  // C2 24
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 3},  // C3 25
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 4},  // C4 26
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 5},  // C5 27
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6 28
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 29
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4 30
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7}   // D7 31
 | ||||||
|  | }; | ||||||
|  | #elif defined(VARIANT_STANDARD) | ||||||
|  | // Standard Layout
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0  0
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1  1
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2  2
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3  3
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4  4
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5  5
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6  6
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7  7
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  8
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  9
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2 10
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3 11
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4 12
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 5},  // D5 13
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6 14
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7 15
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 0},  // C0 16
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 1},  // C1 17
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 2},  // C2 18
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 3},  // C3 19
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 4},  // C4 20
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 5},  // C5 21
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6 22
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 23
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 7},  // A7 24
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 6},  // A6 25
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 5},  // A5 26
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 4},  // A4 27
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 3},  // A3 28
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 2},  // A2 29
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 1},  // A1 30
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 0}   // A0 31
 | ||||||
|  | }; | ||||||
|  | #else  // VARIANT_MIGHTY
 | ||||||
|  | #error Undefined variant 1284, 644, 324, 64, 32 | ||||||
|  | #endif  // VARIANT_MIGHTY
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #elif defined(__AVR_ATmega32U4__) | ||||||
|  | #ifdef CORE_TEENSY | ||||||
|  | // Teensy 2.0
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0  0
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1  1
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2  2
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3  3
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7  4
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  5
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  6
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2  7
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3  8
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6  9
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 10
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6 11
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7 12
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4 13
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5 14
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6 15
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 7},  // F7 16
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 6},  // F6 17
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 5},  // F5 18
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 4},  // F4 19
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 1},  // F1 20
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 0},  // F0 21
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4 22
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 5},  // D5 23
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 6}   // E6 24
 | ||||||
|  | }; | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #else  // CORE_TEENSY
 | ||||||
|  | // Leonardo
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2  0
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3  1
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  2
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  3
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4  4
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6  5
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7  6
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 6},  // E6  7
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4  8
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5  9
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6 10
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7 11
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6 12
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 13
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3 14
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1 15
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2 16
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0 17
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 7},  // F7 18
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 6},  // F6 19
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 5},  // F5 20
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 4},  // F4 21
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 1},  // F1 22
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 0},  // F0 23
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4 24
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7 25
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4 26
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5 27
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6 28
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6}   // D6 29
 | ||||||
|  | }; | ||||||
|  | #endif  // CORE_TEENSY
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #elif defined(__AVR_AT90USB646__)\ | ||||||
|  | || defined(__AVR_AT90USB1286__) | ||||||
|  | // Teensy++ 1.0 & 2.0
 | ||||||
|  | static const pin_map_t pinMap[] = { | ||||||
|  |   {&DDRD, &PIND, &PORTD, 0},  // D0  0
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 1},  // D1  1
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 2},  // D2  2
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 3},  // D3  3
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 4},  // D4  4
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 5},  // D5  5
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 6},  // D6  6
 | ||||||
|  |   {&DDRD, &PIND, &PORTD, 7},  // D7  7
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 0},  // E0  8
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 1},  // E1  9
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 0},  // C0 10
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 1},  // C1 11
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 2},  // C2 12
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 3},  // C3 13
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 4},  // C4 14
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 5},  // C5 15
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 6},  // C6 16
 | ||||||
|  |   {&DDRC, &PINC, &PORTC, 7},  // C7 17
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 6},  // E6 18
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 7},  // E7 19
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 0},  // B0 20
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 1},  // B1 21
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 2},  // B2 22
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 3},  // B3 23
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 4},  // B4 24
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 5},  // B5 25
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 6},  // B6 26
 | ||||||
|  |   {&DDRB, &PINB, &PORTB, 7},  // B7 27
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 0},  // A0 28
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 1},  // A1 29
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 2},  // A2 30
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 3},  // A3 31
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 4},  // A4 32
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 5},  // A5 33
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 6},  // A6 34
 | ||||||
|  |   {&DDRA, &PINA, &PORTA, 7},  // A7 35
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 4},  // E4 36
 | ||||||
|  |   {&DDRE, &PINE, &PORTE, 5},  // E5 37
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 0},  // F0 38
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 1},  // F1 39
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 2},  // F2 40
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 3},  // F3 41
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 4},  // F4 42
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 5},  // F5 43
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 6},  // F6 44
 | ||||||
|  |   {&DDRF, &PINF, &PORTF, 7}   // F7 45
 | ||||||
|  | }; | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | #else  // CPU type
 | ||||||
|  | #error unknown CPU type | ||||||
|  | #endif  // CPU type
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** count of pins */ | ||||||
|  | static const uint8_t digitalPinCount = sizeof(pinMap)/sizeof(pin_map_t); | ||||||
|  | //==============================================================================
 | ||||||
|  | /** generate bad pin number error */ | ||||||
|  | void badPinNumber(void) | ||||||
|  |   __attribute__((error("Pin number is too large or not a constant"))); | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** Check for valid pin number
 | ||||||
|  |  * @param[in] pin Number of pin to be checked. | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void badPinCheck(uint8_t pin) { | ||||||
|  |   if (!__builtin_constant_p(pin) || pin >= digitalPinCount) { | ||||||
|  |      badPinNumber(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** fast write helper
 | ||||||
|  |  * @param[in] address I/O register address | ||||||
|  |  * @param[in] bit bit number to write | ||||||
|  |  * @param[in] level value for bit | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) { | ||||||
|  |   uint8_t oldSREG; | ||||||
|  |   if (address > (uint8_t*)0X5F) { | ||||||
|  |     oldSREG = SREG; | ||||||
|  |     cli(); | ||||||
|  |   } | ||||||
|  |   if (level) { | ||||||
|  |     *address |= 1 << bit; | ||||||
|  |   } else { | ||||||
|  |     *address &= ~(1 << bit); | ||||||
|  |   } | ||||||
|  |   if (address > (uint8_t*)0X5F) { | ||||||
|  |     SREG = oldSREG; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** read pin value
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @return value read | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | bool fastDigitalRead(uint8_t pin) { | ||||||
|  |   badPinCheck(pin); | ||||||
|  |   return (*pinMap[pin].pin >> pinMap[pin].bit) & 1; | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** toggle a pin
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * | ||||||
|  |  * If the pin is in output mode toggle the pin level. | ||||||
|  |  * If the pin is in input mode toggle the state of the 20K pullup. | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastDigitalToggle(uint8_t pin) { | ||||||
|  |   badPinCheck(pin); | ||||||
|  |     if (pinMap[pin].pin > (uint8_t*)0X5F) { | ||||||
|  |       // must write bit to high address port
 | ||||||
|  |       *pinMap[pin].pin = 1 << pinMap[pin].bit; | ||||||
|  |     } else { | ||||||
|  |       // will compile to sbi and PIN register will not be read.
 | ||||||
|  |       *pinMap[pin].pin |= 1 << pinMap[pin].bit; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** Set pin value
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @param[in] level value to write | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastDigitalWrite(uint8_t pin, bool level) { | ||||||
|  |   badPinCheck(pin); | ||||||
|  |   fastBitWriteSafe(pinMap[pin].port, pinMap[pin].bit, level); | ||||||
|  | } | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** set pin mode
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @param[in] mode if true set output mode else input mode | ||||||
|  |  * | ||||||
|  |  * fastPinMode does not enable or disable the 20K pullup for input mode. | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastPinMode(uint8_t pin, bool mode) { | ||||||
|  |   badPinCheck(pin); | ||||||
|  |   fastBitWriteSafe(pinMap[pin].ddr, pinMap[pin].bit, mode); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif  // __arm__
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** set pin configuration
 | ||||||
|  |  * @param[in] pin Arduino pin number | ||||||
|  |  * @param[in] mode If true set output mode else input mode | ||||||
|  |  * @param[in] level If mode is output, set level high/low. | ||||||
|  |  *                  If mode is input, enable or disable the pin's 20K pullup. | ||||||
|  |  */ | ||||||
|  | static inline __attribute__((always_inline)) | ||||||
|  | void fastPinConfig(uint8_t pin, bool mode, bool level) { | ||||||
|  |   fastPinMode(pin, mode); | ||||||
|  |   fastDigitalWrite(pin, level); | ||||||
|  | } | ||||||
|  | //==============================================================================
 | ||||||
|  | /**
 | ||||||
|  |  * @class DigitalPin | ||||||
|  |  * @brief Fast digital port I/O | ||||||
|  |  */ | ||||||
|  | template<uint8_t PinNumber> | ||||||
|  | class DigitalPin { | ||||||
|  |  public: | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Constructor */ | ||||||
|  |   DigitalPin() {} | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Constructor
 | ||||||
|  |    * @param[in] pinMode if true set output mode else input mode. | ||||||
|  |    */ | ||||||
|  |   explicit DigitalPin(bool pinMode) { | ||||||
|  |     mode(pinMode); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Constructor
 | ||||||
|  |    * @param[in] mode If true set output mode else input mode | ||||||
|  |    * @param[in] level If mode is output, set level high/low. | ||||||
|  |    *                  If mode is input, enable or disable the pin's 20K pullup. | ||||||
|  |    */ | ||||||
|  |   DigitalPin(bool mode, bool level) { | ||||||
|  |     config(mode, level); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Asignment operator
 | ||||||
|  |    * @param[in] value If true set the pin's level high else set the | ||||||
|  |    *  pin's level low. | ||||||
|  |    * | ||||||
|  |    * @return This DigitalPin instance. | ||||||
|  |    */ | ||||||
|  |   inline DigitalPin & operator = (bool value) __attribute__((always_inline)) { | ||||||
|  |     write(value); | ||||||
|  |     return *this; | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Parenthesis operator
 | ||||||
|  |    * @return Pin's level | ||||||
|  |    */ | ||||||
|  | 	inline operator bool () const __attribute__((always_inline)) { | ||||||
|  |     return read(); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** set pin configuration
 | ||||||
|  |    * @param[in] mode If true set output mode else input mode | ||||||
|  |    * @param[in] level If mode is output, set level high/low. | ||||||
|  |    *                  If mode is input, enable or disable the pin's 20K pullup. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void config(bool mode, bool level) { | ||||||
|  |     fastPinConfig(PinNumber, mode, level); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /**
 | ||||||
|  |    * Set pin level high if output mode or enable 20K pullup if input mode. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void high() {write(true);} | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /**
 | ||||||
|  |    * Set pin level low if output mode or disable 20K pullup if input mode. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void low() {write(false);} | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /**
 | ||||||
|  |    * Set pin mode | ||||||
|  |    * @param[in] pinMode if true set output mode else input mode. | ||||||
|  |    * | ||||||
|  |    * mode() does not enable or disable the 20K pullup for input mode. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void mode(bool pinMode) { | ||||||
|  |     fastPinMode(PinNumber, pinMode); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** @return Pin's level */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   bool read() const { | ||||||
|  |     return fastDigitalRead(PinNumber); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** toggle a pin
 | ||||||
|  |    * | ||||||
|  |    * If the pin is in output mode toggle the pin's level. | ||||||
|  |    * If the pin is in input mode toggle the state of the 20K pullup. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void toggle() { | ||||||
|  |     fastDigitalToggle(PinNumber); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Write the pin's level.
 | ||||||
|  |    * @param[in] value If true set the pin's level high else set the | ||||||
|  |    *  pin's level low. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void write(bool value) { | ||||||
|  |     fastDigitalWrite(PinNumber, value); | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** Nop for timing. */ | ||||||
|  | #define nop asm volatile ("nop\n\t") | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /** Pin Mode for MISO is input.*/ | ||||||
|  | const bool MISO_MODE  = false; | ||||||
|  | /** Pullups disabled for MISO are disabled. */ | ||||||
|  | const bool MISO_LEVEL = false; | ||||||
|  | /** Pin Mode for MOSI is output.*/ | ||||||
|  | const bool MOSI_MODE  = true; | ||||||
|  | /** Pin Mode for SCK is output. */ | ||||||
|  | const bool SCK_MODE   = true; | ||||||
|  | //------------------------------------------------------------------------------
 | ||||||
|  | /**
 | ||||||
|  |  * @class SoftSPI | ||||||
|  |  * @brief Fast software SPI. | ||||||
|  |  */ | ||||||
|  | template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin, uint8_t Mode = 0> | ||||||
|  | class SoftSPI { | ||||||
|  |  public: | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Initialize SoftSPI pins. */ | ||||||
|  |   void begin() { | ||||||
|  |     fastPinConfig(MisoPin, MISO_MODE, MISO_LEVEL); | ||||||
|  |     fastPinConfig(MosiPin, MOSI_MODE, !MODE_CPHA(Mode)); | ||||||
|  |     fastPinConfig(SckPin, SCK_MODE, MODE_CPOL(Mode)); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Soft SPI receive byte.
 | ||||||
|  |    * @return Data byte received. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   uint8_t receive() { | ||||||
|  |     uint8_t data = 0; | ||||||
|  |     receiveBit(7, &data); | ||||||
|  |     receiveBit(6, &data); | ||||||
|  |     receiveBit(5, &data); | ||||||
|  |     receiveBit(4, &data); | ||||||
|  |     receiveBit(3, &data); | ||||||
|  |     receiveBit(2, &data); | ||||||
|  |     receiveBit(1, &data); | ||||||
|  |     receiveBit(0, &data); | ||||||
|  |     return data; | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Soft SPI send byte.
 | ||||||
|  |    * @param[in] data Data byte to send. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void send(uint8_t data) { | ||||||
|  |     sendBit(7, data); | ||||||
|  |     sendBit(6, data); | ||||||
|  |     sendBit(5, data); | ||||||
|  |     sendBit(4, data); | ||||||
|  |     sendBit(3, data); | ||||||
|  |     sendBit(2, data); | ||||||
|  |     sendBit(1, data); | ||||||
|  |     sendBit(0, data); | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   /** Soft SPI transfer byte.
 | ||||||
|  |    * @param[in] txData Data byte to send. | ||||||
|  |    * @return Data byte received. | ||||||
|  |    */ | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   uint8_t transfer(uint8_t txData) { | ||||||
|  |     uint8_t rxData = 0; | ||||||
|  |     transferBit(7, &rxData, txData); | ||||||
|  |     transferBit(6, &rxData, txData); | ||||||
|  |     transferBit(5, &rxData, txData); | ||||||
|  |     transferBit(4, &rxData, txData); | ||||||
|  |     transferBit(3, &rxData, txData); | ||||||
|  |     transferBit(2, &rxData, txData); | ||||||
|  |     transferBit(1, &rxData, txData); | ||||||
|  |     transferBit(0, &rxData, txData); | ||||||
|  |     return rxData; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |  private: | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   bool MODE_CPHA(uint8_t mode) {return (mode & 1) != 0;} | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   bool MODE_CPOL(uint8_t mode) {return (mode & 2) != 0;} | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void receiveBit(uint8_t bit, uint8_t* data) { | ||||||
|  |     if (MODE_CPHA(Mode)) { | ||||||
|  |       fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); | ||||||
|  |     } | ||||||
|  |     nop; | ||||||
|  |     nop; | ||||||
|  |     fastDigitalWrite(SckPin, | ||||||
|  |       MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); | ||||||
|  |     if (fastDigitalRead(MisoPin)) *data |= 1 << bit; | ||||||
|  |     if (!MODE_CPHA(Mode)) { | ||||||
|  |       fastDigitalWrite(SckPin, MODE_CPOL(Mode)); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void sendBit(uint8_t bit, uint8_t data) { | ||||||
|  |     if (MODE_CPHA(Mode)) { | ||||||
|  |       fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); | ||||||
|  |     } | ||||||
|  |     fastDigitalWrite(MosiPin, data & (1 << bit)); | ||||||
|  |     fastDigitalWrite(SckPin, | ||||||
|  |       MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); | ||||||
|  |     nop; | ||||||
|  |     nop; | ||||||
|  |     if (!MODE_CPHA(Mode)) { | ||||||
|  |       fastDigitalWrite(SckPin, MODE_CPOL(Mode)); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  |   inline __attribute__((always_inline)) | ||||||
|  |   void transferBit(uint8_t bit, uint8_t* rxData, uint8_t txData) { | ||||||
|  |     if (MODE_CPHA(Mode)) { | ||||||
|  |       fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); | ||||||
|  |     } | ||||||
|  |     fastDigitalWrite(MosiPin, txData & (1 << bit)); | ||||||
|  |     fastDigitalWrite(SckPin, | ||||||
|  |       MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); | ||||||
|  |     if (fastDigitalRead(MisoPin)) *rxData |= 1 << bit; | ||||||
|  |     if (!MODE_CPHA(Mode)) { | ||||||
|  |       fastDigitalWrite(SckPin, MODE_CPOL(Mode)); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   //----------------------------------------------------------------------------
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
							
								
								
									
										68
									
								
								Marlin/spi.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								Marlin/spi.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,68 @@ | |||||||
|  | /**
 | ||||||
|  |  * Marlin 3D Printer Firmware | ||||||
|  |  * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 | ||||||
|  |  * | ||||||
|  |  * Based on Sprinter and grbl. | ||||||
|  |  * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm | ||||||
|  |  * | ||||||
|  |  * This program 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. | ||||||
|  |  * | ||||||
|  |  * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef __SPI_H__ | ||||||
|  | #define __SPI_H__ | ||||||
|  | 
 | ||||||
|  | #include <stdint.h> | ||||||
|  | #include "softspi.h" | ||||||
|  | 
 | ||||||
|  | template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin> | ||||||
|  | class Spi { | ||||||
|  |   static SoftSPI<MisoPin, MosiPin, SckPin> softSpi; | ||||||
|  |   public: | ||||||
|  |     inline __attribute__((always_inline)) | ||||||
|  |     static void init() { | ||||||
|  |         softSpi.begin(); | ||||||
|  |     } | ||||||
|  |     inline __attribute__((always_inline)) | ||||||
|  |     static void send(uint8_t data) { | ||||||
|  |         softSpi.send(data); | ||||||
|  |     } | ||||||
|  |     inline __attribute__((always_inline)) | ||||||
|  |     static uint8_t receive() { | ||||||
|  |         return softSpi.receive(); | ||||||
|  |     } | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //hardware spi
 | ||||||
|  | template<> | ||||||
|  | class Spi<MISO_PIN, MOSI_PIN, SCK_PIN> { | ||||||
|  |   public: | ||||||
|  |     inline __attribute__((always_inline)) | ||||||
|  |     static void init() { | ||||||
|  |         OUT_WRITE(SCK_PIN, LOW); | ||||||
|  |         OUT_WRITE(MOSI_PIN, HIGH); | ||||||
|  |         SET_INPUT(MISO_PIN); | ||||||
|  |         WRITE(MISO_PIN, HIGH); | ||||||
|  |     } | ||||||
|  |     inline __attribute__((always_inline)) | ||||||
|  |     static uint8_t receive() { | ||||||
|  |       SPDR = 0; | ||||||
|  |       for (;!TEST(SPSR, SPIF);); | ||||||
|  |       return SPDR; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
| @ -31,6 +31,7 @@ | |||||||
| #include "temperature.h" | #include "temperature.h" | ||||||
| #include "thermistortables.h" | #include "thermistortables.h" | ||||||
| #include "language.h" | #include "language.h" | ||||||
|  | #include "spi.h" | ||||||
| #if ENABLED(BABYSTEPPING) | #if ENABLED(BABYSTEPPING) | ||||||
|   #include "stepper.h" |   #include "stepper.h" | ||||||
| #endif | #endif | ||||||
| @ -942,6 +943,15 @@ void Temperature::updateTemperaturesFromRawValues() { | |||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if ENABLED(HEATER_0_USES_MAX6675) | ||||||
|  |   #ifndef MAX6675_SCK_PIN | ||||||
|  |     #define MAX6675_SCK_PIN SCK_PIN | ||||||
|  |   #endif | ||||||
|  |   #ifndef MAX6675_DO_PIN | ||||||
|  |     #define MAX6675_DO_PIN MISO_PIN | ||||||
|  |   #endif | ||||||
|  |   Spi<MAX6675_DO_PIN, MOSI_PIN, MAX6675_SCK_PIN> max6675_spi; | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Initialize the temperature manager |  * Initialize the temperature manager | ||||||
| @ -1007,11 +1017,13 @@ void Temperature::init() { | |||||||
|     OUT_WRITE(SCK_PIN, LOW); |     OUT_WRITE(SCK_PIN, LOW); | ||||||
|     OUT_WRITE(MOSI_PIN, HIGH); |     OUT_WRITE(MOSI_PIN, HIGH); | ||||||
|     SET_INPUT_PULLUP(MISO_PIN); |     SET_INPUT_PULLUP(MISO_PIN); | ||||||
|     OUT_WRITE(SS_PIN, HIGH); |  | ||||||
| 
 | 
 | ||||||
|  |     max6675_spi.init(); | ||||||
|  | 
 | ||||||
|  |     OUT_WRITE(SS_PIN, HIGH); | ||||||
|     OUT_WRITE(MAX6675_SS, HIGH); |     OUT_WRITE(MAX6675_SS, HIGH); | ||||||
| 
 | 
 | ||||||
|   #endif //HEATER_0_USES_MAX6675
 |   #endif // HEATER_0_USES_MAX6675
 | ||||||
| 
 | 
 | ||||||
|   #ifdef DIDR2 |   #ifdef DIDR2 | ||||||
|     #define ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin - 8); }while(0) |     #define ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin - 8); }while(0) | ||||||
| @ -1356,9 +1368,7 @@ void Temperature::disable_all_heaters() { | |||||||
|     // Read a big-endian temperature value
 |     // Read a big-endian temperature value
 | ||||||
|     max6675_temp = 0; |     max6675_temp = 0; | ||||||
|     for (uint8_t i = sizeof(max6675_temp); i--;) { |     for (uint8_t i = sizeof(max6675_temp); i--;) { | ||||||
|       SPDR = 0; |       max6675_temp |= max6675_spi.receive(); | ||||||
|       for (;!TEST(SPSR, SPIF);); |  | ||||||
|       max6675_temp |= SPDR; |  | ||||||
|       if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
 |       if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1564,9 +1564,9 @@ void kill_screen(const char* lcd_msg) { | |||||||
|      */ |      */ | ||||||
|     void _lcd_level_bed_homing() { |     void _lcd_level_bed_homing() { | ||||||
|       if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL); |       if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL); | ||||||
|       lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; |  | ||||||
|       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) |       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) | ||||||
|         lcd_goto_screen(_lcd_level_bed_homing_done); |         lcd_goto_screen(_lcd_level_bed_homing_done); | ||||||
|  |       lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /**
 |     /**
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user