Merge branch 'bugfix-2.0.x' into bugfix2.0.xautoreport
This commit is contained in:
commit
c4f4e209b1
786 changed files with 51857 additions and 16841 deletions
1
.github/workflows/test-builds.yml
vendored
1
.github/workflows/test-builds.yml
vendored
|
|
@ -41,6 +41,7 @@ jobs:
|
||||||
- mega2560
|
- mega2560
|
||||||
- teensy31
|
- teensy31
|
||||||
- teensy35
|
- teensy35
|
||||||
|
- teensy41
|
||||||
- SAMD51_grandcentral_m4
|
- SAMD51_grandcentral_m4
|
||||||
|
|
||||||
# Extended AVR Environments
|
# Extended AVR Environments
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,8 @@
|
||||||
* - Extra features
|
* - Extra features
|
||||||
*
|
*
|
||||||
* Advanced settings can be found in Configuration_adv.h
|
* Advanced settings can be found in Configuration_adv.h
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#define CONFIGURATION_H_VERSION 020006
|
#define CONFIGURATION_H_VERSION 020007
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================= Getting Started =============================
|
//============================= Getting Started =============================
|
||||||
|
|
@ -390,6 +389,7 @@
|
||||||
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v excitation (STM32 \ LPC176x....)
|
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v excitation (STM32 \ LPC176x....)
|
||||||
* 22 : 100k (hotend) with 4.7k pullup to 3.3V and 220R to analog input (as in GTM32 Pro vB)
|
* 22 : 100k (hotend) with 4.7k pullup to 3.3V and 220R to analog input (as in GTM32 Pro vB)
|
||||||
* 23 : 100k (bed) with 4.7k pullup to 3.3v and 220R to analog input (as in GTM32 Pro vB)
|
* 23 : 100k (bed) with 4.7k pullup to 3.3v and 220R to analog input (as in GTM32 Pro vB)
|
||||||
|
* 30 : Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K / B3950 (4.7k pullup)
|
||||||
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
|
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
|
||||||
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
||||||
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
|
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
|
||||||
|
|
@ -487,23 +487,17 @@
|
||||||
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
|
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
|
||||||
// Set/get with gcode: M301 E[extruder number, 0-2]
|
// Set/get with gcode: M301 E[extruder number, 0-2]
|
||||||
|
|
||||||
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
|
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
||||||
|
// Specify between 1 and HOTENDS values per array.
|
||||||
// Ultimaker
|
// If fewer than EXTRUDER values are provided, the last element will be repeated.
|
||||||
#define DEFAULT_Kp 22.2
|
#define DEFAULT_Kp_LIST { 22.20, 22.20 }
|
||||||
|
#define DEFAULT_Ki_LIST { 1.08, 1.08 }
|
||||||
|
#define DEFAULT_Kd_LIST { 114.00, 114.00 }
|
||||||
|
#else
|
||||||
|
#define DEFAULT_Kp 22.20
|
||||||
#define DEFAULT_Ki 1.08
|
#define DEFAULT_Ki 1.08
|
||||||
#define DEFAULT_Kd 114
|
#define DEFAULT_Kd 114.00
|
||||||
|
#endif
|
||||||
// MakerGear
|
|
||||||
//#define DEFAULT_Kp 7.0
|
|
||||||
//#define DEFAULT_Ki 0.1
|
|
||||||
//#define DEFAULT_Kd 12
|
|
||||||
|
|
||||||
// Mendel Parts V9 on 12V
|
|
||||||
//#define DEFAULT_Kp 63.0
|
|
||||||
//#define DEFAULT_Ki 2.25
|
|
||||||
//#define DEFAULT_Kd 440
|
|
||||||
|
|
||||||
#endif // PIDTEMP
|
#endif // PIDTEMP
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
@ -539,18 +533,12 @@
|
||||||
//#define MIN_BED_POWER 0
|
//#define MIN_BED_POWER 0
|
||||||
//#define PID_BED_DEBUG // Sends debug data to the serial port.
|
//#define PID_BED_DEBUG // Sends debug data to the serial port.
|
||||||
|
|
||||||
//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||||
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
||||||
#define DEFAULT_bedKp 10.00
|
#define DEFAULT_bedKp 10.00
|
||||||
#define DEFAULT_bedKi .023
|
#define DEFAULT_bedKi .023
|
||||||
#define DEFAULT_bedKd 305.4
|
#define DEFAULT_bedKd 305.4
|
||||||
|
|
||||||
//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
|
||||||
//from pidautotune
|
|
||||||
//#define DEFAULT_bedKp 97.1
|
|
||||||
//#define DEFAULT_bedKi 1.41
|
|
||||||
//#define DEFAULT_bedKd 1675.16
|
|
||||||
|
|
||||||
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
|
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
|
||||||
#endif // PIDTEMPBED
|
#endif // PIDTEMPBED
|
||||||
|
|
||||||
|
|
@ -867,7 +855,6 @@
|
||||||
* - For simple switches connect...
|
* - For simple switches connect...
|
||||||
* - normally-closed switches to GND and D32.
|
* - normally-closed switches to GND and D32.
|
||||||
* - normally-open switches to 5V and D32.
|
* - normally-open switches to 5V and D32.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default
|
//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default
|
||||||
|
|
||||||
|
|
@ -1581,7 +1568,6 @@
|
||||||
*
|
*
|
||||||
* Caveats: The ending Z should be the same as starting Z.
|
* Caveats: The ending Z should be the same as starting Z.
|
||||||
* Attention: EXPERIMENTAL. G-code arguments may change.
|
* Attention: EXPERIMENTAL. G-code arguments may change.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
//#define NOZZLE_CLEAN_FEATURE
|
//#define NOZZLE_CLEAN_FEATURE
|
||||||
|
|
||||||
|
|
@ -1734,7 +1720,6 @@
|
||||||
*
|
*
|
||||||
* SD Card support is disabled by default. If your controller has an SD slot,
|
* SD Card support is disabled by default. If your controller has an SD slot,
|
||||||
* you must uncomment the following option or it won't work.
|
* you must uncomment the following option or it won't work.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
//#define SDSUPPORT
|
//#define SDSUPPORT
|
||||||
|
|
||||||
|
|
@ -1971,6 +1956,14 @@
|
||||||
//
|
//
|
||||||
//#define FF_INTERFACEBOARD
|
//#define FF_INTERFACEBOARD
|
||||||
|
|
||||||
|
//
|
||||||
|
// TFT GLCD Panel with Marlin UI
|
||||||
|
// Panel connected to main board by SPI or I2C interface.
|
||||||
|
// See https://github.com/Serhiy-K/TFTGLCDAdapter
|
||||||
|
//
|
||||||
|
//#define TFTGLCD_PANEL_SPI
|
||||||
|
//#define TFTGLCD_PANEL_I2C
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//======================= LCD / Controller Selection =======================
|
//======================= LCD / Controller Selection =======================
|
||||||
//========================= (Graphical LCDs) ========================
|
//========================= (Graphical LCDs) ========================
|
||||||
|
|
@ -2174,6 +2167,9 @@
|
||||||
// Touch-screen LCD for Malyan M200/M300 printers
|
// Touch-screen LCD for Malyan M200/M300 printers
|
||||||
//
|
//
|
||||||
//#define MALYAN_LCD
|
//#define MALYAN_LCD
|
||||||
|
#if ENABLED(MALYAN_LCD)
|
||||||
|
#define LCD_SERIAL_PORT 1 // Default is 1 for Malyan M200
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Touch UI for FTDI EVE (FT800/FT810) displays
|
// Touch UI for FTDI EVE (FT800/FT810) displays
|
||||||
|
|
@ -2187,7 +2183,7 @@
|
||||||
//#define ANYCUBIC_LCD_I3MEGA
|
//#define ANYCUBIC_LCD_I3MEGA
|
||||||
//#define ANYCUBIC_LCD_CHIRON
|
//#define ANYCUBIC_LCD_CHIRON
|
||||||
#if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
|
#if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
|
||||||
#define ANYCUBIC_LCD_SERIAL_PORT 3
|
#define LCD_SERIAL_PORT 3 // Default is 3 for Anycubic
|
||||||
//#define ANYCUBIC_LCD_DEBUG
|
//#define ANYCUBIC_LCD_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -2311,9 +2307,6 @@
|
||||||
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
|
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
|
||||||
//#define TEMP_STAT_LEDS
|
//#define TEMP_STAT_LEDS
|
||||||
|
|
||||||
// SkeinForge sends the wrong arc G-codes when using Arc Point as fillet procedure
|
|
||||||
//#define SF_ARC_FIX
|
|
||||||
|
|
||||||
// Support for the BariCUDA Paste Extruder
|
// Support for the BariCUDA Paste Extruder
|
||||||
//#define BARICUDA
|
//#define BARICUDA
|
||||||
|
|
||||||
|
|
@ -2346,7 +2339,6 @@
|
||||||
* *** CAUTION ***
|
* *** CAUTION ***
|
||||||
*
|
*
|
||||||
* LED Type. Enable only one of the following two options.
|
* LED Type. Enable only one of the following two options.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
//#define RGB_LED
|
//#define RGB_LED
|
||||||
//#define RGBW_LED
|
//#define RGBW_LED
|
||||||
|
|
@ -2400,17 +2392,12 @@
|
||||||
#define PRINTER_EVENT_LEDS
|
#define PRINTER_EVENT_LEDS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* R/C SERVO support
|
|
||||||
* Sponsored by TrinityLabs, Reworked by codexmas
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of servos
|
* Number of servos
|
||||||
*
|
*
|
||||||
* For some servo-related options NUM_SERVOS will be set automatically.
|
* For some servo-related options NUM_SERVOS will be set automatically.
|
||||||
* Set this manually if there are extra servos needing manual control.
|
* Set this manually if there are extra servos needing manual control.
|
||||||
* Leave undefined or set to 0 to entirely disable the servo subsystem.
|
* Set to 0 to turn off servo support.
|
||||||
*/
|
*/
|
||||||
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
|
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
|
||||||
|
|
||||||
|
|
@ -2422,5 +2409,5 @@
|
||||||
// Only power servos during movement, otherwise leave off to prevent jitter
|
// Only power servos during movement, otherwise leave off to prevent jitter
|
||||||
//#define DEACTIVATE_SERVOS_AFTER_MOVE
|
//#define DEACTIVATE_SERVOS_AFTER_MOVE
|
||||||
|
|
||||||
// Allow servo angle to be edited and saved to EEPROM
|
// Edit servo angles with M281 and save to EEPROM with M500
|
||||||
//#define EDITABLE_SERVO_ANGLES
|
//#define EDITABLE_SERVO_ANGLES
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,13 @@
|
||||||
* Some of these settings can damage your printer if improperly set!
|
* Some of these settings can damage your printer if improperly set!
|
||||||
*
|
*
|
||||||
* Basic settings can be found in Configuration.h
|
* Basic settings can be found in Configuration.h
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#define CONFIGURATION_ADV_H_VERSION 020006
|
#define CONFIGURATION_ADV_H_VERSION 020007
|
||||||
|
|
||||||
// @section temperature
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================= Thermal Settings ============================
|
//============================= Thermal Settings ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
// @section temperature
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thermocouple sensors are quite sensitive to noise. Any noise induced in
|
* Thermocouple sensors are quite sensitive to noise. Any noise induced in
|
||||||
|
|
@ -126,9 +124,19 @@
|
||||||
#define HEATER_BED_INVERTING true
|
#define HEATER_BED_INVERTING true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
//
|
||||||
* Heated Chamber settings
|
// Heated Bed Bang-Bang options
|
||||||
*/
|
//
|
||||||
|
#if DISABLED(PIDTEMPBED)
|
||||||
|
#define BED_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control
|
||||||
|
#if ENABLED(BED_LIMIT_SWITCHING)
|
||||||
|
#define BED_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > BED_HYSTERESIS
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Heated Chamber options
|
||||||
|
//
|
||||||
#if TEMP_SENSOR_CHAMBER
|
#if TEMP_SENSOR_CHAMBER
|
||||||
#define CHAMBER_MINTEMP 5
|
#define CHAMBER_MINTEMP 5
|
||||||
#define CHAMBER_MAXTEMP 60
|
#define CHAMBER_MAXTEMP 60
|
||||||
|
|
@ -136,12 +144,28 @@
|
||||||
//#define CHAMBER_LIMIT_SWITCHING
|
//#define CHAMBER_LIMIT_SWITCHING
|
||||||
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
|
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
|
||||||
//#define HEATER_CHAMBER_INVERTING false
|
//#define HEATER_CHAMBER_INVERTING false
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DISABLED(PIDTEMPBED)
|
//#define CHAMBER_FAN // Enable a fan on the chamber
|
||||||
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
|
#if ENABLED(CHAMBER_FAN)
|
||||||
#if ENABLED(BED_LIMIT_SWITCHING)
|
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve.
|
||||||
#define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
|
#if CHAMBER_FAN_MODE == 0
|
||||||
|
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
|
||||||
|
#elif CHAMBER_FAN_MODE == 1
|
||||||
|
#define CHAMBER_FAN_BASE 128 // Base chamber fan PWM (0-255); turns on when chamber temperature is above the target
|
||||||
|
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C above target
|
||||||
|
#elif CHAMBER_FAN_MODE == 2
|
||||||
|
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
|
||||||
|
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define CHAMBER_VENT // Enable a servo-controlled vent on the chamber
|
||||||
|
#if ENABLED(CHAMBER_VENT)
|
||||||
|
#define CHAMBER_VENT_SERVO_NR 1 // Index of the vent servo
|
||||||
|
#define HIGH_EXCESS_HEAT_LIMIT 5 // How much above target temp to consider there is excess heat in the chamber
|
||||||
|
#define LOW_EXCESS_HEAT_LIMIT 3
|
||||||
|
#define MIN_COOLING_SLOPE_TIME_CHAMBER_VENT 20
|
||||||
|
#define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -738,7 +762,6 @@
|
||||||
* | 4 3 | 1 4 | 2 1 | 3 2 |
|
* | 4 3 | 1 4 | 2 1 | 3 2 |
|
||||||
* | | | | |
|
* | | | | |
|
||||||
* | 1 2 | 2 3 | 3 4 | 4 1 |
|
* | 1 2 | 2 3 | 3 4 | 4 1 |
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#ifndef Z_STEPPER_ALIGN_XY
|
#ifndef Z_STEPPER_ALIGN_XY
|
||||||
//#define Z_STEPPERS_ORIENTATION 0
|
//#define Z_STEPPERS_ORIENTATION 0
|
||||||
|
|
@ -786,6 +809,9 @@
|
||||||
// Enable to restore leveling setup after operation
|
// Enable to restore leveling setup after operation
|
||||||
#define RESTORE_LEVELING_AFTER_G35
|
#define RESTORE_LEVELING_AFTER_G35
|
||||||
|
|
||||||
|
// Add a menu item for Assisted Tramming
|
||||||
|
//#define ASSISTED_TRAMMING_MENU_ITEM
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screw thread:
|
* Screw thread:
|
||||||
* M3: 30 = Clockwise, 31 = Counter-Clockwise
|
* M3: 30 = Clockwise, 31 = Counter-Clockwise
|
||||||
|
|
@ -1049,6 +1075,14 @@
|
||||||
|
|
||||||
#if HAS_LCD_MENU
|
#if HAS_LCD_MENU
|
||||||
|
|
||||||
|
// Add Probe Z Offset calibration to the Z Probe Offsets menu
|
||||||
|
#if HAS_BED_PROBE
|
||||||
|
//#define PROBE_OFFSET_WIZARD
|
||||||
|
#if ENABLED(PROBE_OFFSET_WIZARD)
|
||||||
|
#define PROBE_OFFSET_START -4.0 // Estimated nozzle-to-probe Z offset, plus a little extra
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Include a page of printer information in the LCD Main Menu
|
// Include a page of printer information in the LCD Main Menu
|
||||||
//#define LCD_INFO_MENU
|
//#define LCD_INFO_MENU
|
||||||
#if ENABLED(LCD_INFO_MENU)
|
#if ENABLED(LCD_INFO_MENU)
|
||||||
|
|
@ -1105,16 +1139,18 @@
|
||||||
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
|
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
|
||||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
|
||||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
||||||
#if ENABLED(SHOW_REMAINING_TIME)
|
#if ENABLED(SHOW_REMAINING_TIME)
|
||||||
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
|
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
|
||||||
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
|
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
|
||||||
//#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
|
//#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
|
||||||
#if ENABLED(LCD_PROGRESS_BAR)
|
#if ENABLED(LCD_PROGRESS_BAR)
|
||||||
#define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar
|
#define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar
|
||||||
|
|
@ -1123,6 +1159,7 @@
|
||||||
//#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it
|
//#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it
|
||||||
//#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar
|
//#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
|
|
@ -1164,6 +1201,7 @@
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
|
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
|
||||||
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
|
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
|
||||||
|
//#define POWER_LOSS_RECOVER_ZHOME // Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
|
||||||
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
|
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
|
||||||
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
|
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
|
||||||
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
||||||
|
|
@ -1324,7 +1362,7 @@
|
||||||
* controller events, as there is a trade-off between reliable
|
* controller events, as there is a trade-off between reliable
|
||||||
* printing performance versus fast display updates.
|
* printing performance versus fast display updates.
|
||||||
*/
|
*/
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
// Show SD percentage next to the progress bar
|
// Show SD percentage next to the progress bar
|
||||||
//#define DOGM_SD_PERCENT
|
//#define DOGM_SD_PERCENT
|
||||||
|
|
||||||
|
|
@ -1339,7 +1377,7 @@
|
||||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||||
//#define USE_BIG_EDIT_FONT
|
//#define USE_BIG_EDIT_FONT
|
||||||
|
|
||||||
// A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM.
|
// A smaller font may be used on the Info Screen. Costs 2434 bytes of PROGMEM.
|
||||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||||
//#define USE_SMALL_INFOFONT
|
//#define USE_SMALL_INFOFONT
|
||||||
|
|
||||||
|
|
@ -1394,18 +1432,18 @@
|
||||||
//#define MARLIN_SNAKE
|
//#define MARLIN_SNAKE
|
||||||
//#define GAMES_EASTER_EGG // Add extra blank lines above the "Games" sub-menu
|
//#define GAMES_EASTER_EGG // Add extra blank lines above the "Games" sub-menu
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
//
|
//
|
||||||
// Additional options for DGUS / DWIN displays
|
// Additional options for DGUS / DWIN displays
|
||||||
//
|
//
|
||||||
#if HAS_DGUS_LCD
|
#if HAS_DGUS_LCD
|
||||||
#define DGUS_SERIAL_PORT 3
|
#define LCD_SERIAL_PORT 3
|
||||||
#define DGUS_BAUDRATE 115200
|
#define LCD_BAUDRATE 115200
|
||||||
|
|
||||||
#define DGUS_RX_BUFFER_SIZE 128
|
#define DGUS_RX_BUFFER_SIZE 128
|
||||||
#define DGUS_TX_BUFFER_SIZE 48
|
#define DGUS_TX_BUFFER_SIZE 48
|
||||||
//#define DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS // Fix Rx overrun situation (Currently only for AVR)
|
//#define SERIAL_STATS_RX_BUFFER_OVERRUNS // Fix Rx overrun situation (Currently only for AVR)
|
||||||
|
|
||||||
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
|
#define DGUS_UPDATE_INTERVAL_MS 500 // (ms) Interval between automatic screen updates
|
||||||
|
|
||||||
|
|
@ -1572,6 +1610,7 @@
|
||||||
#if ENABLED(BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
|
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
|
||||||
//#define BABYSTEP_WITHOUT_HOMING
|
//#define BABYSTEP_WITHOUT_HOMING
|
||||||
|
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
|
||||||
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
|
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
|
||||||
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
|
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
|
||||||
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
|
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
|
||||||
|
|
@ -1582,7 +1621,6 @@
|
||||||
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
|
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
|
||||||
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
|
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
|
||||||
// Note: Extra time may be added to mitigate controller latency.
|
// Note: Extra time may be added to mitigate controller latency.
|
||||||
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
|
|
||||||
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
|
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
|
||||||
#if ENABLED(MOVE_Z_WHEN_IDLE)
|
#if ENABLED(MOVE_Z_WHEN_IDLE)
|
||||||
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.
|
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.
|
||||||
|
|
@ -1765,6 +1803,7 @@
|
||||||
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
||||||
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
|
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
|
||||||
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
|
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
|
||||||
|
//#define SF_ARC_FIX // Enable only if using SkeinForge with "Arc Point" fillet procedure
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
|
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
|
||||||
|
|
@ -1950,7 +1989,6 @@
|
||||||
* Be sure to turn off auto-retract during filament change.
|
* Be sure to turn off auto-retract during filament change.
|
||||||
*
|
*
|
||||||
* Note that M207 / M208 / M209 settings are saved to EEPROM.
|
* Note that M207 / M208 / M209 settings are saved to EEPROM.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
//#define FWRETRACT
|
//#define FWRETRACT
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
|
|
@ -1976,7 +2014,7 @@
|
||||||
* Universal tool change settings.
|
* Universal tool change settings.
|
||||||
* Applies to all types of extruders except where explicitly noted.
|
* Applies to all types of extruders except where explicitly noted.
|
||||||
*/
|
*/
|
||||||
#if EXTRUDERS > 1
|
#if HAS_MULTI_EXTRUDER
|
||||||
// Z raise distance for tool-change, as needed for some extruders
|
// Z raise distance for tool-change, as needed for some extruders
|
||||||
#define TOOLCHANGE_ZRAISE 2 // (mm)
|
#define TOOLCHANGE_ZRAISE 2 // (mm)
|
||||||
//#define TOOLCHANGE_ZRAISE_BEFORE_RETRACT // Apply raise before swap retraction (if enabled)
|
//#define TOOLCHANGE_ZRAISE_BEFORE_RETRACT // Apply raise before swap retraction (if enabled)
|
||||||
|
|
@ -2040,7 +2078,7 @@
|
||||||
//#define TOOLCHANGE_PARK_X_ONLY // X axis only move
|
//#define TOOLCHANGE_PARK_X_ONLY // X axis only move
|
||||||
//#define TOOLCHANGE_PARK_Y_ONLY // Y axis only move
|
//#define TOOLCHANGE_PARK_Y_ONLY // Y axis only move
|
||||||
#endif
|
#endif
|
||||||
#endif // EXTRUDERS > 1
|
#endif // HAS_MULTI_EXTRUDER
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advanced Pause
|
* Advanced Pause
|
||||||
|
|
@ -3229,6 +3267,7 @@
|
||||||
//#define HOST_ACTION_COMMANDS
|
//#define HOST_ACTION_COMMANDS
|
||||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||||
//#define HOST_PROMPT_SUPPORT
|
//#define HOST_PROMPT_SUPPORT
|
||||||
|
//#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3336,6 +3375,7 @@
|
||||||
#define JOY_X_LIMITS { 5600, 8190-100, 8190+100, 10800 } // min, deadzone start, deadzone end, max
|
#define JOY_X_LIMITS { 5600, 8190-100, 8190+100, 10800 } // min, deadzone start, deadzone end, max
|
||||||
#define JOY_Y_LIMITS { 5600, 8250-100, 8250+100, 11000 }
|
#define JOY_Y_LIMITS { 5600, 8250-100, 8250+100, 11000 }
|
||||||
#define JOY_Z_LIMITS { 4800, 8080-100, 8080+100, 11550 }
|
#define JOY_Z_LIMITS { 4800, 8080-100, 8080+100, 11550 }
|
||||||
|
//#define JOYSTICK_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3413,10 +3453,10 @@
|
||||||
#if ENABLED(PRUSA_MMU2)
|
#if ENABLED(PRUSA_MMU2)
|
||||||
|
|
||||||
// Serial port used for communication with MMU2.
|
// Serial port used for communication with MMU2.
|
||||||
// For AVR enable the UART port used for the MMU. (e.g., internalSerial)
|
// For AVR enable the UART port used for the MMU. (e.g., mmuSerial)
|
||||||
// For 32-bit boards check your HAL for available serial ports. (e.g., Serial2)
|
// For 32-bit boards check your HAL for available serial ports. (e.g., Serial2)
|
||||||
#define INTERNAL_SERIAL_PORT 2
|
#define MMU2_SERIAL_PORT 2
|
||||||
#define MMU2_SERIAL internalSerial
|
#define MMU2_SERIAL mmuSerial
|
||||||
|
|
||||||
// Use hardware reset for MMU if a pin is defined for it
|
// Use hardware reset for MMU if a pin is defined for it
|
||||||
//#define MMU2_RST_PIN 23
|
//#define MMU2_RST_PIN 23
|
||||||
|
|
@ -3467,7 +3507,7 @@
|
||||||
*/
|
*/
|
||||||
//#define MMU_EXTRUDER_SENSOR
|
//#define MMU_EXTRUDER_SENSOR
|
||||||
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
||||||
#define MMU_LOADING_ATTEMPTS_NR 5 //max. number of attempts to load filament if first load fail
|
#define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3519,6 +3559,11 @@
|
||||||
//
|
//
|
||||||
//#define M100_FREE_MEMORY_WATCHER
|
//#define M100_FREE_MEMORY_WATCHER
|
||||||
|
|
||||||
|
//
|
||||||
|
// M42 - Set pin states
|
||||||
|
//
|
||||||
|
//#define DIRECT_PIN_CONTROL
|
||||||
|
|
||||||
//
|
//
|
||||||
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
|
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
|
||||||
//
|
//
|
||||||
|
|
|
||||||
159
Marlin/Makefile
159
Marlin/Makefile
|
|
@ -22,8 +22,10 @@
|
||||||
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
|
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
|
||||||
# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
|
# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
|
||||||
#
|
#
|
||||||
# 3. Set the line containing "MCU" to match your board's processor.
|
# 3. Set the line containing "MCU" to match your board's processor. Set
|
||||||
# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
# "PROG_MCU" as the AVR part name corresponding to "MCU". You can use the
|
||||||
|
# following command to get a list of correspondences: `avrdude -c alf -p x`
|
||||||
|
# Older boards are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
||||||
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
||||||
# change F_CPU to 8000000. If you are using Gen7 electronics, you
|
# change F_CPU to 8000000. If you are using Gen7 electronics, you
|
||||||
# probably need to use 20000000. Either way, you must regenerate
|
# probably need to use 20000000. Either way, you must regenerate
|
||||||
|
|
@ -34,18 +36,18 @@
|
||||||
# 5. Type "make upload", reset your Arduino board, and press enter to
|
# 5. Type "make upload", reset your Arduino board, and press enter to
|
||||||
# upload your program to the Arduino board.
|
# upload your program to the Arduino board.
|
||||||
#
|
#
|
||||||
# Note that all settings at the top of this file can be overriden from
|
# Note that all settings at the top of this file can be overridden from
|
||||||
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
|
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
|
||||||
#
|
#
|
||||||
# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
|
# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
|
||||||
#
|
#
|
||||||
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
||||||
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
|
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino
|
||||||
#
|
#
|
||||||
# To compile and upload simply add "upload" to the end of the line...
|
# To compile and upload simply add "upload" to the end of the line...
|
||||||
#
|
#
|
||||||
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
||||||
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
|
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload
|
||||||
#
|
#
|
||||||
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
|
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
|
||||||
# start upload manually (using stk500) like so:
|
# start upload manually (using stk500) like so:
|
||||||
|
|
@ -57,7 +59,26 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# This defines the board to compile for (see boards.h for your board's ID)
|
# This defines the board to compile for (see boards.h for your board's ID)
|
||||||
HARDWARE_MOTHERBOARD ?= 11
|
HARDWARE_MOTHERBOARD ?= 1020
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
# Windows
|
||||||
|
ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
|
||||||
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||||
|
else
|
||||||
|
UNAME_S := $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
# Linux
|
||||||
|
ARDUINO_INSTALL_DIR ?= /usr/share/arduino
|
||||||
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
# Darwin (macOS)
|
||||||
|
ARDUINO_INSTALL_DIR ?= /Applications/Arduino.app/Contents/Java
|
||||||
|
ARDUINO_USER_DIR ?= ${HOME}/Documents/Arduino
|
||||||
|
AVR_TOOLS_PATH ?= /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Arduino source install directory, and version number
|
# Arduino source install directory, and version number
|
||||||
# On most linuxes this will be /usr/share/arduino
|
# On most linuxes this will be /usr/share/arduino
|
||||||
|
|
@ -67,32 +88,38 @@ ARDUINO_VERSION ?= 106
|
||||||
# The installed Libraries are in the User folder
|
# The installed Libraries are in the User folder
|
||||||
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||||
|
|
||||||
# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
|
# You can optionally set a path to the avr-gcc tools.
|
||||||
|
# Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
|
||||||
AVR_TOOLS_PATH ?=
|
AVR_TOOLS_PATH ?=
|
||||||
|
|
||||||
#Programmer configuration
|
# Programmer configuration
|
||||||
UPLOAD_RATE ?= 57600
|
UPLOAD_RATE ?= 57600
|
||||||
AVRDUDE_PROGRAMMER ?= arduino
|
AVRDUDE_PROGRAMMER ?= arduino
|
||||||
# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
# On most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
||||||
UPLOAD_PORT ?= /dev/ttyUSB0
|
UPLOAD_PORT ?= /dev/ttyUSB0
|
||||||
|
|
||||||
#Directory used to build files in, contains all the build files, from object files to the final hex file
|
# Directory used to build files in, contains all the build files, from object
|
||||||
#on linux it is best to put an absolute path like /home/username/tmp .
|
# files to the final hex file on linux it is best to put an absolute path
|
||||||
|
# like /home/username/tmp .
|
||||||
BUILD_DIR ?= applet
|
BUILD_DIR ?= applet
|
||||||
|
|
||||||
# This defines whether Liquid_TWI2 support will be built
|
# This defines whether Liquid_TWI2 support will be built
|
||||||
LIQUID_TWI2 ?= 0
|
LIQUID_TWI2 ?= 0
|
||||||
|
|
||||||
# this defines if Wire is needed
|
# This defines if Wire is needed
|
||||||
WIRE ?= 0
|
WIRE ?= 0
|
||||||
|
|
||||||
# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h)
|
||||||
U8GLIB ?= 1
|
# Disabling this (and SPEAKER) saves approximatively 350 bytes of memory.
|
||||||
|
TONE ?= 1
|
||||||
|
|
||||||
# this defines whether to include the Trinamic TMCStepper library
|
# This defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
||||||
TMC ?= 1
|
U8GLIB ?= 0
|
||||||
|
|
||||||
# this defines whether to include the AdaFruit NeoPixel library
|
# This defines whether to include the Trinamic TMCStepper library
|
||||||
|
TMC ?= 0
|
||||||
|
|
||||||
|
# This defines whether to include the AdaFruit NeoPixel library
|
||||||
NEOPIXEL ?= 0
|
NEOPIXEL ?= 0
|
||||||
|
|
||||||
############
|
############
|
||||||
|
|
@ -209,6 +236,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1120)
|
||||||
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1121)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1121)
|
||||||
MCU ?= atmega1280
|
MCU ?= atmega1280
|
||||||
|
PROG_MCU ?= m1280
|
||||||
|
|
||||||
# Azteeg X3
|
# Azteeg X3
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1122)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1122)
|
||||||
|
|
@ -350,9 +378,11 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1320)
|
||||||
# Minitronics v1.0/1.1
|
# Minitronics v1.0/1.1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1400)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1400)
|
||||||
MCU ?= atmega1281
|
MCU ?= atmega1281
|
||||||
|
PROG_MCU ?= m1281
|
||||||
# Silvergate v1.0
|
# Silvergate v1.0
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
||||||
MCU ?= atmega1281
|
MCU ?= atmega1281
|
||||||
|
PROG_MCU ?= m1281
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
||||||
|
|
@ -362,46 +392,57 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1500)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1500)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Sanguinololu 1.2 and above
|
# Sanguinololu 1.2 and above
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1501)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1501)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Melzi
|
# Melzi
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1502)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1502)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Melzi V2.0
|
# Melzi V2.0
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1503)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1503)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Melzi with ATmega1284 (MaKr3d version)
|
# Melzi with ATmega1284 (MaKr3d version)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1504)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1504)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Melzi Creality3D board (for CR-10 etc)
|
# Melzi Creality3D board (for CR-10 etc)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1505)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1505)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Melzi Malyan M150 board
|
# Melzi Malyan M150 board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1506)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1506)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Tronxy X5S
|
# Tronxy X5S
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1507)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1507)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# STB V1.1
|
# STB V1.1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1508)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1508)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Azteeg X1
|
# Azteeg X1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1509)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1509)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Anet 1.0 (Melzi clone)
|
# Anet 1.0 (Melzi clone)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
|
|
||||||
#
|
#
|
||||||
# Other ATmega644P, ATmega644, ATmega1284P
|
# Other ATmega644P, ATmega644, ATmega1284P
|
||||||
|
|
@ -411,50 +452,61 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1600)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1600)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen3+
|
# Gen3+
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1601)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1601)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen6
|
# Gen6
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1602)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1602)
|
||||||
HARDWARE_VARIANT ?= Gen6
|
HARDWARE_VARIANT ?= Gen6
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen6 deluxe
|
# Gen6 deluxe
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1603)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1603)
|
||||||
HARDWARE_VARIANT ?= Gen6
|
HARDWARE_VARIANT ?= Gen6
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen7 custom (Alfons3 Version)
|
# Gen7 custom (Alfons3 Version)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1604)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1604)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega644
|
MCU ?= atmega644
|
||||||
|
PROG_MCU ?= m644
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Gen7 v1.1, v1.2
|
# Gen7 v1.1, v1.2
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1605)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1605)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Gen7 v1.3
|
# Gen7 v1.3
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1606)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1606)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Gen7 v1.4
|
# Gen7 v1.4
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1607)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1607)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Alpha OMCA board
|
# Alpha OMCA board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1608)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1608)
|
||||||
HARDWARE_VARIANT ?= SanguinoA
|
HARDWARE_VARIANT ?= SanguinoA
|
||||||
MCU ?= atmega644
|
MCU ?= atmega644
|
||||||
|
PROG_MCU ?= m644
|
||||||
# Final OMCA board
|
# Final OMCA board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1609)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1609)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Sethi 3D_1
|
# Sethi 3D_1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
|
|
||||||
#
|
#
|
||||||
# Teensyduino - AT90USB1286, AT90USB1286P
|
# Teensyduino - AT90USB1286, AT90USB1286P
|
||||||
|
|
@ -464,51 +516,60 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1700)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1700)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Printrboard (AT90USB1286)
|
# Printrboard (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1701)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1701)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Printrboard Revision F (AT90USB1286)
|
# Printrboard Revision F (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1702)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1702)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Brainwave (AT90USB646)
|
# Brainwave (AT90USB646)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1703)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1703)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb646
|
MCU ?= at90usb646
|
||||||
|
PROG_MCU ?= usb646
|
||||||
# Brainwave Pro (AT90USB1286)
|
# Brainwave Pro (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1704)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1704)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# SAV Mk-I (AT90USB1286)
|
# SAV Mk-I (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1705)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1705)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Teensy++2.0 (AT90USB1286)
|
# Teensy++2.0 (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1706)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1706)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# 5DPrint D8 Driver Board
|
# 5DPrint D8 Driver Board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1707)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1707)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
|
|
||||||
# UltiMachine Archim1 (with DRV8825 drivers)
|
# UltiMachine Archim1 (with DRV8825 drivers)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),3023)
|
else ifeq ($(HARDWARE_MOTHERBOARD),3023)
|
||||||
HARDWARE_VARIANT ?= archim
|
HARDWARE_VARIANT ?= archim
|
||||||
MCPU = cortex-m3
|
MCPU = cortex-m3
|
||||||
F_CPU = 84000000L
|
F_CPU = 84000000
|
||||||
IS_MCU = 0
|
IS_MCU = 0
|
||||||
# UltiMachine Archim2 (with TMC2130 drivers)
|
# UltiMachine Archim2 (with TMC2130 drivers)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),3024)
|
else ifeq ($(HARDWARE_MOTHERBOARD),3024)
|
||||||
HARDWARE_VARIANT ?= archim
|
HARDWARE_VARIANT ?= archim
|
||||||
MCPU = cortex-m3
|
MCPU = cortex-m3
|
||||||
F_CPU = 84000000L
|
F_CPU = 84000000
|
||||||
IS_MCU = 0
|
IS_MCU = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
|
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
|
||||||
# if you are setting this to something other than 16MHz
|
# if you are setting this to something other than 16MHz
|
||||||
|
# Do not put the UL suffix, it's done later on.
|
||||||
# Set to 16Mhz if not yet set.
|
# Set to 16Mhz if not yet set.
|
||||||
F_CPU ?= 16000000
|
F_CPU ?= 16000000
|
||||||
|
|
||||||
|
|
@ -519,6 +580,7 @@ ifeq ($(IS_MCU),1)
|
||||||
# Set to arduino, ATmega2560 if not yet set.
|
# Set to arduino, ATmega2560 if not yet set.
|
||||||
HARDWARE_VARIANT ?= arduino
|
HARDWARE_VARIANT ?= arduino
|
||||||
MCU ?= atmega2560
|
MCU ?= atmega2560
|
||||||
|
PROG_MCU ?= m2560
|
||||||
|
|
||||||
TOOL_PREFIX = avr
|
TOOL_PREFIX = avr
|
||||||
MCU_FLAGS = -mmcu=$(MCU)
|
MCU_FLAGS = -mmcu=$(MCU)
|
||||||
|
|
@ -549,27 +611,36 @@ VPATH += $(BUILD_DIR)
|
||||||
VPATH += $(HARDWARE_SRC)
|
VPATH += $(HARDWARE_SRC)
|
||||||
|
|
||||||
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
|
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
|
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
||||||
|
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(IS_MCU),1)
|
ifeq ($(IS_MCU),1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
|
||||||
|
|
||||||
|
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
|
||||||
|
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
|
||||||
|
|
||||||
ifeq ($(LIQUID_TWI2), 1)
|
ifeq ($(LIQUID_TWI2), 1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
WIRE = 1
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(WIRE), 1)
|
ifeq ($(WIRE), 1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
# Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
|
||||||
|
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
|
||||||
endif
|
endif
|
||||||
ifeq ($(NEOPIXEL), 1)
|
ifeq ($(NEOPIXEL), 1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
|
||||||
|
|
@ -641,13 +712,23 @@ ifeq ($(WIRE), 1)
|
||||||
LIB_CXXSRC += Wire.cpp
|
LIB_CXXSRC += Wire.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TONE), 1)
|
||||||
|
LIB_CXXSRC += Tone.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(U8GLIB), 1)
|
ifeq ($(U8GLIB), 1)
|
||||||
LIB_CXXSRC += U8glib.cpp
|
LIB_CXXSRC += U8glib.cpp
|
||||||
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
|
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
|
||||||
|
u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
|
||||||
|
u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TMC), 1)
|
ifeq ($(TMC), 1)
|
||||||
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
|
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
|
||||||
|
CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
|
||||||
|
DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
|
||||||
|
SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
|
||||||
|
TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(RELOC_WORKAROUND), 1)
|
ifeq ($(RELOC_WORKAROUND), 1)
|
||||||
|
|
@ -689,7 +770,7 @@ REMOVE = rm -f
|
||||||
MV = mv -f
|
MV = mv -f
|
||||||
|
|
||||||
# Place -D or -U options here
|
# Place -D or -U options here
|
||||||
CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
|
CDEFS = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
|
||||||
CXXDEFS = $(CDEFS)
|
CXXDEFS = $(CDEFS)
|
||||||
|
|
||||||
ifeq ($(HARDWARE_VARIANT), Teensy)
|
ifeq ($(HARDWARE_VARIANT), Teensy)
|
||||||
|
|
@ -698,8 +779,14 @@ ifeq ($(HARDWARE_VARIANT), Teensy)
|
||||||
LIB_CXXSRC += usb_api.cpp
|
LIB_CXXSRC += usb_api.cpp
|
||||||
|
|
||||||
else ifeq ($(HARDWARE_VARIANT), archim)
|
else ifeq ($(HARDWARE_VARIANT), archim)
|
||||||
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
|
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
|
||||||
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
|
CDEFS += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON
|
||||||
|
CDEFS += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
|
||||||
|
|
||||||
|
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
|
||||||
|
UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
|
||||||
|
PluggableUSB.cpp USBCore.cpp
|
||||||
|
|
||||||
LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
|
LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
|
||||||
|
|
||||||
ifeq ($(U8GLIB), 1)
|
ifeq ($(U8GLIB), 1)
|
||||||
|
|
@ -725,16 +812,20 @@ CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
|
||||||
ifneq ($(HARDWARE_MOTHERBOARD),)
|
ifneq ($(HARDWARE_MOTHERBOARD),)
|
||||||
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
|
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
||||||
CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
|
CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
|
||||||
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
|
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
|
||||||
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
|
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
|
||||||
ASFLAGS := $(CDEFS)
|
ASFLAGS := $(CDEFS)
|
||||||
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||||
|
|
||||||
ifeq ($(HARDWARE_VARIANT), archim)
|
ifeq ($(HARDWARE_VARIANT), archim)
|
||||||
LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
|
LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
|
||||||
LD_SUFFIX = $(LDLIBS)
|
LD_SUFFIX = $(LDLIBS)
|
||||||
LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
|
||||||
|
LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
|
||||||
|
LDFLAGS += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
||||||
else
|
else
|
||||||
LD_PREFIX = -Wl,--gc-sections,--relax
|
LD_PREFIX = -Wl,--gc-sections,--relax
|
||||||
LDFLAGS = -lm
|
LDFLAGS = -lm
|
||||||
|
|
@ -750,7 +841,7 @@ else
|
||||||
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
||||||
endif
|
endif
|
||||||
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
|
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
|
||||||
-p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
-p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
||||||
-b$(UPLOAD_RATE)
|
-b$(UPLOAD_RATE)
|
||||||
|
|
||||||
# Since Marlin 2.0, the source files may be distributed into several
|
# Since Marlin 2.0, the source files may be distributed into several
|
||||||
|
|
@ -865,7 +956,7 @@ extcoff: $(TARGET).elf
|
||||||
|
|
||||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
|
||||||
$(Pecho) " CXX $@"
|
$(Pecho) " CXX $@"
|
||||||
$P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
$P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
||||||
|
|
||||||
# Object files that were found in "src" will be stored in $(BUILD_DIR)
|
# Object files that were found in "src" will be stored in $(BUILD_DIR)
|
||||||
# in directories that mirror the structure of "src"
|
# in directories that mirror the structure of "src"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
@ -81,54 +82,29 @@ typedef int8_t pin_t;
|
||||||
|
|
||||||
// Serial ports
|
// Serial ports
|
||||||
#ifdef USBCON
|
#ifdef USBCON
|
||||||
#if ENABLED(BLUETOOTH)
|
#define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
|
||||||
#define MYSERIAL0 bluetoothSerial
|
|
||||||
#else
|
|
||||||
#define MYSERIAL0 Serial
|
|
||||||
#endif
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#else
|
#else
|
||||||
#if !WITHIN(SERIAL_PORT, -1, 3)
|
#if !WITHIN(SERIAL_PORT, -1, 3)
|
||||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MYSERIAL0 customizedSerial1
|
#define MYSERIAL0 customizedSerial1
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
#if !WITHIN(SERIAL_PORT_2, -1, 3)
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#endif
|
#endif
|
||||||
#define MYSERIAL1 customizedSerial2
|
#define MYSERIAL1 customizedSerial2
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
|
#if !WITHIN(LCD_SERIAL_PORT, -1, 3)
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
|
||||||
#endif
|
#endif
|
||||||
#define DGUS_SERIAL internalDgusSerial
|
#define LCD_SERIAL lcdSerial
|
||||||
|
#if HAS_DGUS_LCD
|
||||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
|
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANYCUBIC_LCD_SERIAL_PORT
|
|
||||||
#if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
|
|
||||||
#error "ANYCUBIC_LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
|
||||||
#elif ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT
|
|
||||||
#error "ANYCUBIC_LCD_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif defined(SERIAL_PORT_2) && ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT_2
|
|
||||||
#error "ANYCUBIC_LCD_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
|
||||||
#endif
|
#endif
|
||||||
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
@ -144,6 +120,8 @@ void HAL_init();
|
||||||
inline void HAL_clear_reset_source() { MCUSR = 0; }
|
inline void HAL_clear_reset_source() { MCUSR = 0; }
|
||||||
inline uint8_t HAL_get_reset_source() { return MCUSR; }
|
inline uint8_t HAL_get_reset_source() { return MCUSR; }
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
||||||
|
|
@ -40,32 +40,32 @@
|
||||||
|
|
||||||
#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
|
#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
|
||||||
|
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
#include "../../MarlinCore.h"
|
#include "../../MarlinCore.h"
|
||||||
|
|
||||||
#if ENABLED(DIRECT_STEPPING)
|
#if ENABLED(DIRECT_STEPPING)
|
||||||
#include "../../feature/direct_stepping.h"
|
#include "../../feature/direct_stepping.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
|
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
|
||||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };
|
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };
|
||||||
template<typename Cfg> bool MarlinSerial<Cfg>::_written = false;
|
template<typename Cfg> bool MarlinSerial<Cfg>::_written = false;
|
||||||
template<typename Cfg> uint8_t MarlinSerial<Cfg>::xon_xoff_state = MarlinSerial<Cfg>::XON_XOFF_CHAR_SENT | MarlinSerial<Cfg>::XON_CHAR;
|
template<typename Cfg> uint8_t MarlinSerial<Cfg>::xon_xoff_state = MarlinSerial<Cfg>::XON_XOFF_CHAR_SENT | MarlinSerial<Cfg>::XON_CHAR;
|
||||||
template<typename Cfg> uint8_t MarlinSerial<Cfg>::rx_dropped_bytes = 0;
|
template<typename Cfg> uint8_t MarlinSerial<Cfg>::rx_dropped_bytes = 0;
|
||||||
template<typename Cfg> uint8_t MarlinSerial<Cfg>::rx_buffer_overruns = 0;
|
template<typename Cfg> uint8_t MarlinSerial<Cfg>::rx_buffer_overruns = 0;
|
||||||
template<typename Cfg> uint8_t MarlinSerial<Cfg>::rx_framing_errors = 0;
|
template<typename Cfg> uint8_t MarlinSerial<Cfg>::rx_framing_errors = 0;
|
||||||
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::rx_max_enqueued = 0;
|
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::rx_max_enqueued = 0;
|
||||||
|
|
||||||
// A SW memory barrier, to ensure GCC does not overoptimize loops
|
// A SW memory barrier, to ensure GCC does not overoptimize loops
|
||||||
#define sw_barrier() asm volatile("": : :"memory");
|
#define sw_barrier() asm volatile("": : :"memory");
|
||||||
|
|
||||||
#include "../../feature/e_parser.h"
|
#include "../../feature/e_parser.h"
|
||||||
|
|
||||||
// "Atomically" read the RX head index value without disabling interrupts:
|
// "Atomically" read the RX head index value without disabling interrupts:
|
||||||
// This MUST be called with RX interrupts enabled, and CAN'T be called
|
// This MUST be called with RX interrupts enabled, and CAN'T be called
|
||||||
// from the RX ISR itself!
|
// from the RX ISR itself!
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
FORCE_INLINE typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::atomic_read_rx_head() {
|
FORCE_INLINE typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::atomic_read_rx_head() {
|
||||||
if (Cfg::RX_SIZE > 256) {
|
if (Cfg::RX_SIZE > 256) {
|
||||||
// Keep reading until 2 consecutive reads return the same value,
|
// Keep reading until 2 consecutive reads return the same value,
|
||||||
// meaning there was no update in-between caused by an interrupt.
|
// meaning there was no update in-between caused by an interrupt.
|
||||||
|
|
@ -85,19 +85,19 @@
|
||||||
// With an 8bit index, reads are always atomic. No need for special handling
|
// With an 8bit index, reads are always atomic. No need for special handling
|
||||||
return rx_buffer.head;
|
return rx_buffer.head;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
volatile bool MarlinSerial<Cfg>::rx_tail_value_not_stable = false;
|
volatile bool MarlinSerial<Cfg>::rx_tail_value_not_stable = false;
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
volatile uint16_t MarlinSerial<Cfg>::rx_tail_value_backup = 0;
|
volatile uint16_t MarlinSerial<Cfg>::rx_tail_value_backup = 0;
|
||||||
|
|
||||||
// Set RX tail index, taking into account the RX ISR could interrupt
|
// Set RX tail index, taking into account the RX ISR could interrupt
|
||||||
// the write to this variable in the middle - So a backup strategy
|
// the write to this variable in the middle - So a backup strategy
|
||||||
// is used to ensure reads of the correct values.
|
// is used to ensure reads of the correct values.
|
||||||
// -Must NOT be called from the RX ISR -
|
// -Must NOT be called from the RX ISR -
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
FORCE_INLINE void MarlinSerial<Cfg>::atomic_set_rx_tail(typename MarlinSerial<Cfg>::ring_buffer_pos_t value) {
|
FORCE_INLINE void MarlinSerial<Cfg>::atomic_set_rx_tail(typename MarlinSerial<Cfg>::ring_buffer_pos_t value) {
|
||||||
if (Cfg::RX_SIZE > 256) {
|
if (Cfg::RX_SIZE > 256) {
|
||||||
// Store the new value in the backup
|
// Store the new value in the backup
|
||||||
rx_tail_value_backup = value;
|
rx_tail_value_backup = value;
|
||||||
|
|
@ -114,24 +114,24 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rx_buffer.tail = value;
|
rx_buffer.tail = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the RX tail index, taking into account the read could be
|
// Get the RX tail index, taking into account the read could be
|
||||||
// interrupting in the middle of the update of that index value
|
// interrupting in the middle of the update of that index value
|
||||||
// -Called from the RX ISR -
|
// -Called from the RX ISR -
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
FORCE_INLINE typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::atomic_read_rx_tail() {
|
FORCE_INLINE typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::atomic_read_rx_tail() {
|
||||||
if (Cfg::RX_SIZE > 256) {
|
if (Cfg::RX_SIZE > 256) {
|
||||||
// If the true index is being modified, return the backup value
|
// If the true index is being modified, return the backup value
|
||||||
if (rx_tail_value_not_stable) return rx_tail_value_backup;
|
if (rx_tail_value_not_stable) return rx_tail_value_backup;
|
||||||
}
|
}
|
||||||
// The true index is stable, return it
|
// The true index is stable, return it
|
||||||
return rx_buffer.tail;
|
return rx_buffer.tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (called with RX interrupts disabled)
|
// (called with RX interrupts disabled)
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
FORCE_INLINE void MarlinSerial<Cfg>::store_rxd_char() {
|
FORCE_INLINE void MarlinSerial<Cfg>::store_rxd_char() {
|
||||||
|
|
||||||
static EmergencyParser::State emergency_state; // = EP_RESET
|
static EmergencyParser::State emergency_state; // = EP_RESET
|
||||||
|
|
||||||
|
|
@ -275,11 +275,11 @@
|
||||||
|
|
||||||
// Store the new head value - The main loop will retry until the value is stable
|
// Store the new head value - The main loop will retry until the value is stable
|
||||||
rx_buffer.head = h;
|
rx_buffer.head = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (called with TX irqs disabled)
|
// (called with TX irqs disabled)
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
FORCE_INLINE void MarlinSerial<Cfg>::_tx_udr_empty_irq() {
|
FORCE_INLINE void MarlinSerial<Cfg>::_tx_udr_empty_irq() {
|
||||||
if (Cfg::TX_SIZE > 0) {
|
if (Cfg::TX_SIZE > 0) {
|
||||||
// Read positions
|
// Read positions
|
||||||
uint8_t t = tx_buffer.tail;
|
uint8_t t = tx_buffer.tail;
|
||||||
|
|
@ -328,11 +328,11 @@
|
||||||
// Disable interrupts if there is nothing to transmit following this byte
|
// Disable interrupts if there is nothing to transmit following this byte
|
||||||
if (h == t) B_UDRIE = 0; // (Non-atomic, could be reenabled by the main program, but eventually this will succeed)
|
if (h == t) B_UDRIE = 0; // (Non-atomic, could be reenabled by the main program, but eventually this will succeed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public Methods
|
// Public Methods
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::begin(const long baud) {
|
void MarlinSerial<Cfg>::begin(const long baud) {
|
||||||
uint16_t baud_setting;
|
uint16_t baud_setting;
|
||||||
bool useU2X = true;
|
bool useU2X = true;
|
||||||
|
|
||||||
|
|
@ -360,24 +360,24 @@
|
||||||
B_RXCIE = 1;
|
B_RXCIE = 1;
|
||||||
if (Cfg::TX_SIZE > 0) B_UDRIE = 0;
|
if (Cfg::TX_SIZE > 0) B_UDRIE = 0;
|
||||||
_written = false;
|
_written = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::end() {
|
void MarlinSerial<Cfg>::end() {
|
||||||
B_RXEN = 0;
|
B_RXEN = 0;
|
||||||
B_TXEN = 0;
|
B_TXEN = 0;
|
||||||
B_RXCIE = 0;
|
B_RXCIE = 0;
|
||||||
B_UDRIE = 0;
|
B_UDRIE = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
int MarlinSerial<Cfg>::peek() {
|
int MarlinSerial<Cfg>::peek() {
|
||||||
const ring_buffer_pos_t h = atomic_read_rx_head(), t = rx_buffer.tail;
|
const ring_buffer_pos_t h = atomic_read_rx_head(), t = rx_buffer.tail;
|
||||||
return h == t ? -1 : rx_buffer.buffer[t];
|
return h == t ? -1 : rx_buffer.buffer[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
int MarlinSerial<Cfg>::read() {
|
int MarlinSerial<Cfg>::read() {
|
||||||
const ring_buffer_pos_t h = atomic_read_rx_head();
|
const ring_buffer_pos_t h = atomic_read_rx_head();
|
||||||
|
|
||||||
// Read the tail. Main thread owns it, so it is safe to directly read it
|
// Read the tail. Main thread owns it, so it is safe to directly read it
|
||||||
|
|
@ -417,16 +417,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::available() {
|
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::available() {
|
||||||
const ring_buffer_pos_t h = atomic_read_rx_head(), t = rx_buffer.tail;
|
const ring_buffer_pos_t h = atomic_read_rx_head(), t = rx_buffer.tail;
|
||||||
return (ring_buffer_pos_t)(Cfg::RX_SIZE + h - t) & (Cfg::RX_SIZE - 1);
|
return (ring_buffer_pos_t)(Cfg::RX_SIZE + h - t) & (Cfg::RX_SIZE - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::flush() {
|
void MarlinSerial<Cfg>::flush() {
|
||||||
|
|
||||||
// Set the tail to the head:
|
// Set the tail to the head:
|
||||||
// - Read the RX head index in a safe way. (See atomic_read_rx_head.)
|
// - Read the RX head index in a safe way. (See atomic_read_rx_head.)
|
||||||
|
|
@ -451,10 +451,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::write(const uint8_t c) {
|
void MarlinSerial<Cfg>::write(const uint8_t c) {
|
||||||
if (Cfg::TX_SIZE == 0) {
|
if (Cfg::TX_SIZE == 0) {
|
||||||
|
|
||||||
_written = true;
|
_written = true;
|
||||||
|
|
@ -510,10 +510,10 @@
|
||||||
// Enable TX ISR - Non atomic, but it will eventually enable TX ISR
|
// Enable TX ISR - Non atomic, but it will eventually enable TX ISR
|
||||||
B_UDRIE = 1;
|
B_UDRIE = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::flushTX() {
|
void MarlinSerial<Cfg>::flushTX() {
|
||||||
|
|
||||||
if (Cfg::TX_SIZE == 0) {
|
if (Cfg::TX_SIZE == 0) {
|
||||||
// No bytes written, no need to flush. This special case is needed since there's
|
// No bytes written, no need to flush. This special case is needed since there's
|
||||||
|
|
@ -554,34 +554,34 @@
|
||||||
// At this point nothing is queued anymore (DRIE is disabled) and
|
// At this point nothing is queued anymore (DRIE is disabled) and
|
||||||
// the hardware finished transmission (TXC is set).
|
// the hardware finished transmission (TXC is set).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imports from print.h
|
* Imports from print.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(char c, int base) {
|
void MarlinSerial<Cfg>::print(char c, int base) {
|
||||||
print((long)c, base);
|
print((long)c, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(unsigned char b, int base) {
|
void MarlinSerial<Cfg>::print(unsigned char b, int base) {
|
||||||
print((unsigned long)b, base);
|
print((unsigned long)b, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(int n, int base) {
|
void MarlinSerial<Cfg>::print(int n, int base) {
|
||||||
print((long)n, base);
|
print((long)n, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(unsigned int n, int base) {
|
void MarlinSerial<Cfg>::print(unsigned int n, int base) {
|
||||||
print((unsigned long)n, base);
|
print((unsigned long)n, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(long n, int base) {
|
void MarlinSerial<Cfg>::print(long n, int base) {
|
||||||
if (base == 0) write(n);
|
if (base == 0) write(n);
|
||||||
else if (base == 10) {
|
else if (base == 10) {
|
||||||
if (n < 0) { print('-'); n = -n; }
|
if (n < 0) { print('-'); n = -n; }
|
||||||
|
|
@ -589,83 +589,83 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printNumber(n, base);
|
printNumber(n, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(unsigned long n, int base) {
|
void MarlinSerial<Cfg>::print(unsigned long n, int base) {
|
||||||
if (base == 0) write(n);
|
if (base == 0) write(n);
|
||||||
else printNumber(n, base);
|
else printNumber(n, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::print(double n, int digits) {
|
void MarlinSerial<Cfg>::print(double n, int digits) {
|
||||||
printFloat(n, digits);
|
printFloat(n, digits);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println() {
|
void MarlinSerial<Cfg>::println() {
|
||||||
print('\r');
|
print('\r');
|
||||||
print('\n');
|
print('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(const String& s) {
|
void MarlinSerial<Cfg>::println(const String& s) {
|
||||||
print(s);
|
print(s);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(const char c[]) {
|
void MarlinSerial<Cfg>::println(const char c[]) {
|
||||||
print(c);
|
print(c);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(char c, int base) {
|
void MarlinSerial<Cfg>::println(char c, int base) {
|
||||||
print(c, base);
|
print(c, base);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(unsigned char b, int base) {
|
void MarlinSerial<Cfg>::println(unsigned char b, int base) {
|
||||||
print(b, base);
|
print(b, base);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(int n, int base) {
|
void MarlinSerial<Cfg>::println(int n, int base) {
|
||||||
print(n, base);
|
print(n, base);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(unsigned int n, int base) {
|
void MarlinSerial<Cfg>::println(unsigned int n, int base) {
|
||||||
print(n, base);
|
print(n, base);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(long n, int base) {
|
void MarlinSerial<Cfg>::println(long n, int base) {
|
||||||
print(n, base);
|
print(n, base);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(unsigned long n, int base) {
|
void MarlinSerial<Cfg>::println(unsigned long n, int base) {
|
||||||
print(n, base);
|
print(n, base);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::println(double n, int digits) {
|
void MarlinSerial<Cfg>::println(double n, int digits) {
|
||||||
print(n, digits);
|
print(n, digits);
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private Methods
|
// Private Methods
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::printNumber(unsigned long n, uint8_t base) {
|
void MarlinSerial<Cfg>::printNumber(unsigned long n, uint8_t base) {
|
||||||
if (n) {
|
if (n) {
|
||||||
unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
|
unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
|
||||||
int8_t i = 0;
|
int8_t i = 0;
|
||||||
|
|
@ -678,10 +678,10 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print('0');
|
print('0');
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
void MarlinSerial<Cfg>::printFloat(double number, uint8_t digits) {
|
void MarlinSerial<Cfg>::printFloat(double number, uint8_t digits) {
|
||||||
// Handle negative numbers
|
// Handle negative numbers
|
||||||
if (number < 0.0) {
|
if (number < 0.0) {
|
||||||
print('-');
|
print('-');
|
||||||
|
|
@ -709,31 +709,31 @@
|
||||||
remainder -= toPrint;
|
remainder -= toPrint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hookup ISR handlers
|
// Hookup ISR handlers
|
||||||
ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)) {
|
ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _RX_vect)) {
|
||||||
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::store_rxd_char();
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::store_rxd_char();
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect)) {
|
ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
|
||||||
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::_tx_udr_empty_irq();
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preinstantiate
|
// Preinstantiate
|
||||||
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;
|
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;
|
||||||
|
|
||||||
// Instantiate
|
// Instantiate
|
||||||
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
|
|
||||||
// Hookup ISR handlers
|
// Hookup ISR handlers
|
||||||
ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_RX_vect)) {
|
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_2, _RX_vect)) {
|
||||||
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::store_rxd_char();
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::store_rxd_char();
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_UDRE_vect)) {
|
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_2, _UDRE_vect)) {
|
||||||
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::_tx_udr_empty_irq();
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -743,30 +743,43 @@
|
||||||
// Instantiate
|
// Instantiate
|
||||||
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
|
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
|
#ifdef MMU2_SERIAL_PORT
|
||||||
|
|
||||||
#ifdef INTERNAL_SERIAL_PORT
|
ISR(SERIAL_REGNAME(USART, MMU2_SERIAL_PORT, _RX_vect)) {
|
||||||
|
MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>>::store_rxd_char();
|
||||||
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) {
|
|
||||||
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::store_rxd_char();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) {
|
ISR(SERIAL_REGNAME(USART, MMU2_SERIAL_PORT, _UDRE_vect)) {
|
||||||
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
|
MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preinstantiate
|
// Preinstantiate
|
||||||
template class MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>;
|
template class MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>>;
|
||||||
|
|
||||||
// Instantiate
|
// Instantiate
|
||||||
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
|
MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>> mmuSerial;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
|
|
||||||
|
ISR(SERIAL_REGNAME(USART, LCD_SERIAL_PORT, _RX_vect)) {
|
||||||
|
MarlinSerial<LCDSerialCfg<LCD_SERIAL_PORT>>::store_rxd_char();
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(SERIAL_REGNAME(USART, LCD_SERIAL_PORT, _UDRE_vect)) {
|
||||||
|
MarlinSerial<LCDSerialCfg<LCD_SERIAL_PORT>>::_tx_udr_empty_irq();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preinstantiate
|
||||||
|
template class MarlinSerial<LCDSerialCfg<LCD_SERIAL_PORT>>;
|
||||||
|
|
||||||
|
// Instantiate
|
||||||
|
MarlinSerial<LCDSerialCfg<LCD_SERIAL_PORT>> lcdSerial;
|
||||||
|
|
||||||
|
#if HAS_DGUS_LCD
|
||||||
template<typename Cfg>
|
template<typename Cfg>
|
||||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||||
|
|
@ -775,40 +788,11 @@
|
||||||
if (ret < 0) ret += Cfg::TX_SIZE + 1;
|
if (ret < 0) ret += Cfg::TX_SIZE + 1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_RX_vect)) {
|
|
||||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_UDRE_vect)) {
|
|
||||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preinstantiate
|
|
||||||
template class MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>;
|
|
||||||
|
|
||||||
// Instantiate
|
|
||||||
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ANYCUBIC_LCD_SERIAL_PORT
|
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
|
||||||
|
|
||||||
ISR(SERIAL_REGNAME(USART,ANYCUBIC_LCD_SERIAL_PORT,_RX_vect)) {
|
|
||||||
MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::store_rxd_char();
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR(SERIAL_REGNAME(USART,ANYCUBIC_LCD_SERIAL_PORT,_UDRE_vect)) {
|
|
||||||
MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::_tx_udr_empty_irq();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preinstantiate
|
|
||||||
template class MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>;
|
|
||||||
|
|
||||||
// Instantiate
|
|
||||||
MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>> anycubicLcdSerial;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// For AT90USB targets use the UART for BT interfacing
|
// For AT90USB targets use the UART for BT interfacing
|
||||||
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
#if defined(USBCON) && ENABLED(BLUETOOTH)
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,11 @@
|
||||||
|
|
||||||
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
|
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
|
||||||
// requires two levels of indirection to expand macro values properly)
|
// requires two levels of indirection to expand macro values properly)
|
||||||
#define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
|
#define SERIAL_REGNAME(registerbase,number,suffix) _SERIAL_REGNAME(registerbase,number,suffix)
|
||||||
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
|
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
|
||||||
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
|
#define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##suffix
|
||||||
#else
|
#else
|
||||||
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
|
#define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##number##suffix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Registers used by MarlinSerial class (expanded depending on selected serial port)
|
// Registers used by MarlinSerial class (expanded depending on selected serial port)
|
||||||
|
|
@ -217,10 +217,12 @@
|
||||||
static ring_buffer_pos_t available();
|
static ring_buffer_pos_t available();
|
||||||
static void write(const uint8_t c);
|
static void write(const uint8_t c);
|
||||||
static void flushTX();
|
static void flushTX();
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#if HAS_DGUS_LCD
|
||||||
static ring_buffer_pos_t get_tx_buffer_free();
|
static ring_buffer_pos_t get_tx_buffer_free();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
|
||||||
|
|
||||||
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
||||||
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
||||||
FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; }
|
FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; }
|
||||||
|
|
@ -278,55 +280,50 @@
|
||||||
|
|
||||||
#endif // !USBCON
|
#endif // !USBCON
|
||||||
|
|
||||||
#ifdef INTERNAL_SERIAL_PORT
|
#ifdef MMU2_SERIAL_PORT
|
||||||
template <uint8_t serial>
|
template <uint8_t serial>
|
||||||
struct MarlinInternalSerialCfg {
|
struct MMU2SerialCfg {
|
||||||
static constexpr int PORT = serial;
|
static constexpr int PORT = serial;
|
||||||
|
static constexpr bool XONOFF = false;
|
||||||
|
static constexpr bool EMERGENCYPARSER = false;
|
||||||
|
static constexpr bool DROPPED_RX = false;
|
||||||
|
static constexpr bool RX_FRAMING_ERRORS = false;
|
||||||
|
static constexpr bool MAX_RX_QUEUED = false;
|
||||||
static constexpr unsigned int RX_SIZE = 32;
|
static constexpr unsigned int RX_SIZE = 32;
|
||||||
static constexpr unsigned int TX_SIZE = 32;
|
static constexpr unsigned int TX_SIZE = 32;
|
||||||
static constexpr bool XONOFF = false;
|
|
||||||
static constexpr bool EMERGENCYPARSER = false;
|
|
||||||
static constexpr bool DROPPED_RX = false;
|
|
||||||
static constexpr bool RX_OVERRUNS = false;
|
static constexpr bool RX_OVERRUNS = false;
|
||||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
|
||||||
static constexpr bool MAX_RX_QUEUED = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
|
extern MarlinSerial<MMU2SerialCfg<MMU2_SERIAL_PORT>> mmuSerial;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
|
|
||||||
template <uint8_t serial>
|
template <uint8_t serial>
|
||||||
struct MarlinInternalSerialCfg {
|
struct LCDSerialCfg {
|
||||||
static constexpr int PORT = serial;
|
static constexpr int PORT = serial;
|
||||||
|
static constexpr bool XONOFF = false;
|
||||||
|
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
|
||||||
|
static constexpr bool DROPPED_RX = false;
|
||||||
|
static constexpr bool RX_FRAMING_ERRORS = false;
|
||||||
|
static constexpr bool MAX_RX_QUEUED = false;
|
||||||
|
#if HAS_DGUS_LCD
|
||||||
static constexpr unsigned int RX_SIZE = DGUS_RX_BUFFER_SIZE;
|
static constexpr unsigned int RX_SIZE = DGUS_RX_BUFFER_SIZE;
|
||||||
static constexpr unsigned int TX_SIZE = DGUS_TX_BUFFER_SIZE;
|
static constexpr unsigned int TX_SIZE = DGUS_TX_BUFFER_SIZE;
|
||||||
static constexpr bool XONOFF = false;
|
static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
|
||||||
static constexpr bool EMERGENCYPARSER = false;
|
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
|
||||||
static constexpr bool DROPPED_RX = false;
|
|
||||||
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS);
|
|
||||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
|
||||||
static constexpr bool MAX_RX_QUEUED = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANYCUBIC_LCD_SERIAL_PORT
|
|
||||||
template <uint8_t serial>
|
|
||||||
struct AnycubicLcdSerialCfg {
|
|
||||||
static constexpr int PORT = serial;
|
|
||||||
static constexpr unsigned int RX_SIZE = 64;
|
static constexpr unsigned int RX_SIZE = 64;
|
||||||
static constexpr unsigned int TX_SIZE = 128;
|
static constexpr unsigned int TX_SIZE = 128;
|
||||||
static constexpr bool XONOFF = false;
|
|
||||||
static constexpr bool EMERGENCYPARSER = false;
|
|
||||||
static constexpr bool DROPPED_RX = false;
|
|
||||||
static constexpr bool RX_OVERRUNS = false;
|
static constexpr bool RX_OVERRUNS = false;
|
||||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
#else
|
||||||
static constexpr bool MAX_RX_QUEUED = false;
|
static constexpr unsigned int RX_SIZE = 64;
|
||||||
|
static constexpr unsigned int TX_SIZE = 128;
|
||||||
|
static constexpr bool RX_OVERRUNS = false
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>> anycubicLcdSerial;
|
extern MarlinSerial<LCDSerialCfg<LCD_SERIAL_PORT>> lcdSerial;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use the UART for Bluetooth in AT90USB configurations
|
// Use the UART for Bluetooth in AT90USB configurations
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@
|
||||||
* readMicroseconds() - Get the last-written servo pulse width in microseconds.
|
* readMicroseconds() - Get the last-written servo pulse width in microseconds.
|
||||||
* attached() - Return true if a servo is attached.
|
* attached() - Return true if a servo is attached.
|
||||||
* detach() - Stop an attached servo from pulsing its i/o pin.
|
* detach() - Stop an attached servo from pulsing its i/o pin.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,8 @@ void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||||
res_temp_phase_correct = rtf / 2;
|
res_temp_phase_correct = rtf / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIMIT(res_temp_fast, 1u, size);
|
LIMIT(res_temp_fast, 1U, size);
|
||||||
LIMIT(res_temp_phase_correct, 1u, size);
|
LIMIT(res_temp_phase_correct, 1U, size);
|
||||||
// Calculate frequencies of test prescaler and resolution values
|
// Calculate frequencies of test prescaler and resolution values
|
||||||
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
|
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
|
||||||
f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
|
f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,17 @@
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
|
#if defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)
|
||||||
#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
|
#define AVR_AT90USB1286_FAMILY 1
|
||||||
#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
|
#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
|
||||||
#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
|
#define AVR_ATmega1284_FAMILY 1
|
||||||
#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__))
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
|
#define AVR_ATmega2560_FAMILY 1
|
||||||
|
#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
||||||
|
#define AVR_ATmega2561_FAMILY 1
|
||||||
|
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
|
||||||
|
#define AVR_ATmega328_FAMILY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Include Ports and Functions
|
* Include Ports and Functions
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@
|
||||||
|
|
||||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||||
|
|
||||||
#define AVR_ATmega2560_FAMILY_PLUS_70 MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
|
#if MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14)
|
||||||
|
#define AVR_ATmega2560_FAMILY_PLUS_70 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if AVR_AT90USB1286_FAMILY
|
#if AVR_AT90USB1286_FAMILY
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,12 @@
|
||||||
* Structures for 2560 family boards that use more than 70 pins
|
* Structures for 2560 family boards that use more than 70 pins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef NUM_DIGITAL_PINS
|
#if MB(BQ_ZUM_MEGA_3D, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14)
|
||||||
#if MB(BQ_ZUM_MEGA_3D)
|
#undef NUM_DIGITAL_PINS
|
||||||
#define NUM_DIGITAL_PINS 85
|
#define NUM_DIGITAL_PINS 85
|
||||||
#elif MB(MIGHTYBOARD_REVE)
|
#elif MB(MIGHTYBOARD_REVE)
|
||||||
|
#undef NUM_DIGITAL_PINS
|
||||||
#define NUM_DIGITAL_PINS 80
|
#define NUM_DIGITAL_PINS 80
|
||||||
#elif MB(MINIRAMBO)
|
|
||||||
#define NUM_DIGITAL_PINS 85
|
|
||||||
#elif MB(SCOOVO_X9H)
|
|
||||||
#define NUM_DIGITAL_PINS 85
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PA 1
|
#define PA 1
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#include "../shared/Marduino.h"
|
#include "../shared/Marduino.h"
|
||||||
#include "../shared/Delay.h"
|
#include "../shared/Delay.h"
|
||||||
|
|
@ -189,5 +189,5 @@ uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
#endif // ARDUINO_ARCH_SAM
|
#endif // ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
#ifdef ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -38,59 +36,36 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
// Define MYSERIAL0/1 before MarlinSerial includes!
|
// Define MYSERIAL0/1 before MarlinSerial includes!
|
||||||
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
|
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
|
||||||
#define MYSERIAL0 customizedSerial1
|
#define MYSERIAL0 customizedSerial1
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#else
|
#else
|
||||||
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
|
||||||
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
|
|
||||||
#define MYSERIAL1 customizedSerial2
|
#define MYSERIAL1 customizedSerial2
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 3)
|
||||||
#define MYSERIAL1 Serial
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 Serial1
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 Serial2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 Serial3
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
#if LCD_SERIAL_PORT == -1
|
||||||
#error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
|
#define LCD_SERIAL lcdSerial
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
#elif DGUS_SERIAL_PORT == -1
|
|
||||||
#define DGUS_SERIAL internalDgusSerial
|
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
|
||||||
#define DGUS_SERIAL Serial
|
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
|
||||||
#define DGUS_SERIAL Serial1
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL Serial2
|
|
||||||
#elif DGUS_SERIAL_PORT == 3
|
|
||||||
#define DGUS_SERIAL Serial3
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -130,13 +105,15 @@ void sei(); // Enable interrupts
|
||||||
void HAL_clear_reset_source(); // clear reset reason
|
void HAL_clear_reset_source(); // clear reset reason
|
||||||
uint8_t HAL_get_reset_source(); // get reset reason
|
uint8_t HAL_get_reset_source(); // get reset reason
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADC
|
// ADC
|
||||||
//
|
//
|
||||||
extern uint16_t HAL_adc_result; // result of last ADC conversion
|
extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||||
|
|
||||||
#ifndef analogInputToDigitalPin
|
#ifndef analogInputToDigitalPin
|
||||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_ANALOG_SELECT(ch)
|
#define HAL_ANALOG_SELECT(ch)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
*
|
||||||
* For ARDUINO_ARCH_SAM
|
* For ARDUINO_ARCH_SAM
|
||||||
*/
|
*/
|
||||||
|
|
@ -595,7 +595,7 @@
|
||||||
SPI_Enable(SPI0);
|
SPI_Enable(SPI0);
|
||||||
|
|
||||||
SET_OUTPUT(DAC0_SYNC);
|
SET_OUTPUT(DAC0_SYNC);
|
||||||
#if EXTRUDERS > 1
|
#if HAS_MULTI_EXTRUDER
|
||||||
SET_OUTPUT(DAC1_SYNC);
|
SET_OUTPUT(DAC1_SYNC);
|
||||||
WRITE(DAC1_SYNC, HIGH);
|
WRITE(DAC1_SYNC, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -759,7 +759,6 @@
|
||||||
*
|
*
|
||||||
* All of the above can be avoided by defining FORCE_SOFT_SPI to force the
|
* All of the above can be avoided by defining FORCE_SOFT_SPI to force the
|
||||||
* display to use software SPI.
|
* display to use software SPI.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void spiInit(uint8_t spiRate=6) { // Default to slowest rate if not specified)
|
void spiInit(uint8_t spiRate=6) { // Default to slowest rate if not specified)
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,8 @@ public:
|
||||||
static void write(const uint8_t c);
|
static void write(const uint8_t c);
|
||||||
static void flushTX();
|
static void flushTX();
|
||||||
|
|
||||||
|
static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
|
||||||
|
|
||||||
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
||||||
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
||||||
FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; }
|
FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; }
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,13 @@
|
||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __SAM3X8E__
|
#ifdef __SAM3X8E__
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
|
|
||||||
|
|
@ -145,6 +144,6 @@ uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#endif // __SAM3X8E__
|
#endif // __SAM3X8E__
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD && DISABLED(U8GLIB_ST7920)
|
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||||
|
|
||||||
#undef SPI_SPEED
|
#undef SPI_SPEED
|
||||||
#define SPI_SPEED 2 // About 2 MHz
|
#define SPI_SPEED 2 // About 2 MHz
|
||||||
|
|
@ -144,5 +144,5 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD && !U8GLIB_ST7920
|
#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
|
||||||
#endif // ARDUINO_ARCH_SAM
|
#endif // ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#include "../../shared/Delay.h"
|
#include "../../shared/Delay.h"
|
||||||
|
|
||||||
|
|
@ -108,5 +108,5 @@ void u8g_spiSend_sw_DUE_mode_3(uint8_t val) { // 3.5MHz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
#endif // ARDUINO_ARCH_SAM
|
#endif // ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@
|
||||||
* per page. We can't emulate EE endurance with FLASH for all
|
* per page. We can't emulate EE endurance with FLASH for all
|
||||||
* bytes, but we can emulate endurance for a given percent of
|
* bytes, but we can emulate endurance for a given percent of
|
||||||
* bytes.
|
* bytes.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define EE_EMU_DEBUG
|
//#define EE_EMU_DEBUG
|
||||||
|
|
@ -61,7 +60,7 @@
|
||||||
#define EEPROMSize 4096
|
#define EEPROMSize 4096
|
||||||
#define PagesPerGroup 128
|
#define PagesPerGroup 128
|
||||||
#define GroupCount 2
|
#define GroupCount 2
|
||||||
#define PageSize 256u
|
#define PageSize 256U
|
||||||
|
|
||||||
/* Flash storage */
|
/* Flash storage */
|
||||||
typedef struct FLASH_SECTOR {
|
typedef struct FLASH_SECTOR {
|
||||||
|
|
|
||||||
|
|
@ -179,5 +179,4 @@ void pwm_details(int32_t pin) {
|
||||||
* ----------------+--------
|
* ----------------+--------
|
||||||
* ID | PB11
|
* ID | PB11
|
||||||
* VBOF | PB10
|
* VBOF | PB10
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL Timers for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
#ifdef ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL Timers for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,5 @@ if current_OS == 'Windows':
|
||||||
|
|
||||||
# Use bossac.exe on Windows
|
# Use bossac.exe on Windows
|
||||||
env.Replace(
|
env.Replace(
|
||||||
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot"
|
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -609,37 +609,37 @@ typedef struct
|
||||||
# define clz(u) ((u) ? __CLZ(u) : 32)
|
# define clz(u) ((u) ? __CLZ(u) : 32)
|
||||||
#else
|
#else
|
||||||
# define clz(u) (((u) == 0) ? 32 : \
|
# define clz(u) (((u) == 0) ? 32 : \
|
||||||
((u) & (1ul << 31)) ? 0 : \
|
((u) & (1UL << 31)) ? 0 : \
|
||||||
((u) & (1ul << 30)) ? 1 : \
|
((u) & (1UL << 30)) ? 1 : \
|
||||||
((u) & (1ul << 29)) ? 2 : \
|
((u) & (1UL << 29)) ? 2 : \
|
||||||
((u) & (1ul << 28)) ? 3 : \
|
((u) & (1UL << 28)) ? 3 : \
|
||||||
((u) & (1ul << 27)) ? 4 : \
|
((u) & (1UL << 27)) ? 4 : \
|
||||||
((u) & (1ul << 26)) ? 5 : \
|
((u) & (1UL << 26)) ? 5 : \
|
||||||
((u) & (1ul << 25)) ? 6 : \
|
((u) & (1UL << 25)) ? 6 : \
|
||||||
((u) & (1ul << 24)) ? 7 : \
|
((u) & (1UL << 24)) ? 7 : \
|
||||||
((u) & (1ul << 23)) ? 8 : \
|
((u) & (1UL << 23)) ? 8 : \
|
||||||
((u) & (1ul << 22)) ? 9 : \
|
((u) & (1UL << 22)) ? 9 : \
|
||||||
((u) & (1ul << 21)) ? 10 : \
|
((u) & (1UL << 21)) ? 10 : \
|
||||||
((u) & (1ul << 20)) ? 11 : \
|
((u) & (1UL << 20)) ? 11 : \
|
||||||
((u) & (1ul << 19)) ? 12 : \
|
((u) & (1UL << 19)) ? 12 : \
|
||||||
((u) & (1ul << 18)) ? 13 : \
|
((u) & (1UL << 18)) ? 13 : \
|
||||||
((u) & (1ul << 17)) ? 14 : \
|
((u) & (1UL << 17)) ? 14 : \
|
||||||
((u) & (1ul << 16)) ? 15 : \
|
((u) & (1UL << 16)) ? 15 : \
|
||||||
((u) & (1ul << 15)) ? 16 : \
|
((u) & (1UL << 15)) ? 16 : \
|
||||||
((u) & (1ul << 14)) ? 17 : \
|
((u) & (1UL << 14)) ? 17 : \
|
||||||
((u) & (1ul << 13)) ? 18 : \
|
((u) & (1UL << 13)) ? 18 : \
|
||||||
((u) & (1ul << 12)) ? 19 : \
|
((u) & (1UL << 12)) ? 19 : \
|
||||||
((u) & (1ul << 11)) ? 20 : \
|
((u) & (1UL << 11)) ? 20 : \
|
||||||
((u) & (1ul << 10)) ? 21 : \
|
((u) & (1UL << 10)) ? 21 : \
|
||||||
((u) & (1ul << 9)) ? 22 : \
|
((u) & (1UL << 9)) ? 22 : \
|
||||||
((u) & (1ul << 8)) ? 23 : \
|
((u) & (1UL << 8)) ? 23 : \
|
||||||
((u) & (1ul << 7)) ? 24 : \
|
((u) & (1UL << 7)) ? 24 : \
|
||||||
((u) & (1ul << 6)) ? 25 : \
|
((u) & (1UL << 6)) ? 25 : \
|
||||||
((u) & (1ul << 5)) ? 26 : \
|
((u) & (1UL << 5)) ? 26 : \
|
||||||
((u) & (1ul << 4)) ? 27 : \
|
((u) & (1UL << 4)) ? 27 : \
|
||||||
((u) & (1ul << 3)) ? 28 : \
|
((u) & (1UL << 3)) ? 28 : \
|
||||||
((u) & (1ul << 2)) ? 29 : \
|
((u) & (1UL << 2)) ? 29 : \
|
||||||
((u) & (1ul << 1)) ? 30 : \
|
((u) & (1UL << 1)) ? 30 : \
|
||||||
31)
|
31)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -654,38 +654,38 @@ typedef struct
|
||||||
#if (defined __GNUC__) || (defined __CC_ARM)
|
#if (defined __GNUC__) || (defined __CC_ARM)
|
||||||
# define ctz(u) ((u) ? __builtin_ctz(u) : 32)
|
# define ctz(u) ((u) ? __builtin_ctz(u) : 32)
|
||||||
#else
|
#else
|
||||||
# define ctz(u) ((u) & (1ul << 0) ? 0 : \
|
# define ctz(u) ((u) & (1UL << 0) ? 0 : \
|
||||||
(u) & (1ul << 1) ? 1 : \
|
(u) & (1UL << 1) ? 1 : \
|
||||||
(u) & (1ul << 2) ? 2 : \
|
(u) & (1UL << 2) ? 2 : \
|
||||||
(u) & (1ul << 3) ? 3 : \
|
(u) & (1UL << 3) ? 3 : \
|
||||||
(u) & (1ul << 4) ? 4 : \
|
(u) & (1UL << 4) ? 4 : \
|
||||||
(u) & (1ul << 5) ? 5 : \
|
(u) & (1UL << 5) ? 5 : \
|
||||||
(u) & (1ul << 6) ? 6 : \
|
(u) & (1UL << 6) ? 6 : \
|
||||||
(u) & (1ul << 7) ? 7 : \
|
(u) & (1UL << 7) ? 7 : \
|
||||||
(u) & (1ul << 8) ? 8 : \
|
(u) & (1UL << 8) ? 8 : \
|
||||||
(u) & (1ul << 9) ? 9 : \
|
(u) & (1UL << 9) ? 9 : \
|
||||||
(u) & (1ul << 10) ? 10 : \
|
(u) & (1UL << 10) ? 10 : \
|
||||||
(u) & (1ul << 11) ? 11 : \
|
(u) & (1UL << 11) ? 11 : \
|
||||||
(u) & (1ul << 12) ? 12 : \
|
(u) & (1UL << 12) ? 12 : \
|
||||||
(u) & (1ul << 13) ? 13 : \
|
(u) & (1UL << 13) ? 13 : \
|
||||||
(u) & (1ul << 14) ? 14 : \
|
(u) & (1UL << 14) ? 14 : \
|
||||||
(u) & (1ul << 15) ? 15 : \
|
(u) & (1UL << 15) ? 15 : \
|
||||||
(u) & (1ul << 16) ? 16 : \
|
(u) & (1UL << 16) ? 16 : \
|
||||||
(u) & (1ul << 17) ? 17 : \
|
(u) & (1UL << 17) ? 17 : \
|
||||||
(u) & (1ul << 18) ? 18 : \
|
(u) & (1UL << 18) ? 18 : \
|
||||||
(u) & (1ul << 19) ? 19 : \
|
(u) & (1UL << 19) ? 19 : \
|
||||||
(u) & (1ul << 20) ? 20 : \
|
(u) & (1UL << 20) ? 20 : \
|
||||||
(u) & (1ul << 21) ? 21 : \
|
(u) & (1UL << 21) ? 21 : \
|
||||||
(u) & (1ul << 22) ? 22 : \
|
(u) & (1UL << 22) ? 22 : \
|
||||||
(u) & (1ul << 23) ? 23 : \
|
(u) & (1UL << 23) ? 23 : \
|
||||||
(u) & (1ul << 24) ? 24 : \
|
(u) & (1UL << 24) ? 24 : \
|
||||||
(u) & (1ul << 25) ? 25 : \
|
(u) & (1UL << 25) ? 25 : \
|
||||||
(u) & (1ul << 26) ? 26 : \
|
(u) & (1UL << 26) ? 26 : \
|
||||||
(u) & (1ul << 27) ? 27 : \
|
(u) & (1UL << 27) ? 27 : \
|
||||||
(u) & (1ul << 28) ? 28 : \
|
(u) & (1UL << 28) ? 28 : \
|
||||||
(u) & (1ul << 29) ? 29 : \
|
(u) & (1UL << 29) ? 29 : \
|
||||||
(u) & (1ul << 30) ? 30 : \
|
(u) & (1UL << 30) ? 30 : \
|
||||||
(u) & (1ul << 31) ? 31 : \
|
(u) & (1UL << 31) ? 31 : \
|
||||||
32)
|
32)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1112,8 +1112,7 @@ static inline uint32_t convert_byte_array_to_32_bit(uint8_t *data)
|
||||||
uint8_t u8[8];
|
uint8_t u8[8];
|
||||||
}long_addr;
|
}long_addr;
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
for (index = 0; index < 4; index++)
|
for (index = 0; index < 4; index++) {
|
||||||
{
|
|
||||||
long_addr.u8[index] = *data++;
|
long_addr.u8[index] = *data++;
|
||||||
}
|
}
|
||||||
return long_addr.u32;
|
return long_addr.u32;
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,12 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Espressif ESP32 WiFi
|
* HAL for Espressif ESP32 WiFi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -58,9 +59,6 @@ extern portMUX_TYPE spinlock;
|
||||||
#else
|
#else
|
||||||
#define MYSERIAL1 webSocketSerial
|
#define MYSERIAL1 webSocketSerial
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
|
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
|
||||||
|
|
@ -98,6 +96,8 @@ void HAL_clear_reset_source();
|
||||||
// reset reason
|
// reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(int delay);
|
void _delay_ms(int delay);
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
@ -157,14 +157,14 @@ FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
||||||
|
|
||||||
if (stop >= start) {
|
if (stop >= start) {
|
||||||
// no overflow, so only loop while in between start and stop:
|
// no overflow, so only loop while in between start and stop:
|
||||||
// 0x00000000 -----------------start****stop-- 0xffffffff
|
// 0x00000000 -----------------start****stop-- 0xFFFFFFFF
|
||||||
while (ccount >= start && ccount < stop) {
|
while (ccount >= start && ccount < stop) {
|
||||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// stop did overflow, so only loop while outside of stop and start:
|
// stop did overflow, so only loop while outside of stop and start:
|
||||||
// 0x00000000 **stop-------------------start** 0xffffffff
|
// 0x00000000 **stop-------------------start** 0xFFFFFFFF
|
||||||
while (ccount >= start || ccount < stop) {
|
while (ccount >= start || ccount < stop) {
|
||||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ int RingBuffer::read() {
|
||||||
ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) {
|
ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) {
|
||||||
ring_buffer_pos_t len = available();
|
ring_buffer_pos_t len = available();
|
||||||
|
|
||||||
for(ring_buffer_pos_t i = 0; read_index != write_index; i++) {
|
for (ring_buffer_pos_t i = 0; read_index != write_index; i++) {
|
||||||
buffer[i] = data[read_index];
|
buffer[i] = data[read_index];
|
||||||
read_index = NEXT_INDEX(read_index, size);
|
read_index = NEXT_INDEX(read_index, size);
|
||||||
}
|
}
|
||||||
|
|
@ -139,9 +139,8 @@ size_t WebSocketSerial::write(const uint8_t c) {
|
||||||
|
|
||||||
size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
|
size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
for(size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++)
|
||||||
written += write(buffer[i]);
|
written += write(buffer[i]);
|
||||||
}
|
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,12 @@
|
||||||
|
|
||||||
#include HAL_PATH(.,HAL.h)
|
#include HAL_PATH(.,HAL.h)
|
||||||
|
|
||||||
|
#ifdef SERIAL_PORT_2
|
||||||
|
#define NUM_SERIAL 2
|
||||||
|
#else
|
||||||
|
#define NUM_SERIAL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||||
|
|
||||||
#ifndef I2C_ADDRESS
|
#ifndef I2C_ADDRESS
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ uint8_t _getc();
|
||||||
|
|
||||||
extern HalSerial usb_serial;
|
extern HalSerial usb_serial;
|
||||||
#define MYSERIAL0 usb_serial
|
#define MYSERIAL0 usb_serial
|
||||||
#define NUM_SERIAL 1
|
|
||||||
|
|
||||||
#define ST7920_DELAY_1 DELAY_NS(600)
|
#define ST7920_DELAY_1 DELAY_NS(600)
|
||||||
#define ST7920_DELAY_2 DELAY_NS(750)
|
#define ST7920_DELAY_2 DELAY_NS(750)
|
||||||
|
|
@ -102,6 +101,8 @@ uint16_t HAL_adc_get_result();
|
||||||
inline void HAL_clear_reset_source(void) {}
|
inline void HAL_clear_reset_source(void) {}
|
||||||
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
|
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
/* ---------------- Delay in cycles */
|
/* ---------------- Delay in cycles */
|
||||||
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
|
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
|
||||||
Clock::delayCycles(x);
|
Clock::delayCycles(x);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
* Generic RingBuffer
|
* Generic RingBuffer
|
||||||
* T type of the buffer array
|
* T type of the buffer array
|
||||||
* S size of the buffer (must be power of 2)
|
* S size of the buffer (must be power of 2)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
template <typename T, uint32_t S> class RingBuffer {
|
template <typename T, uint32_t S> class RingBuffer {
|
||||||
public:
|
public:
|
||||||
|
|
@ -79,6 +78,7 @@ public:
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
EmergencyParser::State emergency_state;
|
EmergencyParser::State emergency_state;
|
||||||
|
static inline bool emergency_parser_enabled() { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HalSerial() { host_connected = true; }
|
HalSerial() { host_connected = true; }
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ int main() {
|
||||||
std::thread write_serial (write_serial_thread);
|
std::thread write_serial (write_serial_thread);
|
||||||
std::thread read_serial (read_serial_thread);
|
std::thread read_serial (read_serial_thread);
|
||||||
|
|
||||||
#if NUM_SERIAL > 0
|
#ifdef MYSERIAL0
|
||||||
MYSERIAL0.begin(BAUDRATE);
|
MYSERIAL0.begin(BAUDRATE);
|
||||||
SERIAL_ECHOLNPGM("x86_64 Initialized");
|
SERIAL_ECHOLNPGM("x86_64 Initialized");
|
||||||
SERIAL_FLUSHTX();
|
SERIAL_FLUSHTX();
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@
|
||||||
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
|
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
|
||||||
*
|
*
|
||||||
* The only modification was to update/delete macros to match the LPC176x.
|
* The only modification was to update/delete macros to match the LPC176x.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "../../core/macros.h"
|
#include "../../core/macros.h"
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if BOTH(HAS_GRAPHICAL_LCD, SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
||||||
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||||
// needed due to the speed and mode required for communicating with each device being different.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
// This requirement can be removed if the SPI access to these devices is updated to use
|
// This requirement can be removed if the SPI access to these devices is updated to use
|
||||||
|
|
|
||||||
|
|
@ -63,58 +63,35 @@ extern "C" volatile uint32_t _millis;
|
||||||
#define ST7920_DELAY_3 DELAY_NS(750)
|
#define ST7920_DELAY_3 DELAY_NS(750)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _MSERIAL(X) MSerial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define MSerial0 MSerial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 UsbSerial
|
#define MYSERIAL0 UsbSerial
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 MSerial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 MSerial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 MSerial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 MSerial3
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 UsbSerial
|
#define MYSERIAL1 UsbSerial
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 3)
|
||||||
#define MYSERIAL1 MSerial
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 MSerial1
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 MSerial2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 MSerial3
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
#if LCD_SERIAL_PORT == -1
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
#define LCD_SERIAL UsbSerial
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
#elif DGUS_SERIAL_PORT == -1
|
|
||||||
#define DGUS_SERIAL UsbSerial
|
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
|
||||||
#define DGUS_SERIAL MSerial
|
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
|
||||||
#define DGUS_SERIAL MSerial1
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL MSerial2
|
|
||||||
#elif DGUS_SERIAL_PORT == 3
|
|
||||||
#define DGUS_SERIAL MSerial3
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -223,6 +200,8 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255,
|
||||||
void HAL_clear_reset_source(void);
|
void HAL_clear_reset_source(void);
|
||||||
uint8_t HAL_get_reset_source(void);
|
uint8_t HAL_get_reset_source(void);
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
// Add strcmp_P if missing
|
// Add strcmp_P if missing
|
||||||
#ifndef strcmp_P
|
#ifndef strcmp_P
|
||||||
#define strcmp_P(a, b) strcmp((a), (b))
|
#define strcmp_P(a, b) strcmp((a), (b))
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@
|
||||||
* WRITE nor digitalWrite when the hardware SPI module within the LPC17xx is
|
* WRITE nor digitalWrite when the hardware SPI module within the LPC17xx is
|
||||||
* active. If any of these pins are shared then the software SPI must be used.
|
* active. If any of these pins are shared then the software SPI must be used.
|
||||||
*
|
*
|
||||||
* A more sophisticated hardware SPI can be found at the following link. This
|
* A more sophisticated hardware SPI can be found at the following link.
|
||||||
* implementation has not been fully debugged.
|
* This implementation has not been fully debugged.
|
||||||
* https://github.com/MarlinFirmware/Marlin/tree/071c7a78f27078fd4aee9a3ef365fcf5e143531e
|
* https://github.com/MarlinFirmware/Marlin/tree/071c7a78f27078fd4aee9a3ef365fcf5e143531e
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -170,34 +170,20 @@ static inline void waitSpiTxEnd(LPC_SSP_TypeDef *spi_d) {
|
||||||
while (SSP_GetStatus(spi_d, SSP_STAT_BUSY) == SET) { /* nada */ } // wait until BSY=0
|
while (SSP_GetStatus(spi_d, SSP_STAT_BUSY) == SET) { /* nada */ } // wait until BSY=0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retain the pin init state of the SPI, to avoid init more than once,
|
||||||
|
// even if more instances of SPIClass exist
|
||||||
|
static bool spiInitialised[BOARD_NR_SPI] = { false };
|
||||||
|
|
||||||
SPIClass::SPIClass(uint8_t device) {
|
SPIClass::SPIClass(uint8_t device) {
|
||||||
// Init things specific to each SPI device
|
// Init things specific to each SPI device
|
||||||
// clock divider setup is a bit of hack, and needs to be improved at a later date.
|
// clock divider setup is a bit of hack, and needs to be improved at a later date.
|
||||||
|
|
||||||
PINSEL_CFG_Type PinCfg; // data structure to hold init values
|
|
||||||
#if BOARD_NR_SPI >= 1
|
#if BOARD_NR_SPI >= 1
|
||||||
_settings[0].spi_d = LPC_SSP0;
|
_settings[0].spi_d = LPC_SSP0;
|
||||||
_settings[0].dataMode = SPI_MODE0;
|
_settings[0].dataMode = SPI_MODE0;
|
||||||
_settings[0].dataSize = DATA_SIZE_8BIT;
|
_settings[0].dataSize = DATA_SIZE_8BIT;
|
||||||
_settings[0].clock = SPI_CLOCK_MAX;
|
_settings[0].clock = SPI_CLOCK_MAX;
|
||||||
// _settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock);
|
//_settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock);
|
||||||
PinCfg.Funcnum = 2;
|
|
||||||
PinCfg.OpenDrain = 0;
|
|
||||||
PinCfg.Pinmode = 0;
|
|
||||||
PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI1_SCK_PIN);
|
|
||||||
PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI1_SCK_PIN);
|
|
||||||
PINSEL_ConfigPin(&PinCfg);
|
|
||||||
SET_OUTPUT(BOARD_SPI1_SCK_PIN);
|
|
||||||
|
|
||||||
PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI1_MISO_PIN);
|
|
||||||
PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI1_MISO_PIN);
|
|
||||||
PINSEL_ConfigPin(&PinCfg);
|
|
||||||
SET_INPUT(BOARD_SPI1_MISO_PIN);
|
|
||||||
|
|
||||||
PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI1_MOSI_PIN);
|
|
||||||
PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI1_MOSI_PIN);
|
|
||||||
PINSEL_ConfigPin(&PinCfg);
|
|
||||||
SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_NR_SPI >= 2
|
#if BOARD_NR_SPI >= 2
|
||||||
|
|
@ -205,34 +191,53 @@ SPIClass::SPIClass(uint8_t device) {
|
||||||
_settings[1].dataMode = SPI_MODE0;
|
_settings[1].dataMode = SPI_MODE0;
|
||||||
_settings[1].dataSize = DATA_SIZE_8BIT;
|
_settings[1].dataSize = DATA_SIZE_8BIT;
|
||||||
_settings[1].clock = SPI_CLOCK_MAX;
|
_settings[1].clock = SPI_CLOCK_MAX;
|
||||||
// _settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock);
|
//_settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock);
|
||||||
PinCfg.Funcnum = 2;
|
|
||||||
PinCfg.OpenDrain = 0;
|
|
||||||
PinCfg.Pinmode = 0;
|
|
||||||
PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_SCK_PIN);
|
|
||||||
PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_SCK_PIN);
|
|
||||||
PINSEL_ConfigPin(&PinCfg);
|
|
||||||
SET_OUTPUT(BOARD_SPI2_SCK_PIN);
|
|
||||||
|
|
||||||
PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_MISO_PIN);
|
|
||||||
PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_MISO_PIN);
|
|
||||||
PINSEL_ConfigPin(&PinCfg);
|
|
||||||
SET_INPUT(BOARD_SPI2_MISO_PIN);
|
|
||||||
|
|
||||||
PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_MOSI_PIN);
|
|
||||||
PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_MOSI_PIN);
|
|
||||||
PINSEL_ConfigPin(&PinCfg);
|
|
||||||
SET_OUTPUT(BOARD_SPI2_MOSI_PIN);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setModule(device);
|
setModule(device);
|
||||||
|
|
||||||
/* Initialize GPDMA controller */
|
// Init the GPDMA controller
|
||||||
//TODO: call once in the constructor? or each time?
|
// TODO: call once in the constructor? or each time?
|
||||||
GPDMA_Init();
|
GPDMA_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::begin() {
|
void SPIClass::begin() {
|
||||||
|
// Init the SPI pins in the first begin call
|
||||||
|
if ((_currentSetting->spi_d == LPC_SSP0 && spiInitialised[0] == false) ||
|
||||||
|
(_currentSetting->spi_d == LPC_SSP1 && spiInitialised[1] == false)) {
|
||||||
|
pin_t sck, miso, mosi;
|
||||||
|
if (_currentSetting->spi_d == LPC_SSP0) {
|
||||||
|
sck = BOARD_SPI1_SCK_PIN;
|
||||||
|
miso = BOARD_SPI1_MISO_PIN;
|
||||||
|
mosi = BOARD_SPI1_MOSI_PIN;
|
||||||
|
spiInitialised[0] = true;
|
||||||
|
}
|
||||||
|
else if (_currentSetting->spi_d == LPC_SSP1) {
|
||||||
|
sck = BOARD_SPI2_SCK_PIN;
|
||||||
|
miso = BOARD_SPI2_MISO_PIN;
|
||||||
|
mosi = BOARD_SPI2_MOSI_PIN;
|
||||||
|
spiInitialised[1] = true;
|
||||||
|
}
|
||||||
|
PINSEL_CFG_Type PinCfg; // data structure to hold init values
|
||||||
|
PinCfg.Funcnum = 2;
|
||||||
|
PinCfg.OpenDrain = 0;
|
||||||
|
PinCfg.Pinmode = 0;
|
||||||
|
PinCfg.Pinnum = LPC176x::pin_bit(sck);
|
||||||
|
PinCfg.Portnum = LPC176x::pin_port(sck);
|
||||||
|
PINSEL_ConfigPin(&PinCfg);
|
||||||
|
SET_OUTPUT(sck);
|
||||||
|
|
||||||
|
PinCfg.Pinnum = LPC176x::pin_bit(miso);
|
||||||
|
PinCfg.Portnum = LPC176x::pin_port(miso);
|
||||||
|
PINSEL_ConfigPin(&PinCfg);
|
||||||
|
SET_INPUT(miso);
|
||||||
|
|
||||||
|
PinCfg.Pinnum = LPC176x::pin_bit(mosi);
|
||||||
|
PinCfg.Portnum = LPC176x::pin_port(mosi);
|
||||||
|
PINSEL_ConfigPin(&PinCfg);
|
||||||
|
SET_OUTPUT(mosi);
|
||||||
|
}
|
||||||
|
|
||||||
updateSettings();
|
updateSettings();
|
||||||
SSP_Cmd(_currentSetting->spi_d, ENABLE); // start SSP running
|
SSP_Cmd(_currentSetting->spi_d, ENABLE); // start SSP running
|
||||||
}
|
}
|
||||||
|
|
@ -246,7 +251,7 @@ void SPIClass::beginTransaction(const SPISettings &cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t SPIClass::transfer(const uint16_t b) {
|
uint8_t SPIClass::transfer(const uint16_t b) {
|
||||||
/* send and receive a single byte */
|
// Send and receive a single byte
|
||||||
SSP_ReceiveData(_currentSetting->spi_d); // read any previous data
|
SSP_ReceiveData(_currentSetting->spi_d); // read any previous data
|
||||||
SSP_SendData(_currentSetting->spi_d, b);
|
SSP_SendData(_currentSetting->spi_d, b);
|
||||||
waitSpiTxEnd(_currentSetting->spi_d); // wait for it to finish
|
waitSpiTxEnd(_currentSetting->spi_d); // wait for it to finish
|
||||||
|
|
@ -254,8 +259,7 @@ uint8_t SPIClass::transfer(const uint16_t b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t SPIClass::transfer16(const uint16_t data) {
|
uint16_t SPIClass::transfer16(const uint16_t data) {
|
||||||
return (transfer((data >> 8) & 0xFF) << 8)
|
return (transfer((data >> 8) & 0xFF) << 8) | (transfer(data & 0xFF) & 0xFF);
|
||||||
| (transfer(data & 0xFF) & 0xFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::end() {
|
void SPIClass::end() {
|
||||||
|
|
@ -294,23 +298,23 @@ void SPIClass::dmaSend(void *buf, uint16_t length, bool minc) {
|
||||||
// Enable dma on SPI
|
// Enable dma on SPI
|
||||||
SSP_DMACmd(_currentSetting->spi_d, SSP_DMA_TX, ENABLE);
|
SSP_DMACmd(_currentSetting->spi_d, SSP_DMA_TX, ENABLE);
|
||||||
|
|
||||||
// only increase memory if minc is true
|
// Only increase memory if minc is true
|
||||||
GPDMACfg.MemoryIncrease = (minc ? GPDMA_DMACCxControl_SI : 0);
|
GPDMACfg.MemoryIncrease = (minc ? GPDMA_DMACCxControl_SI : 0);
|
||||||
|
|
||||||
// Setup channel with given parameter
|
// Setup channel with given parameter
|
||||||
GPDMA_Setup(&GPDMACfg);
|
GPDMA_Setup(&GPDMACfg);
|
||||||
|
|
||||||
// enabled dma
|
// Enable DMA
|
||||||
GPDMA_ChannelCmd(0, ENABLE);
|
GPDMA_ChannelCmd(0, ENABLE);
|
||||||
|
|
||||||
// wait data transfer
|
// Wait for data transfer
|
||||||
while (!GPDMA_IntGetStatus(GPDMA_STAT_RAWINTTC, 0) && !GPDMA_IntGetStatus(GPDMA_STAT_RAWINTERR, 0)) { }
|
while (!GPDMA_IntGetStatus(GPDMA_STAT_RAWINTTC, 0) && !GPDMA_IntGetStatus(GPDMA_STAT_RAWINTERR, 0)) { }
|
||||||
|
|
||||||
// clear err and int
|
// Clear err and int
|
||||||
GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, 0);
|
GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, 0);
|
||||||
GPDMA_ClearIntPending (GPDMA_STATCLR_INTERR, 0);
|
GPDMA_ClearIntPending (GPDMA_STATCLR_INTERR, 0);
|
||||||
|
|
||||||
// dma disable
|
// Disable DMA
|
||||||
GPDMA_ChannelCmd(0, DISABLE);
|
GPDMA_ChannelCmd(0, DISABLE);
|
||||||
|
|
||||||
waitSpiTxEnd(_currentSetting->spi_d);
|
waitSpiTxEnd(_currentSetting->spi_d);
|
||||||
|
|
|
||||||
|
|
@ -24,28 +24,28 @@
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
|
|
||||||
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
|
#if USING_SERIAL_0
|
||||||
MarlinSerial MSerial(LPC_UART0);
|
MarlinSerial MSerial(LPC_UART0);
|
||||||
extern "C" void UART0_IRQHandler() {
|
extern "C" void UART0_IRQHandler() {
|
||||||
MSerial.IRQHandler();
|
MSerial.IRQHandler();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
#if USING_SERIAL_1
|
||||||
MarlinSerial MSerial1((LPC_UART_TypeDef *) LPC_UART1);
|
MarlinSerial MSerial1((LPC_UART_TypeDef *) LPC_UART1);
|
||||||
extern "C" void UART1_IRQHandler() {
|
extern "C" void UART1_IRQHandler() {
|
||||||
MSerial1.IRQHandler();
|
MSerial1.IRQHandler();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
#if USING_SERIAL_2
|
||||||
MarlinSerial MSerial2(LPC_UART2);
|
MarlinSerial MSerial2(LPC_UART2);
|
||||||
extern "C" void UART2_IRQHandler() {
|
extern "C" void UART2_IRQHandler() {
|
||||||
MSerial2.IRQHandler();
|
MSerial2.IRQHandler();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
#if USING_SERIAL_3
|
||||||
MarlinSerial MSerial3(LPC_UART3);
|
MarlinSerial MSerial3(LPC_UART3);
|
||||||
extern "C" void UART3_IRQHandler() {
|
extern "C" void UART3_IRQHandler() {
|
||||||
MSerial3.IRQHandler();
|
MSerial3.IRQHandler();
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
EmergencyParser::State emergency_state;
|
EmergencyParser::State emergency_state;
|
||||||
|
static inline bool emergency_parser_enabled() { return true; }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@
|
||||||
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
|
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
|
||||||
*
|
*
|
||||||
* The only modification was to update/delete macros to match the LPC176x.
|
* The only modification was to update/delete macros to match the LPC176x.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Servo.h>
|
#include <Servo.h>
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,10 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
* Serial2 | P0_10 | P0_11 |
|
* Serial2 | P0_10 | P0_11 |
|
||||||
* Serial3 | P0_00 | P0_01 |
|
* Serial3 | P0_00 | P0_01 |
|
||||||
*/
|
*/
|
||||||
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
|
#define ANY_TX(N,V...) DO(IS_TX##N,||,V)
|
||||||
|
#define ANY_RX(N,V...) DO(IS_RX##N,||,V)
|
||||||
|
|
||||||
|
#if USING_SERIAL_0
|
||||||
#define IS_TX0(P) (P == P0_02)
|
#define IS_TX0(P) (P == P0_02)
|
||||||
#define IS_RX0(P) (P == P0_03)
|
#define IS_RX0(P) (P == P0_03)
|
||||||
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
|
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
|
||||||
|
|
@ -103,60 +106,67 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
#undef IS_RX0
|
#undef IS_RX0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
#if USING_SERIAL_1
|
||||||
#define IS_TX1(P) (P == P0_15)
|
#define IS_TX1(P) (P == P0_15)
|
||||||
#define IS_RX1(P) (P == P0_16)
|
#define IS_RX1(P) (P == P0_16)
|
||||||
|
#define _IS_TX1_1 IS_TX1
|
||||||
|
#define _IS_RX1_1 IS_RX1
|
||||||
#if IS_TX1(TMC_SW_SCK)
|
#if IS_TX1(TMC_SW_SCK)
|
||||||
#error "Serial port pins (1) conflict with other pins!"
|
#error "Serial port pins (1) conflict with other pins!"
|
||||||
#elif HAS_SPI_LCD
|
#elif HAS_WIRED_LCD
|
||||||
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
#if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
||||||
#error "Serial port pins (1) conflict with Encoder Buttons!"
|
#error "Serial port pins (1) conflict with Encoder Buttons!"
|
||||||
#elif IS_TX1(SCK_PIN) || IS_TX1(LCD_PINS_D4) || IS_TX1(DOGLCD_SCK) || IS_TX1(LCD_RESET_PIN) || IS_TX1(LCD_PINS_RS) || IS_TX1(SHIFT_CLK) \
|
#elif ANY_TX(1, SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \
|
||||||
|| IS_RX1(LCD_SDSS) || IS_RX1(LCD_PINS_RS) || IS_RX1(MISO_PIN) || IS_RX1(DOGLCD_A0) || IS_RX1(SS_PIN) || IS_RX1(LCD_SDSS) || IS_RX1(DOGLCD_CS) || IS_RX1(LCD_RESET_PIN) || IS_RX1(LCD_BACKLIGHT_PIN)
|
|| ANY_RX(1, LCD_SDSS, LCD_PINS_RS, MISO_PIN, DOGLCD_A0, SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN)
|
||||||
#error "Serial port pins (1) conflict with LCD pins!"
|
#error "Serial port pins (1) conflict with LCD pins!"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#undef IS_TX1
|
#undef IS_TX1
|
||||||
#undef IS_RX1
|
#undef IS_RX1
|
||||||
|
#undef _IS_TX1_1
|
||||||
|
#undef _IS_RX1_1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
#if USING_SERIAL_2
|
||||||
#define IS_TX2(P) (P == P0_10)
|
#define IS_TX2(P) (P == P0_10)
|
||||||
#define IS_RX2(P) (P == P0_11)
|
#define IS_RX2(P) (P == P0_11)
|
||||||
#if IS_TX2(X2_ENABLE_PIN) || IS_RX2(X2_DIR_PIN) || IS_RX2(X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
|
#define _IS_TX2_1 IS_TX2
|
||||||
|
#define _IS_RX2_1 IS_RX2
|
||||||
|
#if IS_TX2(X2_ENABLE_PIN) || ANY_RX(2, X2_DIR_PIN, X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
|
||||||
#error "Serial port pins (2) conflict with X2 pins!"
|
#error "Serial port pins (2) conflict with X2 pins!"
|
||||||
#elif IS_TX2(Y2_ENABLE_PIN) || IS_RX2(Y2_DIR_PIN) || IS_RX2(Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
|
#elif IS_TX2(Y2_ENABLE_PIN) || ANY_RX(2, Y2_DIR_PIN, Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
|
||||||
#error "Serial port pins (2) conflict with Y2 pins!"
|
#error "Serial port pins (2) conflict with Y2 pins!"
|
||||||
#elif IS_TX2(Z2_ENABLE_PIN) || IS_RX2(Z2_DIR_PIN) || IS_RX2(Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
|
#elif IS_TX2(Z2_ENABLE_PIN) || ANY_RX(2, Z2_DIR_PIN, Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
|
||||||
#error "Serial port pins (2) conflict with Z2 pins!"
|
#error "Serial port pins (2) conflict with Z2 pins!"
|
||||||
#elif IS_TX2(Z3_ENABLE_PIN) || IS_RX2(Z3_DIR_PIN) || IS_RX2(Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
|
#elif IS_TX2(Z3_ENABLE_PIN) || ANY_RX(2, Z3_DIR_PIN, Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
|
||||||
#error "Serial port pins (2) conflict with Z3 pins!"
|
#error "Serial port pins (2) conflict with Z3 pins!"
|
||||||
#elif IS_TX2(Z4_ENABLE_PIN) || IS_RX2(Z4_DIR_PIN) || IS_RX2(Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
|
#elif IS_TX2(Z4_ENABLE_PIN) || ANY_RX(2, Z4_DIR_PIN, Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
|
||||||
#error "Serial port pins (2) conflict with Z4 pins!"
|
#error "Serial port pins (2) conflict with Z4 pins!"
|
||||||
#elif IS_RX2(X_DIR_PIN) || IS_RX2(Y_DIR_PIN)
|
#elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
|
||||||
#error "Serial port pins (2) conflict with other pins!"
|
#error "Serial port pins (2) conflict with other pins!"
|
||||||
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
|
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
|
||||||
#error "Serial port pins (2) conflict with Y endstop pin!"
|
#error "Serial port pins (2) conflict with Y endstop pin!"
|
||||||
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
|
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
|
||||||
#error "Serial port pins (2) conflict with probe pin!"
|
#error "Serial port pins (2) conflict with probe pin!"
|
||||||
#elif IS_TX2(X_ENABLE_PIN) || IS_RX2(X_DIR_PIN) || IS_TX2(Y_ENABLE_PIN) || IS_RX2(Y_DIR_PIN)
|
#elif ANY_TX(2, X_ENABLE_PIN, Y_ENABLE_PIN) || ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
|
||||||
#error "Serial port pins (2) conflict with X/Y stepper pins!"
|
#error "Serial port pins (2) conflict with X/Y stepper pins!"
|
||||||
#elif EXTRUDERS > 1 && (IS_TX2(E1_ENABLE_PIN) || (AXIS_HAS_SPI(E1) && IS_TX2(E1_CS_PIN)))
|
#elif HAS_MULTI_EXTRUDER && (IS_TX2(E1_ENABLE_PIN) || (AXIS_HAS_SPI(E1) && IS_TX2(E1_CS_PIN)))
|
||||||
#error "Serial port pins (2) conflict with E1 stepper pins!"
|
#error "Serial port pins (2) conflict with E1 stepper pins!"
|
||||||
#elif EXTRUDERS && (IS_RX2(E0_DIR_PIN) || IS_RX2(E0_STEP_PIN))
|
#elif EXTRUDERS && ANY_RX(2, E0_DIR_PIN, E0_STEP_PIN)
|
||||||
#error "Serial port pins (2) conflict with E stepper pins!"
|
#error "Serial port pins (2) conflict with E stepper pins!"
|
||||||
#endif
|
#endif
|
||||||
#undef IS_TX2
|
#undef IS_TX2
|
||||||
#undef IS_RX2
|
#undef IS_RX2
|
||||||
|
#undef _IS_TX2_1
|
||||||
|
#undef _IS_RX2_1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
#if USING_SERIAL_3
|
||||||
#define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
|
#define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
|
||||||
#define PIN_IS_RX3(P) (P##_PIN == P0_01)
|
#define PIN_IS_RX3(P) (P##_PIN == P0_01)
|
||||||
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
|
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
|
||||||
#error "Serial port pins (3) conflict with X endstop pins!"
|
#error "Serial port pins (3) conflict with X endstop pins!"
|
||||||
#elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) \
|
#elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) || PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
|
||||||
|| PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
|
|
||||||
#error "Serial port pins (3) conflict with X/Y axis UART pins!"
|
#error "Serial port pins (3) conflict with X/Y axis UART pins!"
|
||||||
#elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
|
#elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
|
||||||
#error "Serial port pins (3) conflict with X2 pins!"
|
#error "Serial port pins (3) conflict with X2 pins!"
|
||||||
|
|
@ -168,13 +178,16 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
#error "Serial port pins (3) conflict with Z3 pins!"
|
#error "Serial port pins (3) conflict with Z3 pins!"
|
||||||
#elif PIN_IS_TX3(Z4_DIR) || PIN_IS_RX3(Z4_STEP)
|
#elif PIN_IS_TX3(Z4_DIR) || PIN_IS_RX3(Z4_STEP)
|
||||||
#error "Serial port pins (3) conflict with Z4 pins!"
|
#error "Serial port pins (3) conflict with Z4 pins!"
|
||||||
#elif EXTRUDERS > 1 && (PIN_IS_TX3(E1_DIR) || PIN_IS_RX3(E1_STEP))
|
#elif HAS_MULTI_EXTRUDER && (PIN_IS_TX3(E1_DIR) || PIN_IS_RX3(E1_STEP))
|
||||||
#error "Serial port pins (3) conflict with E1 pins!"
|
#error "Serial port pins (3) conflict with E1 pins!"
|
||||||
#endif
|
#endif
|
||||||
#undef PIN_IS_TX3
|
#undef PIN_IS_TX3
|
||||||
#undef PIN_IS_RX3
|
#undef PIN_IS_RX3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef ANY_TX
|
||||||
|
#undef ANY_RX
|
||||||
|
|
||||||
//
|
//
|
||||||
// Flag any i2c pin conflicts
|
// Flag any i2c pin conflicts
|
||||||
//
|
//
|
||||||
|
|
@ -214,7 +227,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
#error "One or more i2c (1) pins overlaps with Z3 pins! Disable i2c peripherals."
|
#error "One or more i2c (1) pins overlaps with Z3 pins! Disable i2c peripherals."
|
||||||
#elif PIN_IS_SDA1(Z4_DIR) || PIN_IS_SCL1(Z4_STEP)
|
#elif PIN_IS_SDA1(Z4_DIR) || PIN_IS_SCL1(Z4_STEP)
|
||||||
#error "One or more i2c (1) pins overlaps with Z4 pins! Disable i2c peripherals."
|
#error "One or more i2c (1) pins overlaps with Z4 pins! Disable i2c peripherals."
|
||||||
#elif EXTRUDERS > 1 && (PIN_IS_SDA1(E1_DIR) || PIN_IS_SCL1(E1_STEP))
|
#elif HAS_MULTI_EXTRUDER && (PIN_IS_SDA1(E1_DIR) || PIN_IS_SCL1(E1_STEP))
|
||||||
#error "One or more i2c (1) pins overlaps with E1 pins! Disable i2c peripherals."
|
#error "One or more i2c (1) pins overlaps with E1 pins! Disable i2c peripherals."
|
||||||
#endif
|
#endif
|
||||||
#undef PIN_IS_SDA1
|
#undef PIN_IS_SDA1
|
||||||
|
|
@ -240,9 +253,9 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
#error "i2c SDA2 overlaps with Z3 enable pin! Disable i2c peripherals."
|
#error "i2c SDA2 overlaps with Z3 enable pin! Disable i2c peripherals."
|
||||||
#elif PIN_IS_SDA2(Z4_ENABLE)
|
#elif PIN_IS_SDA2(Z4_ENABLE)
|
||||||
#error "i2c SDA2 overlaps with Z4 enable pin! Disable i2c peripherals."
|
#error "i2c SDA2 overlaps with Z4 enable pin! Disable i2c peripherals."
|
||||||
#elif EXTRUDERS > 1 && PIN_IS_SDA2(E1_ENABLE)
|
#elif HAS_MULTI_EXTRUDER && PIN_IS_SDA2(E1_ENABLE)
|
||||||
#error "i2c SDA2 overlaps with E1 enable pin! Disable i2c peripherals."
|
#error "i2c SDA2 overlaps with E1 enable pin! Disable i2c peripherals."
|
||||||
#elif EXTRUDERS > 1 && AXIS_HAS_SPI(E1) && PIN_IS_SDA2(E1_CS)
|
#elif HAS_MULTI_EXTRUDER && AXIS_HAS_SPI(E1) && PIN_IS_SDA2(E1_CS)
|
||||||
#error "i2c SDA2 overlaps with E1 CS pin! Disable i2c peripherals."
|
#error "i2c SDA2 overlaps with E1 CS pin! Disable i2c peripherals."
|
||||||
#elif EXTRUDERS && (PIN_IS_SDA2(E0_STEP) || PIN_IS_SDA2(E0_DIR))
|
#elif EXTRUDERS && (PIN_IS_SDA2(E0_STEP) || PIN_IS_SDA2(E0_DIR))
|
||||||
#error "i2c SCL2 overlaps with E0 STEP/DIR pin! Disable i2c peripherals."
|
#error "i2c SCL2 overlaps with E0 STEP/DIR pin! Disable i2c peripherals."
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "../../core/macros.h"
|
#include "../../core/macros.h"
|
||||||
|
|
||||||
#if BOTH(SDSUPPORT, HAS_GRAPHICAL_LCD) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
#if BOTH(SDSUPPORT, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
|
||||||
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||||
// needed due to the speed and mode required for communicating with each device being different.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
// This requirement can be removed if the SPI access to these devices is updated to use
|
// This requirement can be removed if the SPI access to these devices is updated to use
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* HAL For LPC1768
|
* HAL For LPC1768
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
#include "../../shared/HAL_SPI.h"
|
#include "../../shared/HAL_SPI.h"
|
||||||
|
|
@ -124,6 +124,6 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#endif // TARGET_LPC1768
|
#endif // TARGET_LPC1768
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
|
|
||||||
|
|
@ -193,6 +193,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#endif // TARGET_LPC1768
|
#endif // TARGET_LPC1768
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
#include "../../shared/HAL_SPI.h"
|
#include "../../shared/HAL_SPI.h"
|
||||||
|
|
@ -133,6 +133,6 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
|
|
||||||
#endif // TARGET_LPC1768
|
#endif // TARGET_LPC1768
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD && DISABLED(U8GLIB_ST7920)
|
#if HAS_MARLINUI_U8GLIB && DISABLED(U8GLIB_ST7920)
|
||||||
|
|
||||||
#include <SoftwareSPI.h>
|
#include <SoftwareSPI.h>
|
||||||
|
|
||||||
|
|
@ -203,5 +203,5 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD && !U8GLIB_ST7920
|
#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
|
||||||
#endif // TARGET_LPC1768
|
#endif // TARGET_LPC1768
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
|
|
||||||
#include "../../feature/e_parser.h"
|
#include "../../feature/e_parser.h"
|
||||||
|
|
||||||
EmergencyParser::State emergency_state;
|
EmergencyParser::State emergency_state;
|
||||||
|
|
||||||
bool CDC_RecvCallback(const char buffer) {
|
bool CDC_RecvCallback(const char buffer) {
|
||||||
emergency_parser.update(emergency_state, buffer);
|
emergency_parser.update(emergency_state, buffer);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -35,58 +35,34 @@
|
||||||
|
|
||||||
// MYSERIAL0 required before MarlinSerial includes!
|
// MYSERIAL0 required before MarlinSerial includes!
|
||||||
|
|
||||||
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 Serial
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial4
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 Serial
|
#define MYSERIAL1 Serial
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 3)
|
||||||
#define MYSERIAL1 Serial1
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 Serial2
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 Serial3
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 Serial4
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == SERIAL_PORT
|
#if LCD_SERIAL_PORT == -1
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
#define LCD_SERIAL Serial
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
#elif DGUS_SERIAL_PORT == -1
|
|
||||||
#define DGUS_SERIAL Serial
|
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
|
||||||
#define DGUS_SERIAL Serial1
|
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
|
||||||
#define DGUS_SERIAL Serial2
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL Serial3
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL Serial4
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -112,6 +88,8 @@ typedef int8_t pin_t;
|
||||||
void HAL_clear_reset_source(); // clear reset reason
|
void HAL_clear_reset_source(); // clear reset reason
|
||||||
uint8_t HAL_get_reset_source(); // get reset reason
|
uint8_t HAL_get_reset_source(); // get reset reason
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADC
|
// ADC
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "QSPIFlash.h"
|
#include "QSPIFlash.h"
|
||||||
|
|
||||||
#define INVALID_ADDR 0xffffffff
|
#define INVALID_ADDR 0xFFFFFFFF
|
||||||
#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1))
|
#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1))
|
||||||
#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1))
|
#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
*
|
||||||
* Derived from Adafruit_SPIFlash class with no SdFat references
|
* Derived from Adafruit_SPIFlash class with no SdFat references
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -150,5 +150,4 @@ void pwm_details(int32_t pin) {
|
||||||
* 93 | PA10 | QSPI: IO2
|
* 93 | PA10 | QSPI: IO2
|
||||||
* 94 | PA11 | QSPI: IO3
|
* 94 | PA11 | QSPI: IO3
|
||||||
* 95 | PB31 | SD: DETECT
|
* 95 | PB31 | SD: DETECT
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ uint16_t HAL_adc_result;
|
||||||
void HAL_init() {
|
void HAL_init() {
|
||||||
FastIO_init();
|
FastIO_init();
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT)
|
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1)
|
||||||
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -122,9 +122,14 @@ extern "C" {
|
||||||
|
|
||||||
// TODO: Make sure this doesn't cause any delay
|
// TODO: Make sure this doesn't cause any delay
|
||||||
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
|
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
|
||||||
|
|
||||||
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
||||||
|
|
||||||
|
// Reset the system (to initiate a firmware flash)
|
||||||
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
|
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
|
||||||
|
|
||||||
|
// Maple Compatibility
|
||||||
|
systickCallback_t systick_user_callback;
|
||||||
|
void systick_attach_callback(systickCallback_t cb) { systick_user_callback = cb; }
|
||||||
|
void HAL_SYSTICK_Callback() { if (systick_user_callback) systick_user_callback(); }
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||||
|
|
|
||||||
|
|
@ -43,83 +43,40 @@
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Defines
|
// Defines
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
#define _MSERIAL(X) MSerial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
|
||||||
#if SERIAL_PORT == 0
|
#if SERIAL_PORT == -1
|
||||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
|
||||||
#elif SERIAL_PORT == -1
|
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 1
|
#elif WITHIN(SERIAL_PORT, 1, 6)
|
||||||
#define MYSERIAL0 MSerial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 MSerial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 MSerial3
|
|
||||||
#elif SERIAL_PORT == 4
|
|
||||||
#define MYSERIAL0 MSerial4
|
|
||||||
#elif SERIAL_PORT == 5
|
|
||||||
#define MYSERIAL0 MSerial5
|
|
||||||
#elif SERIAL_PORT == 6
|
|
||||||
#define MYSERIAL0 MSerial6
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
#error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#define NUM_SERIAL 2
|
#if SERIAL_PORT_2 == -1
|
||||||
#if SERIAL_PORT_2 == 0
|
|
||||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 SerialUSB
|
#define MYSERIAL1 SerialUSB
|
||||||
#elif SERIAL_PORT_2 == 1
|
#elif WITHIN(SERIAL_PORT_2, 1, 6)
|
||||||
#define MYSERIAL1 MSerial1
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 MSerial2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 MSerial3
|
|
||||||
#elif SERIAL_PORT_2 == 4
|
|
||||||
#define MYSERIAL1 MSerial4
|
|
||||||
#elif SERIAL_PORT_2 == 5
|
|
||||||
#define MYSERIAL1 MSerial5
|
|
||||||
#elif SERIAL_PORT_2 == 6
|
|
||||||
#define MYSERIAL1 MSerial6
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
#error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DGUS_LCD
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if DGUS_SERIAL_PORT == 0
|
#if LCD_SERIAL_PORT == -1
|
||||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#define LCD_SERIAL SerialUSB
|
||||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
#elif WITHIN(LCD_SERIAL_PORT, 1, 6)
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
|
||||||
#elif DGUS_SERIAL_PORT == -1
|
|
||||||
#define DGUS_SERIAL SerialUSB
|
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
|
||||||
#define DGUS_SERIAL MSerial1
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL MSerial2
|
|
||||||
#elif DGUS_SERIAL_PORT == 3
|
|
||||||
#define DGUS_SERIAL MSerial3
|
|
||||||
#elif DGUS_SERIAL_PORT == 4
|
|
||||||
#define DGUS_SERIAL MSerial4
|
|
||||||
#elif DGUS_SERIAL_PORT == 5
|
|
||||||
#define DGUS_SERIAL MSerial5
|
|
||||||
#elif DGUS_SERIAL_PORT == 6
|
|
||||||
#define DGUS_SERIAL MSerial6
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
#error "LCD_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
|
||||||
|
#endif
|
||||||
|
#if HAS_DGUS_LCD
|
||||||
|
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: review this to return 1 for pins that are not analog input
|
* TODO: review this to return 1 for pins that are not analog input
|
||||||
*/
|
*/
|
||||||
|
|
@ -177,6 +134,8 @@ void HAL_clear_reset_source();
|
||||||
// Reset reason
|
// Reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(const int delay);
|
void _delay_ms(const int delay);
|
||||||
|
|
||||||
extern "C" char* _sbrk(int incr);
|
extern "C" char* _sbrk(int incr);
|
||||||
|
|
@ -220,3 +179,8 @@ uint16_t HAL_adc_get_result();
|
||||||
|
|
||||||
#define PLATFORM_M997_SUPPORT
|
#define PLATFORM_M997_SUPPORT
|
||||||
void flashFirmware(const int16_t);
|
void flashFirmware(const int16_t);
|
||||||
|
|
||||||
|
// Maple Compatibility
|
||||||
|
typedef void (*systickCallback_t)(void);
|
||||||
|
void systick_attach_callback(systickCallback_t cb);
|
||||||
|
void HAL_SYSTICK_Callback();
|
||||||
|
|
|
||||||
|
|
@ -132,11 +132,9 @@ static SPISettings spiConfig;
|
||||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||||
*/
|
*/
|
||||||
void spiBegin() {
|
void spiBegin() {
|
||||||
#if !PIN_EXISTS(SS)
|
#if PIN_EXISTS(SS)
|
||||||
#error "SS_PIN not defined!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OUT_WRITE(SS_PIN, HIGH);
|
OUT_WRITE(SS_PIN, HIGH);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure SPI for specified SPI speed
|
// Configure SPI for specified SPI speed
|
||||||
|
|
@ -173,9 +171,7 @@ static SPISettings spiConfig;
|
||||||
* @details
|
* @details
|
||||||
*/
|
*/
|
||||||
uint8_t spiRec() {
|
uint8_t spiRec() {
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
uint8_t returnByte = SPI.transfer(0xFF);
|
uint8_t returnByte = SPI.transfer(0xFF);
|
||||||
SPI.endTransaction();
|
|
||||||
return returnByte;
|
return returnByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,9 +187,7 @@ static SPISettings spiConfig;
|
||||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||||
if (nbyte == 0) return;
|
if (nbyte == 0) return;
|
||||||
memset(buf, 0xFF, nbyte);
|
memset(buf, 0xFF, nbyte);
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
SPI.transfer(buf, nbyte);
|
SPI.transfer(buf, nbyte);
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -204,9 +198,7 @@ static SPISettings spiConfig;
|
||||||
* @details
|
* @details
|
||||||
*/
|
*/
|
||||||
void spiSend(uint8_t b) {
|
void spiSend(uint8_t b) {
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
SPI.transfer(b);
|
SPI.transfer(b);
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -219,10 +211,8 @@ static SPISettings spiConfig;
|
||||||
*/
|
*/
|
||||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||||
uint8_t rxBuf[512];
|
uint8_t rxBuf[512];
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
SPI.transfer(token);
|
SPI.transfer(token);
|
||||||
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SOFTWARE_SPI
|
#endif // SOFTWARE_SPI
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@
|
||||||
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT_2)
|
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT_2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT >= 0
|
#if defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT >= 0
|
||||||
DECLARE_SERIAL_PORT_EXP(DGUS_SERIAL_PORT)
|
DECLARE_SERIAL_PORT_EXP(LCD_SERIAL_PORT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MarlinSerial::begin(unsigned long baud, uint8_t config) {
|
void MarlinSerial::begin(unsigned long baud, uint8_t config) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,10 @@ public:
|
||||||
#endif
|
#endif
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
|
static inline bool emergency_parser_enabled() { return true; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void begin(unsigned long baud, uint8_t config);
|
void begin(unsigned long baud, uint8_t config);
|
||||||
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
|
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,19 +51,19 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||||
|
|
||||||
#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
|
#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
|
||||||
#define _WRITE(IO, V) do { \
|
#define _WRITE(IO, V) do { \
|
||||||
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(digitalPinToPinName(IO) & 0x1F) ; \
|
||||||
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(digitalPinToPinName(IO) & 0x1F) ; \
|
||||||
}while(0)
|
}while(0)
|
||||||
#else
|
#else
|
||||||
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + ((V) ? 0 : 16)))
|
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(digitalPinToPinName(IO) + ((V) ? 0 : 16)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO]))))
|
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(digitalPinToPinName(IO) & 0x1F)))
|
||||||
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO])))
|
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(digitalPinToPinName(IO) & 0x1F))
|
||||||
|
|
||||||
#define _GET_MODE(IO)
|
#define _GET_MODE(IO)
|
||||||
#define _SET_MODE(IO,M) pinMode(IO, M)
|
#define _SET_MODE(IO,M) pinMode(IO, M)
|
||||||
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
|
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) //!< Output Push Pull Mode & GPIO_NOPULL
|
||||||
#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
|
#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
|
||||||
|
|
||||||
#define WRITE(IO,V) _WRITE(IO,V)
|
#define WRITE(IO,V) _WRITE(IO,V)
|
||||||
|
|
@ -73,9 +73,9 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||||
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||||
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
||||||
|
|
||||||
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
|
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) //!< Input Floating Mode
|
||||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
|
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) //!< Input with Pull-up activation
|
||||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
|
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) //!< Input with Pull-down activation
|
||||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||||
#define SET_PWM(IO) _SET_MODE(IO, PWM)
|
#define SET_PWM(IO) _SET_MODE(IO, PWM)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ static inline void pwm_details(const pin_t pin) {
|
||||||
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
||||||
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||||
const char num = (
|
const char num = (
|
||||||
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
|
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||||
tdev == &timer8 ? '8' :
|
tdev == &timer8 ? '8' :
|
||||||
tdev == &timer5 ? '5' :
|
tdev == &timer5 ? '5' :
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ void TFT_FSMC::Init() {
|
||||||
|
|
||||||
__HAL_RCC_FSMC_CLK_ENABLE();
|
__HAL_RCC_FSMC_CLK_ENABLE();
|
||||||
|
|
||||||
for(uint16_t i = 0; PinMap_FSMC[i].pin != NC; i++)
|
for (uint16_t i = 0; PinMap_FSMC[i].pin != NC; i++)
|
||||||
pinmap_pinout(PinMap_FSMC[i].pin, PinMap_FSMC);
|
pinmap_pinout(PinMap_FSMC[i].pin, PinMap_FSMC);
|
||||||
pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
|
pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
|
||||||
pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS);
|
pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS);
|
||||||
|
|
|
||||||
|
|
@ -155,9 +155,9 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
|
||||||
|
|
||||||
uint16_t XPT2046::HardwareIO(uint16_t data) {
|
uint16_t XPT2046::HardwareIO(uint16_t data) {
|
||||||
__HAL_SPI_ENABLE(&SPIx);
|
__HAL_SPI_ENABLE(&SPIx);
|
||||||
while((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
|
while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
|
||||||
SPIx.Instance->DR = data;
|
SPIx.Instance->DR = data;
|
||||||
while((SPIx.Instance->SR & SPI_FLAG_RXNE) != SPI_FLAG_RXNE) {}
|
while ((SPIx.Instance->SR & SPI_FLAG_RXNE) != SPI_FLAG_RXNE) {}
|
||||||
__HAL_SPI_DISABLE(&SPIx);
|
__HAL_SPI_DISABLE(&SPIx);
|
||||||
|
|
||||||
return SPIx.Instance->DR;
|
return SPIx.Instance->DR;
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,9 @@ const uint8_t adc_pins[] = {
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
TEMP_0_PIN,
|
TEMP_0_PIN,
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_TEMP_ADC_PROBE
|
||||||
|
TEMP_PROBE_PIN,
|
||||||
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
TEMP_BED_PIN,
|
TEMP_BED_PIN,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -151,6 +154,9 @@ enum TempPinIndex : char {
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
TEMP_0,
|
TEMP_0,
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_TEMP_ADC_PROBE
|
||||||
|
TEMP_PROBE,
|
||||||
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
TEMP_BED,
|
TEMP_BED,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -341,6 +347,9 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
case TEMP_0_PIN: pin_index = TEMP_0; break;
|
case TEMP_0_PIN: pin_index = TEMP_0; break;
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_TEMP_ADC_PROBE
|
||||||
|
case TEMP_PROBE_PIN: pin_index = TEMP_PROBE; break;
|
||||||
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
case TEMP_BED_PIN: pin_index = TEMP_BED; break;
|
case TEMP_BED_PIN: pin_index = TEMP_BED; break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#ifndef STM32_FLASH_SIZE
|
#ifndef STM32_FLASH_SIZE
|
||||||
#if defined(MCU_STM32F103RE) || defined(MCU_STM32F103VE)
|
#if EITHER(MCU_STM32F103RE, MCU_STM32F103VE)
|
||||||
#define STM32_FLASH_SIZE 512
|
#define STM32_FLASH_SIZE 512
|
||||||
#else
|
#else
|
||||||
#define STM32_FLASH_SIZE 256
|
#define STM32_FLASH_SIZE 256
|
||||||
|
|
@ -68,73 +68,48 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERIAL_PORT == 0
|
#define _MSERIAL(X) MSerial##X
|
||||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
#elif SERIAL_PORT == -1
|
|
||||||
#define MYSERIAL0 UsbSerial
|
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||||
#elif SERIAL_PORT == 1
|
#define NUM_UARTS 5
|
||||||
#define MYSERIAL0 MSerial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 MSerial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 MSerial3
|
|
||||||
#elif SERIAL_PORT == 4
|
|
||||||
#define MYSERIAL0 MSerial4
|
|
||||||
#elif SERIAL_PORT == 5
|
|
||||||
#define MYSERIAL0 MSerial5
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 5. Please update your configuration."
|
#define NUM_UARTS 3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SERIAL_PORT == -1
|
||||||
|
#define MYSERIAL0 UsbSerial
|
||||||
|
#elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
|
||||||
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
|
#elif NUM_UARTS == 5
|
||||||
|
#error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
|
||||||
|
#else
|
||||||
|
#error "SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == 0
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 UsbSerial
|
#define MYSERIAL1 UsbSerial
|
||||||
#elif SERIAL_PORT_2 == 1
|
#elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
|
||||||
#define MYSERIAL1 MSerial1
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 2
|
#elif NUM_UARTS == 5
|
||||||
#define MYSERIAL1 MSerial2
|
#error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration."
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 MSerial3
|
|
||||||
#elif SERIAL_PORT_2 == 4
|
|
||||||
#define MYSERIAL1 MSerial4
|
|
||||||
#elif SERIAL_PORT_2 == 5
|
|
||||||
#define MYSERIAL1 MSerial5
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
|
#error "SERIAL_PORT_2 must be -1 or from 1 to 3. Please update your configuration."
|
||||||
#endif
|
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL
|
|
||||||
#if DGUS_SERIAL_PORT == 0
|
|
||||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
|
||||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
|
||||||
#elif DGUS_SERIAL_PORT == -1
|
|
||||||
#define DGUS_SERIAL UsbSerial
|
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
|
||||||
#define DGUS_SERIAL MSerial1
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL MSerial2
|
|
||||||
#elif DGUS_SERIAL_PORT == 3
|
|
||||||
#define DGUS_SERIAL MSerial3
|
|
||||||
#elif DGUS_SERIAL_PORT == 4
|
|
||||||
#define DGUS_SERIAL MSerial4
|
|
||||||
#elif DGUS_SERIAL_PORT == 5
|
|
||||||
#define DGUS_SERIAL MSerial5
|
|
||||||
#else
|
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 5. Please update your configuration."
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LCD_SERIAL_PORT
|
||||||
|
#if LCD_SERIAL_PORT == -1
|
||||||
|
#define LCD_SERIAL UsbSerial
|
||||||
|
#elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS)
|
||||||
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
|
#elif NUM_UARTS == 5
|
||||||
|
#error "LCD_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
|
||||||
|
#else
|
||||||
|
#error "LCD_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set interrupt grouping for this MCU
|
// Set interrupt grouping for this MCU
|
||||||
void HAL_init();
|
void HAL_init();
|
||||||
|
|
@ -210,6 +185,8 @@ void HAL_clear_reset_source();
|
||||||
// Reset reason
|
// Reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(const int delay);
|
void _delay_ms(const int delay);
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,6 @@
|
||||||
/**
|
/**
|
||||||
* Software SPI functions originally from Arduino Sd2Card Library
|
* Software SPI functions originally from Arduino Sd2Card Library
|
||||||
* Copyright (c) 2009 by William Greiman
|
* Copyright (c) 2009 by William Greiman
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapted to the STM32F1 HAL
|
* Adapted to the STM32F1 HAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -113,7 +110,7 @@ void spiInit(uint8_t spiRate) {
|
||||||
* @details
|
* @details
|
||||||
*/
|
*/
|
||||||
uint8_t spiRec() {
|
uint8_t spiRec() {
|
||||||
uint8_t returnByte = SPI.transfer(ff);
|
uint8_t returnByte = SPI.transfer(0xFF);
|
||||||
return returnByte;
|
return returnByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,7 +154,7 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||||
#if ENABLED(SPI_EEPROM)
|
#if ENABLED(SPI_EEPROM)
|
||||||
|
|
||||||
// Read single byte from specified SPI channel
|
// Read single byte from specified SPI channel
|
||||||
uint8_t spiRec(uint32_t chan) { return SPI.transfer(ff); }
|
uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); }
|
||||||
|
|
||||||
// Write single byte to specified SPI channel
|
// Write single byte to specified SPI channel
|
||||||
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
|
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#ifdef __STM32F1__
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
#include <libmaple/usart.h>
|
#include <libmaple/usart.h>
|
||||||
|
|
||||||
|
|
@ -53,6 +53,7 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb
|
||||||
rb_push_insert(rb, c);
|
rb_push_insert(rb, c);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
|
if (serial.emergency_parser_enabled())
|
||||||
emergency_parser.update(serial.emergency_state, c);
|
emergency_parser.update(serial.emergency_state, c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -73,10 +74,27 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not every MarlinSerial port should handle emergency parsing.
|
||||||
|
// It would not make sense to parse GCode from TMC responses, for example.
|
||||||
|
constexpr bool serial_handles_emergency(int port) {
|
||||||
|
return false
|
||||||
|
#ifdef SERIAL_PORT
|
||||||
|
|| (SERIAL_PORT) == port
|
||||||
|
#endif
|
||||||
|
#ifdef SERIAL_PORT_2
|
||||||
|
|| (SERIAL_PORT_2) == port
|
||||||
|
#endif
|
||||||
|
#ifdef LCD_SERIAL_PORT
|
||||||
|
|| (LCD_SERIAL_PORT) == port
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
#define DEFINE_HWSERIAL_MARLIN(name, n) \
|
#define DEFINE_HWSERIAL_MARLIN(name, n) \
|
||||||
MarlinSerial name(USART##n, \
|
MarlinSerial name(USART##n, \
|
||||||
BOARD_USART##n##_TX_PIN, \
|
BOARD_USART##n##_TX_PIN, \
|
||||||
BOARD_USART##n##_RX_PIN); \
|
BOARD_USART##n##_RX_PIN, \
|
||||||
|
serial_handles_emergency(n)); \
|
||||||
extern "C" void __irq_usart##n(void) { \
|
extern "C" void __irq_usart##n(void) { \
|
||||||
my_usart_irq(USART##n->rb, USART##n->wb, USART##n##_BASE, MSerial##n); \
|
my_usart_irq(USART##n->rb, USART##n->wb, USART##n##_BASE, MSerial##n); \
|
||||||
}
|
}
|
||||||
|
|
@ -84,29 +102,92 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb
|
||||||
#define DEFINE_HWSERIAL_UART_MARLIN(name, n) \
|
#define DEFINE_HWSERIAL_UART_MARLIN(name, n) \
|
||||||
MarlinSerial name(UART##n, \
|
MarlinSerial name(UART##n, \
|
||||||
BOARD_USART##n##_TX_PIN, \
|
BOARD_USART##n##_TX_PIN, \
|
||||||
BOARD_USART##n##_RX_PIN); \
|
BOARD_USART##n##_RX_PIN, \
|
||||||
|
serial_handles_emergency(n)); \
|
||||||
extern "C" void __irq_usart##n(void) { \
|
extern "C" void __irq_usart##n(void) { \
|
||||||
my_usart_irq(USART##n->rb, USART##n->wb, USART##n##_BASE, MSerial##n); \
|
my_usart_irq(UART##n->rb, UART##n->wb, UART##n##_BASE, MSerial##n); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
// Instantiate all UARTs even if they are not needed
|
||||||
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
|
// This avoids a bunch of logic to figure out every serial
|
||||||
#endif
|
// port which may be in use on the system.
|
||||||
|
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
|
||||||
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
|
||||||
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
|
DEFINE_HWSERIAL_MARLIN(MSerial3, 3);
|
||||||
#endif
|
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||||
|
|
||||||
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
|
||||||
DEFINE_HWSERIAL_MARLIN(MSerial3, 3);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SERIAL_PORT == 4 || SERIAL_PORT_2 == 4 || DGUS_SERIAL_PORT == 4
|
|
||||||
DEFINE_HWSERIAL_UART_MARLIN(MSerial4, 4);
|
DEFINE_HWSERIAL_UART_MARLIN(MSerial4, 4);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SERIAL_PORT == 5 || SERIAL_PORT_2 == 5 || DGUS_SERIAL_PORT == 5
|
|
||||||
DEFINE_HWSERIAL_UART_MARLIN(MSerial5, 5);
|
DEFINE_HWSERIAL_UART_MARLIN(MSerial5, 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Check the type of each serial port by passing it to a template function.
|
||||||
|
// HardwareSerial is known to sometimes hang the controller when an error occurs,
|
||||||
|
// so this case will fail the static assert. All other classes are assumed to be ok.
|
||||||
|
template <typename T>
|
||||||
|
constexpr bool IsSerialClassAllowed(const T&) { return true; }
|
||||||
|
constexpr bool IsSerialClassAllowed(const HardwareSerial&) { return false; }
|
||||||
|
|
||||||
|
#define CHECK_CFG_SERIAL(A) static_assert(IsSerialClassAllowed(A), STRINGIFY(A) " is defined incorrectly");
|
||||||
|
#define CHECK_AXIS_SERIAL(A) static_assert(IsSerialClassAllowed(A##_HARDWARE_SERIAL), STRINGIFY(A) "_HARDWARE_SERIAL must be defined in the form MSerial1, rather than Serial1");
|
||||||
|
|
||||||
|
// If you encounter this error, replace SerialX with MSerialX, for example MSerial3.
|
||||||
|
|
||||||
|
// Non-TMC ports were already validated in HAL.h, so do not require verbose error messages.
|
||||||
|
#ifdef MYSERIAL0
|
||||||
|
CHECK_CFG_SERIAL(MYSERIAL0);
|
||||||
|
#endif
|
||||||
|
#ifdef MYSERIAL1
|
||||||
|
CHECK_CFG_SERIAL(MYSERIAL1);
|
||||||
|
#endif
|
||||||
|
#ifdef LCD_SERIAL
|
||||||
|
CHECK_CFG_SERIAL(LCD_SERIAL);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(X)
|
||||||
|
CHECK_AXIS_SERIAL(X);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(X2)
|
||||||
|
CHECK_AXIS_SERIAL(X2);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(Y)
|
||||||
|
CHECK_AXIS_SERIAL(Y);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(Y2)
|
||||||
|
CHECK_AXIS_SERIAL(Y2);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(Z)
|
||||||
|
CHECK_AXIS_SERIAL(Z);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(Z2)
|
||||||
|
CHECK_AXIS_SERIAL(Z2);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(Z3)
|
||||||
|
CHECK_AXIS_SERIAL(Z3);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(Z4)
|
||||||
|
CHECK_AXIS_SERIAL(Z4);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E0)
|
||||||
|
CHECK_AXIS_SERIAL(E0);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E1)
|
||||||
|
CHECK_AXIS_SERIAL(E1);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E2)
|
||||||
|
CHECK_AXIS_SERIAL(E2);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E3)
|
||||||
|
CHECK_AXIS_SERIAL(E3);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E4)
|
||||||
|
CHECK_AXIS_SERIAL(E4);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E5)
|
||||||
|
CHECK_AXIS_SERIAL(E5);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E6)
|
||||||
|
CHECK_AXIS_SERIAL(E6);
|
||||||
|
#endif
|
||||||
|
#if AXIS_HAS_HW_SERIAL(E7)
|
||||||
|
CHECK_AXIS_SERIAL(E7);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __STM32F1__
|
#endif // __STM32F1__
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,27 @@
|
||||||
#include "../../feature/e_parser.h"
|
#include "../../feature/e_parser.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Increase priority of serial interrupts, to reduce overflow errors
|
||||||
#define UART_IRQ_PRIO 1
|
#define UART_IRQ_PRIO 1
|
||||||
|
|
||||||
class MarlinSerial : public HardwareSerial {
|
class MarlinSerial : public HardwareSerial {
|
||||||
public:
|
public:
|
||||||
MarlinSerial(struct usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) :
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
|
const bool ep_enabled;
|
||||||
|
EmergencyParser::State emergency_state;
|
||||||
|
inline bool emergency_parser_enabled() { return ep_enabled; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MarlinSerial(struct usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin, bool TERN_(EMERGENCY_PARSER, ep_capable)) :
|
||||||
HardwareSerial(usart_device, tx_pin, rx_pin)
|
HardwareSerial(usart_device, tx_pin, rx_pin)
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
|
, ep_enabled(ep_capable)
|
||||||
, emergency_state(EmergencyParser::State::EP_RESET)
|
, emergency_state(EmergencyParser::State::EP_RESET)
|
||||||
#endif
|
#endif
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
#ifdef UART_IRQ_PRIO
|
#ifdef UART_IRQ_PRIO
|
||||||
// shadow the parent methods to set irq priority after the begin
|
// Shadow the parent methods to set IRQ priority after begin()
|
||||||
void begin(uint32 baud) {
|
void begin(uint32 baud) {
|
||||||
MarlinSerial::begin(baud, SERIAL_8N1);
|
MarlinSerial::begin(baud, SERIAL_8N1);
|
||||||
}
|
}
|
||||||
|
|
@ -52,14 +60,12 @@ public:
|
||||||
nvic_irq_set_priority(c_dev()->irq_num, UART_IRQ_PRIO);
|
nvic_irq_set_priority(c_dev()->irq_num, UART_IRQ_PRIO);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
|
||||||
EmergencyParser::State emergency_state;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MarlinSerial MSerial1;
|
extern MarlinSerial MSerial1;
|
||||||
extern MarlinSerial MSerial2;
|
extern MarlinSerial MSerial2;
|
||||||
extern MarlinSerial MSerial3;
|
extern MarlinSerial MSerial3;
|
||||||
extern MarlinSerial MSerial4;
|
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||||
extern MarlinSerial MSerial5;
|
extern MarlinSerial MSerial4;
|
||||||
|
extern MarlinSerial MSerial5;
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if BOTH(HAS_GRAPHICAL_LCD, FORCE_SOFT_SPI)
|
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||||
|
|
||||||
#include "../HAL.h"
|
#include "../HAL.h"
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
|
|
@ -161,5 +161,5 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_GRAPHICAL_LCD
|
#endif // HAS_MARLINUI_U8GLIB
|
||||||
#endif // STM32F1
|
#endif // STM32F1
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
* with simple implementations supplied by Marlin.
|
* with simple implementations supplied by Marlin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||||
|
|
@ -79,3 +81,4 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IIC_BL24CXX_EEPROM
|
#endif // IIC_BL24CXX_EEPROM
|
||||||
|
#endif // __STM32F1__
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||||
|
|
@ -49,3 +51,4 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IIC_BL24CXX_EEPROM
|
#endif // IIC_BL24CXX_EEPROM
|
||||||
|
#endif // __STM32F1__
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,17 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL PersistentStore for STM32F1
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __STM32F1__
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if USE_WIRED_EEPROM
|
#if USE_WIRED_EEPROM
|
||||||
|
|
||||||
/**
|
|
||||||
* PersistentStore for Arduino-style EEPROM interface
|
|
||||||
* with simple implementations supplied by Marlin.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../shared/eeprom_if.h"
|
#include "../shared/eeprom_if.h"
|
||||||
#include "../shared/eeprom_api.h"
|
#include "../shared/eeprom_api.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef USE_USB_COMPOSITE
|
#if defined(__STM32F1__) && defined(USE_USB_COMPOSITE)
|
||||||
|
|
||||||
#include "msc_sd.h"
|
#include "msc_sd.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
|
|
@ -77,4 +77,4 @@ void MSC_SD_init() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_USB_COMPOSITE
|
#endif // __STM32F1__ && USE_USB_COMPOSITE
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public:
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
#if ENABLED(EMERGENCY_PARSER)
|
||||||
EmergencyParser::State emergency_state;
|
EmergencyParser::State emergency_state;
|
||||||
|
inline bool emergency_parser_enabled() { return true; }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@
|
||||||
* No restriction on use. You can use, modify and redistribute it for
|
* No restriction on use. You can use, modify and redistribute it for
|
||||||
* personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
|
* personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
|
||||||
* Redistributions of source code must retain the above copyright notice.
|
* Redistributions of source code must retain the above copyright notice.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if SD_CONNECTION_IS(ONBOARD)
|
#if SD_CONNECTION_IS(ONBOARD)
|
||||||
|
|
@ -21,23 +22,23 @@
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
|
|
||||||
#if HAS_SHARED_MEDIA
|
#if HAS_SHARED_MEDIA
|
||||||
#ifndef ON_BOARD_SPI_DEVICE
|
#ifndef ONBOARD_SPI_DEVICE
|
||||||
#define ON_BOARD_SPI_DEVICE SPI_DEVICE
|
#define ONBOARD_SPI_DEVICE SPI_DEVICE
|
||||||
#endif
|
#endif
|
||||||
#define ONBOARD_SD_SPI SPI
|
#define ONBOARD_SD_SPI SPI
|
||||||
#else
|
#else
|
||||||
SPIClass OnBoardSPI(ON_BOARD_SPI_DEVICE);
|
SPIClass OnboardSPI(ONBOARD_SPI_DEVICE);
|
||||||
#define ONBOARD_SD_SPI OnBoardSPI
|
#define ONBOARD_SD_SPI OnboardSPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ON_BOARD_SPI_DEVICE == 1
|
#if ONBOARD_SPI_DEVICE == 1
|
||||||
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_4
|
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_4
|
||||||
#else
|
#else
|
||||||
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_2
|
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CS_LOW() WRITE(ONBOARD_SD_CS_PIN, LOW) /* Set OnBoardSPI cs low */
|
#define CS_LOW() WRITE(ONBOARD_SD_CS_PIN, LOW) /* Set OnboardSPI cs low */
|
||||||
#define CS_HIGH() WRITE(ONBOARD_SD_CS_PIN, HIGH) /* Set OnBoardSPI cs high */
|
#define CS_HIGH() WRITE(ONBOARD_SD_CS_PIN, HIGH) /* Set OnboardSPI cs high */
|
||||||
|
|
||||||
#define FCLK_FAST() ONBOARD_SD_SPI.setClockDivider(SPI_CLOCK_MAX)
|
#define FCLK_FAST() ONBOARD_SD_SPI.setClockDivider(SPI_CLOCK_MAX)
|
||||||
#define FCLK_SLOW() ONBOARD_SD_SPI.setClockDivider(SPI_BAUD_PCLK_DIV_256)
|
#define FCLK_SLOW() ONBOARD_SD_SPI.setClockDivider(SPI_BAUD_PCLK_DIV_256)
|
||||||
|
|
@ -152,7 +153,7 @@ static int select() { /* 1:OK, 0:Timeout */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void power_on() { /* Enable SSP module and attach it to I/O pads */
|
static void power_on() { /* Enable SSP module and attach it to I/O pads */
|
||||||
ONBOARD_SD_SPI.setModule(ON_BOARD_SPI_DEVICE);
|
ONBOARD_SD_SPI.setModule(ONBOARD_SPI_DEVICE);
|
||||||
ONBOARD_SD_SPI.begin();
|
ONBOARD_SD_SPI.begin();
|
||||||
ONBOARD_SD_SPI.setBitOrder(MSBFIRST);
|
ONBOARD_SD_SPI.setBitOrder(MSBFIRST);
|
||||||
ONBOARD_SD_SPI.setDataMode(SPI_MODE0);
|
ONBOARD_SD_SPI.setDataMode(SPI_MODE0);
|
||||||
|
|
@ -554,3 +555,4 @@ DRESULT disk_read (
|
||||||
#endif // _DISKIO_IOCTL
|
#endif // _DISKIO_IOCTL
|
||||||
|
|
||||||
#endif // SD_CONNECTION_IS(ONBOARD)
|
#endif // SD_CONNECTION_IS(ONBOARD)
|
||||||
|
#endif // __STM32F1__
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
|
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
|
||||||
|
|
||||||
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
|
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||||
|
|
||||||
#include "sdio.h"
|
#include "sdio.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,16 @@ void TFT_FSMC::Init() {
|
||||||
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
|
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
|
||||||
uint32_t controllerAddress;
|
uint32_t controllerAddress;
|
||||||
|
|
||||||
|
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||||
|
OUT_WRITE(TFT_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(LCD_USE_DMA_FSMC)
|
||||||
|
dma_init(FSMC_DMA_DEV);
|
||||||
|
dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
||||||
|
dma_set_priority(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, DMA_PRIORITY_MEDIUM);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PIN_EXISTS(TFT_RESET)
|
#if PIN_EXISTS(TFT_RESET)
|
||||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||||
delay(100);
|
delay(100);
|
||||||
|
|
@ -201,6 +211,8 @@ uint32_t TFT_FSMC::GetID() {
|
||||||
id = ReadID(LCD_READ_ID);
|
id = ReadID(LCD_READ_ID);
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = ReadID(LCD_READ_ID4);
|
||||||
|
if ((id & 0xFF00) == 0 && (id & 0xFF) != 0)
|
||||||
|
id = ReadID(LCD_READ_ID4);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,24 +46,16 @@
|
||||||
// Serial override
|
// Serial override
|
||||||
//extern HalSerial usb_serial;
|
//extern HalSerial usb_serial;
|
||||||
|
|
||||||
|
#define _MSERIAL(X) SerialUART##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define SerialUART0 Serial1
|
||||||
|
|
||||||
#if defined(STM32F4) && SERIAL_PORT == 0
|
#if defined(STM32F4) && SERIAL_PORT == 0
|
||||||
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||||
#elif SERIAL_PORT == -1
|
#elif SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 6)
|
||||||
#define MYSERIAL0 Serial1
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 SerialUART1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 SerialUART2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 SerialUART3
|
|
||||||
#elif SERIAL_PORT == 4
|
|
||||||
#define MYSERIAL0 SerialUART4
|
|
||||||
#elif SERIAL_PORT == 5
|
|
||||||
#define MYSERIAL0 SerialUART5
|
|
||||||
#elif SERIAL_PORT == 6
|
|
||||||
#define MYSERIAL0 SerialUART6
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
#error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -71,57 +63,24 @@
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if defined(STM32F4) && SERIAL_PORT_2 == 0
|
#if defined(STM32F4) && SERIAL_PORT_2 == 0
|
||||||
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||||
#elif SERIAL_PORT_2 == SERIAL_PORT
|
|
||||||
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
#elif SERIAL_PORT_2 == -1
|
||||||
#define MYSERIAL1 SerialUSB
|
#define MYSERIAL1 SerialUSB
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 6)
|
||||||
#define MYSERIAL1 Serial1
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 SerialUART1
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 SerialUART2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 SerialUART3
|
|
||||||
#elif SERIAL_PORT_2 == 4
|
|
||||||
#define MYSERIAL1 SerialUART4
|
|
||||||
#elif SERIAL_PORT_2 == 5
|
|
||||||
#define MYSERIAL1 SerialUART5
|
|
||||||
#elif SERIAL_PORT_2 == 6
|
|
||||||
#define MYSERIAL1 SerialUART6
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DGUS_SERIAL_PORT
|
#ifdef LCD_SERIAL_PORT
|
||||||
#if defined(STM32F4) && DGUS_SERIAL_PORT == 0
|
#if defined(STM32F4) && LCD_SERIAL_PORT == 0
|
||||||
#error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
#error "LCD_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
|
||||||
#elif DGUS_SERIAL_PORT == SERIAL_PORT
|
#elif LCD_SERIAL_PORT == -1
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
|
#define LCD_SERIAL SerialUSB
|
||||||
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
|
#elif WITHIN(LCD_SERIAL_PORT, 0, 6)
|
||||||
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
|
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||||
#elif DGUS_SERIAL_PORT == -1
|
|
||||||
#define DGUS_SERIAL SerialUSB
|
|
||||||
#elif DGUS_SERIAL_PORT == 0
|
|
||||||
#define DGUS_SERIAL Serial1
|
|
||||||
#elif DGUS_SERIAL_PORT == 1
|
|
||||||
#define DGUS_SERIAL SerialUART1
|
|
||||||
#elif DGUS_SERIAL_PORT == 2
|
|
||||||
#define DGUS_SERIAL SerialUART2
|
|
||||||
#elif DGUS_SERIAL_PORT == 3
|
|
||||||
#define DGUS_SERIAL SerialUART3
|
|
||||||
#elif DGUS_SERIAL_PORT == 4
|
|
||||||
#define DGUS_SERIAL SerialUART4
|
|
||||||
#elif DGUS_SERIAL_PORT == 5
|
|
||||||
#define DGUS_SERIAL SerialUART5
|
|
||||||
#elif DGUS_SERIAL_PORT == 6
|
|
||||||
#define DGUS_SERIAL SerialUART6
|
|
||||||
#else
|
#else
|
||||||
#error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
#error "LCD_SERIAL_PORT must be from -1 to 6. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -183,6 +142,8 @@ void HAL_clear_reset_source();
|
||||||
// Reset reason
|
// Reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(const int delay);
|
void _delay_ms(const int delay);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(STM32GENERIC) && defined(STM32F7)
|
#if defined(STM32GENERIC) && defined(STM32F7)
|
||||||
|
|
@ -46,8 +45,8 @@
|
||||||
#define DEFAULT_MICROSTEPPING_VALUE 32
|
#define DEFAULT_MICROSTEPPING_VALUE 32
|
||||||
|
|
||||||
//TMC26X register definitions
|
//TMC26X register definitions
|
||||||
#define DRIVER_CONTROL_REGISTER 0x0ul
|
#define DRIVER_CONTROL_REGISTER 0x0UL
|
||||||
#define CHOPPER_CONFIG_REGISTER 0x80000ul
|
#define CHOPPER_CONFIG_REGISTER 0x80000UL
|
||||||
#define COOL_STEP_REGISTER 0xA0000ul
|
#define COOL_STEP_REGISTER 0xA0000ul
|
||||||
#define STALL_GUARD2_LOAD_MEASURE_REGISTER 0xC0000ul
|
#define STALL_GUARD2_LOAD_MEASURE_REGISTER 0xC0000ul
|
||||||
#define DRIVER_CONFIG_REGISTER 0xE0000ul
|
#define DRIVER_CONFIG_REGISTER 0xE0000ul
|
||||||
|
|
@ -56,58 +55,58 @@
|
||||||
|
|
||||||
//definitions for the driver control register
|
//definitions for the driver control register
|
||||||
#define MICROSTEPPING_PATTERN 0xFul
|
#define MICROSTEPPING_PATTERN 0xFul
|
||||||
#define STEP_INTERPOLATION 0x200ul
|
#define STEP_INTERPOLATION 0x200UL
|
||||||
#define DOUBLE_EDGE_STEP 0x100ul
|
#define DOUBLE_EDGE_STEP 0x100UL
|
||||||
#define VSENSE 0x40ul
|
#define VSENSE 0x40UL
|
||||||
#define READ_MICROSTEP_POSTION 0x0ul
|
#define READ_MICROSTEP_POSTION 0x0UL
|
||||||
#define READ_STALL_GUARD_READING 0x10ul
|
#define READ_STALL_GUARD_READING 0x10UL
|
||||||
#define READ_STALL_GUARD_AND_COOL_STEP 0x20ul
|
#define READ_STALL_GUARD_AND_COOL_STEP 0x20UL
|
||||||
#define READ_SELECTION_PATTERN 0x30ul
|
#define READ_SELECTION_PATTERN 0x30UL
|
||||||
|
|
||||||
//definitions for the chopper config register
|
//definitions for the chopper config register
|
||||||
#define CHOPPER_MODE_STANDARD 0x0ul
|
#define CHOPPER_MODE_STANDARD 0x0UL
|
||||||
#define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000ul
|
#define CHOPPER_MODE_T_OFF_FAST_DECAY 0x4000UL
|
||||||
#define T_OFF_PATTERN 0xFul
|
#define T_OFF_PATTERN 0xFul
|
||||||
#define RANDOM_TOFF_TIME 0x2000ul
|
#define RANDOM_TOFF_TIME 0x2000UL
|
||||||
#define BLANK_TIMING_PATTERN 0x18000ul
|
#define BLANK_TIMING_PATTERN 0x18000UL
|
||||||
#define BLANK_TIMING_SHIFT 15
|
#define BLANK_TIMING_SHIFT 15
|
||||||
#define HYSTERESIS_DECREMENT_PATTERN 0x1800ul
|
#define HYSTERESIS_DECREMENT_PATTERN 0x1800UL
|
||||||
#define HYSTERESIS_DECREMENT_SHIFT 11
|
#define HYSTERESIS_DECREMENT_SHIFT 11
|
||||||
#define HYSTERESIS_LOW_VALUE_PATTERN 0x780ul
|
#define HYSTERESIS_LOW_VALUE_PATTERN 0x780UL
|
||||||
#define HYSTERESIS_LOW_SHIFT 7
|
#define HYSTERESIS_LOW_SHIFT 7
|
||||||
#define HYSTERESIS_START_VALUE_PATTERN 0x78ul
|
#define HYSTERESIS_START_VALUE_PATTERN 0x78UL
|
||||||
#define HYSTERESIS_START_VALUE_SHIFT 4
|
#define HYSTERESIS_START_VALUE_SHIFT 4
|
||||||
#define T_OFF_TIMING_PATERN 0xFul
|
#define T_OFF_TIMING_PATERN 0xFul
|
||||||
|
|
||||||
//definitions for cool step register
|
//definitions for cool step register
|
||||||
#define MINIMUM_CURRENT_FOURTH 0x8000ul
|
#define MINIMUM_CURRENT_FOURTH 0x8000UL
|
||||||
#define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000ul
|
#define CURRENT_DOWN_STEP_SPEED_PATTERN 0x6000UL
|
||||||
#define SE_MAX_PATTERN 0xF00ul
|
#define SE_MAX_PATTERN 0xF00ul
|
||||||
#define SE_CURRENT_STEP_WIDTH_PATTERN 0x60ul
|
#define SE_CURRENT_STEP_WIDTH_PATTERN 0x60UL
|
||||||
#define SE_MIN_PATTERN 0xFul
|
#define SE_MIN_PATTERN 0xFul
|
||||||
|
|
||||||
//definitions for StallGuard2 current register
|
//definitions for StallGuard2 current register
|
||||||
#define STALL_GUARD_FILTER_ENABLED 0x10000ul
|
#define STALL_GUARD_FILTER_ENABLED 0x10000UL
|
||||||
#define STALL_GUARD_TRESHHOLD_VALUE_PATTERN 0x17F00ul
|
#define STALL_GUARD_TRESHHOLD_VALUE_PATTERN 0x17F00ul
|
||||||
#define CURRENT_SCALING_PATTERN 0x1Ful
|
#define CURRENT_SCALING_PATTERN 0x1Ful
|
||||||
#define STALL_GUARD_CONFIG_PATTERN 0x17F00ul
|
#define STALL_GUARD_CONFIG_PATTERN 0x17F00ul
|
||||||
#define STALL_GUARD_VALUE_PATTERN 0x7F00ul
|
#define STALL_GUARD_VALUE_PATTERN 0x7F00ul
|
||||||
|
|
||||||
//definitions for the input from the TMC2660
|
//definitions for the input from the TMC2660
|
||||||
#define STATUS_STALL_GUARD_STATUS 0x1ul
|
#define STATUS_STALL_GUARD_STATUS 0x1UL
|
||||||
#define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2ul
|
#define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2UL
|
||||||
#define STATUS_OVER_TEMPERATURE_WARNING 0x4ul
|
#define STATUS_OVER_TEMPERATURE_WARNING 0x4UL
|
||||||
#define STATUS_SHORT_TO_GROUND_A 0x8ul
|
#define STATUS_SHORT_TO_GROUND_A 0x8UL
|
||||||
#define STATUS_SHORT_TO_GROUND_B 0x10ul
|
#define STATUS_SHORT_TO_GROUND_B 0x10UL
|
||||||
#define STATUS_OPEN_LOAD_A 0x20ul
|
#define STATUS_OPEN_LOAD_A 0x20UL
|
||||||
#define STATUS_OPEN_LOAD_B 0x40ul
|
#define STATUS_OPEN_LOAD_B 0x40UL
|
||||||
#define STATUS_STAND_STILL 0x80ul
|
#define STATUS_STAND_STILL 0x80UL
|
||||||
#define READOUT_VALUE_PATTERN 0xFFC00ul
|
#define READOUT_VALUE_PATTERN 0xFFC00ul
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
||||||
//default values
|
//default values
|
||||||
#define INITIAL_MICROSTEPPING 0x3ul //32th microstepping
|
#define INITIAL_MICROSTEPPING 0x3UL //32th microstepping
|
||||||
|
|
||||||
SPIClass SPI_6(SPI6, SPI6_MOSI_PIN, SPI6_MISO_PIN, SPI6_SCK_PIN);
|
SPIClass SPI_6(SPI6, SPI6_MOSI_PIN, SPI6_MISO_PIN, SPI6_SCK_PIN);
|
||||||
|
|
||||||
|
|
@ -662,7 +661,6 @@ boolean TMC26XStepper::isEnabled() { return !!(chopper_config_register & T_OFF_P
|
||||||
/**
|
/**
|
||||||
* reads a value from the TMC26X status register. The value is not obtained directly but can then
|
* reads a value from the TMC26X status register. The value is not obtained directly but can then
|
||||||
* be read by the various status routines.
|
* be read by the various status routines.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void TMC26XStepper::readStatus(char read_value) {
|
void TMC26XStepper::readStatus(char read_value) {
|
||||||
uint32_t old_driver_configuration_register_value = driver_configuration_register_value;
|
uint32_t old_driver_configuration_register_value = driver_configuration_register_value;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Teensy32 (MK20DX256)
|
* HAL for Teensy 3.2 (MK20DX256)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __MK20DX256__
|
#ifdef __MK20DX256__
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Teensy 3.5 and Teensy 3.6
|
* HAL for Teensy 3.2 (MK20DX256)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -44,23 +44,20 @@
|
||||||
//#undef MOTHERBOARD
|
//#undef MOTHERBOARD
|
||||||
//#define MOTHERBOARD BOARD_TEENSY31_32
|
//#define MOTHERBOARD BOARD_TEENSY31_32
|
||||||
|
|
||||||
#ifdef __MK20DX256__
|
#define IS_32BIT_TEENSY 1
|
||||||
#define IS_32BIT_TEENSY 1
|
#define IS_TEENSY_31_32 1
|
||||||
|
#ifndef IS_TEENSY31
|
||||||
#define IS_TEENSY32 1
|
#define IS_TEENSY32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_SERIAL 1
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_SERVO_LIB libServo
|
#define HAL_SERVO_LIB libServo
|
||||||
|
|
@ -68,7 +65,7 @@
|
||||||
typedef int8_t pin_t;
|
typedef int8_t pin_t;
|
||||||
|
|
||||||
#ifndef analogInputToDigitalPin
|
#ifndef analogInputToDigitalPin
|
||||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
|
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
|
||||||
|
|
@ -96,6 +93,8 @@ void HAL_clear_reset_source();
|
||||||
// Get the reason for the reset
|
// Get the reason for the reset
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,4 @@ void libServo::move(const int value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_SERVOS
|
#endif // HAS_SERVOS
|
||||||
|
|
||||||
#endif // __MK20DX256__
|
#endif // __MK20DX256__
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,7 @@
|
||||||
#if USE_WIRED_EEPROM
|
#if USE_WIRED_EEPROM
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PersistentStore for Arduino-style EEPROM interface
|
* HAL PersistentStore for Teensy 3.2 (MK20DX256)
|
||||||
* with implementations supplied by the framework.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../shared/eeprom_api.h"
|
#include "../shared/eeprom_api.h"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Teensy3.2 __MK20DX256__
|
* HAL Timers for Teensy 3.2 (MK20DX256)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __MK20DX256__
|
#ifdef __MK20DX256__
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for
|
* HAL Timers for Teensy 3.2 (MK20DX256)
|
||||||
* Teensy3.2 (__MK20DX256__)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Teensy35 (MK64FX512)
|
* HAL for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Teensy 3.5 and Teensy 3.6
|
* HAL for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -45,27 +45,22 @@
|
||||||
// Defines
|
// Defines
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#ifdef __MK64FX512__
|
#define IS_32BIT_TEENSY 1
|
||||||
#define IS_32BIT_TEENSY 1
|
#define IS_TEENSY_35_36 1
|
||||||
|
#ifdef __MK66FX1M0__
|
||||||
|
#define IS_TEENSY36 1
|
||||||
|
#else // __MK64FX512__
|
||||||
#define IS_TEENSY35 1
|
#define IS_TEENSY35 1
|
||||||
#endif
|
#endif
|
||||||
#ifdef __MK66FX1M0__
|
|
||||||
#define IS_32BIT_TEENSY 1
|
|
||||||
#define IS_TEENSY36 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NUM_SERIAL 1
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 3)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_SERVO_LIB libServo
|
#define HAL_SERVO_LIB libServo
|
||||||
|
|
@ -73,7 +68,7 @@
|
||||||
typedef int8_t pin_t;
|
typedef int8_t pin_t;
|
||||||
|
|
||||||
#ifndef analogInputToDigitalPin
|
#ifndef analogInputToDigitalPin
|
||||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
|
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
|
||||||
|
|
@ -104,6 +99,8 @@ void HAL_clear_reset_source();
|
||||||
// Reset reason
|
// Reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL SPI for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
|
||||||
#include "HAL.h"
|
#include "HAL.h"
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL Servo for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
@ -51,5 +56,4 @@ void libServo::move(const int value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_SERVOS
|
#endif // HAS_SERVOS
|
||||||
|
|
||||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
#endif // __MK64FX512__ || __MK66FX1M0__
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL Servo for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
|
*/
|
||||||
|
|
||||||
#include <Servo.h>
|
#include <Servo.h>
|
||||||
|
|
||||||
// Inherit and expand on core Servo library
|
// Inherit and expand on core Servo library
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,14 @@
|
||||||
*/
|
*/
|
||||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL PersistentStore for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
|
*/
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if USE_WIRED_EEPROM
|
#if USE_WIRED_EEPROM
|
||||||
|
|
||||||
/**
|
|
||||||
* PersistentStore for Arduino-style EEPROM interface
|
|
||||||
* with implementations supplied by the framework.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../shared/eeprom_api.h"
|
#include "../shared/eeprom_api.h"
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Endstop Interrupts
|
* HAL Endstop Interrupts for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
*
|
*
|
||||||
* Without endstop interrupts the endstop pins must be polled continually in
|
* Without endstop interrupts the endstop pins must be polled continually in
|
||||||
* the temperature-ISR via endstops.update(), most of the time finding no change.
|
* the temperature-ISR via endstops.update(), most of the time finding no change.
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL Pins Debugging for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
|
*/
|
||||||
|
|
||||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL SPI Pins for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
|
*/
|
||||||
|
|
||||||
#define SCK_PIN 13
|
#define SCK_PIN 13
|
||||||
#define MISO_PIN 12
|
#define MISO_PIN 12
|
||||||
#define MOSI_PIN 11
|
#define MOSI_PIN 11
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Teensy3.5 __MK64FX512__
|
* HAL Timers for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
* Teensy3.6 __MK66FX1M0__
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,12 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for
|
* HAL Timers for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
|
||||||
* Teensy3.5 (__MK64FX512__)
|
|
||||||
* Teensy3.6 (__MK66FX1M0__)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Teensy40 (IMXRT1062)
|
* HAL for Teensy 4.0 / 4.1 (IMXRT1062)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __IMXRT1062__
|
#ifdef __IMXRT1062__
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Teensy 4.0 and Teensy 4.1
|
* HAL for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -45,64 +45,32 @@
|
||||||
// Defines
|
// Defines
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#ifdef __IMXRT1062__
|
#define IS_32BIT_TEENSY 1
|
||||||
#define IS_32BIT_TEENSY 1
|
#define IS_TEENSY_40_41 1
|
||||||
|
#ifndef IS_TEENSY40
|
||||||
#define IS_TEENSY41 1
|
#define IS_TEENSY41 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _MSERIAL(X) Serial##X
|
||||||
|
#define MSERIAL(X) _MSERIAL(X)
|
||||||
|
#define Serial0 Serial
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
#define MYSERIAL0 SerialUSB
|
#define MYSERIAL0 SerialUSB
|
||||||
#elif SERIAL_PORT == 0
|
#elif WITHIN(SERIAL_PORT, 0, 8)
|
||||||
#define MYSERIAL0 Serial
|
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
|
||||||
#elif SERIAL_PORT == 1
|
|
||||||
#define MYSERIAL0 Serial1
|
|
||||||
#elif SERIAL_PORT == 2
|
|
||||||
#define MYSERIAL0 Serial2
|
|
||||||
#elif SERIAL_PORT == 3
|
|
||||||
#define MYSERIAL0 Serial3
|
|
||||||
#elif SERIAL_PORT == 4
|
|
||||||
#define MYSERIAL0 Serial4
|
|
||||||
#elif SERIAL_PORT == 5
|
|
||||||
#define MYSERIAL0 Serial5
|
|
||||||
#elif SERIAL_PORT == 6
|
|
||||||
#define MYSERIAL0 Serial6
|
|
||||||
#elif SERIAL_PORT == 7
|
|
||||||
#define MYSERIAL0 Serial7
|
|
||||||
#elif SERIAL_PORT == 8
|
|
||||||
#define MYSERIAL0 Serial8
|
|
||||||
#else
|
#else
|
||||||
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
|
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_PORT_2
|
#ifdef SERIAL_PORT_2
|
||||||
#if SERIAL_PORT_2 == SERIAL_PORT
|
#if SERIAL_PORT_2 == -1
|
||||||
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
|
|
||||||
#elif SERIAL_PORT_2 == -1
|
|
||||||
#define MYSERIAL1 usbSerial
|
#define MYSERIAL1 usbSerial
|
||||||
#elif SERIAL_PORT_2 == 0
|
#elif WITHIN(SERIAL_PORT_2, 0, 8)
|
||||||
#define MYSERIAL1 Serial
|
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
|
||||||
#elif SERIAL_PORT_2 == 1
|
|
||||||
#define MYSERIAL1 Serial1
|
|
||||||
#elif SERIAL_PORT_2 == 2
|
|
||||||
#define MYSERIAL1 Serial2
|
|
||||||
#elif SERIAL_PORT_2 == 3
|
|
||||||
#define MYSERIAL1 Serial3
|
|
||||||
#elif SERIAL_PORT_2 == 4
|
|
||||||
#define MYSERIAL1 Serial4
|
|
||||||
#elif SERIAL_PORT_2 == 5
|
|
||||||
#define MYSERIAL1 Serial5
|
|
||||||
#elif SERIAL_PORT_2 == 6
|
|
||||||
#define MYSERIAL1 Serial6
|
|
||||||
#elif SERIAL_PORT_2 == 7
|
|
||||||
#define MYSERIAL1 Serial7
|
|
||||||
#elif SERIAL_PORT_2 == 8
|
|
||||||
#define MYSERIAL1 Serial8
|
|
||||||
#else
|
#else
|
||||||
#error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
|
#error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
|
||||||
#endif
|
#endif
|
||||||
#define NUM_SERIAL 2
|
|
||||||
#else
|
|
||||||
#define NUM_SERIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_SERVO_LIB libServo
|
#define HAL_SERVO_LIB libServo
|
||||||
|
|
@ -110,7 +78,7 @@
|
||||||
typedef int8_t pin_t;
|
typedef int8_t pin_t;
|
||||||
|
|
||||||
#ifndef analogInputToDigitalPin
|
#ifndef analogInputToDigitalPin
|
||||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
|
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL SPI for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __IMXRT1062__
|
#ifdef __IMXRT1062__
|
||||||
|
|
||||||
#include "HAL.h"
|
#include "HAL.h"
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL Servo for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __IMXRT1062__
|
#ifdef __IMXRT1062__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
@ -53,5 +58,4 @@ void libServo::detach() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_SERVOS
|
#endif // HAS_SERVOS
|
||||||
|
|
||||||
#endif // __IMXRT1062__
|
#endif // __IMXRT1062__
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue