Browse Source

LPC176x Framework update (#15722)

Changes required for compatibility with framework-arduino-lpc176x 0.2.0
Chris Pepper 4 years ago
parent
commit
b9116d4050
No account linked to committer's email address
30 changed files with 172 additions and 176 deletions
  1. 3
    1
      Marlin/src/HAL/HAL_LPC1768/HAL.cpp
  2. 33
    4
      Marlin/src/HAL/HAL_LPC1768/HAL.h
  3. 6
    6
      Marlin/src/HAL/HAL_LPC1768/HAL_SPI.cpp
  4. 2
    0
      Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h
  5. 2
    2
      Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp
  6. 10
    10
      Marlin/src/HAL/HAL_LPC1768/fastio.h
  7. 7
    0
      Marlin/src/HAL/HAL_LPC1768/inc/SanityCheck.h
  8. 7
    38
      Marlin/src/HAL/HAL_LPC1768/pinsDebug.h
  9. 1
    1
      Marlin/src/HAL/HAL_LPC1768/timers.h
  10. 3
    4
      Marlin/src/HAL/HAL_LPC1768/u8g/LCD_I2C_routines.c
  11. 16
    16
      Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp
  12. 4
    4
      Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h
  13. 4
    4
      Marlin/src/pins/lpc1768/pins_BIGTREE_SKR_V1.1.h
  14. 4
    4
      Marlin/src/pins/lpc1768/pins_BIGTREE_SKR_V1.3.h
  15. 3
    3
      Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h
  16. 3
    3
      Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h
  17. 3
    3
      Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h
  18. 5
    5
      Marlin/src/pins/lpc1768/pins_MKS_SBASE.h
  19. 4
    4
      Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h
  20. 9
    9
      Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
  21. 4
    4
      Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h
  22. 4
    10
      Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h
  23. 4
    4
      Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h
  24. 1
    1
      Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h
  25. 3
    3
      Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h
  26. 6
    6
      Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h
  27. 1
    1
      Marlin/src/pins/lpc1769/pins_MKS_SGEN.h
  28. 5
    11
      Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h
  29. 7
    7
      Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h
  30. 8
    8
      platformio.ini

+ 3
- 1
Marlin/src/HAL/HAL_LPC1768/HAL.cpp View File

30
   #include "watchdog.h"
30
   #include "watchdog.h"
31
 #endif
31
 #endif
32
 
32
 
33
+uint32_t HAL_adc_reading = 0;
34
+
33
 // U8glib required functions
35
 // U8glib required functions
34
 extern "C" void u8g_xMicroDelay(uint16_t val) {
36
 extern "C" void u8g_xMicroDelay(uint16_t val) {
35
   DELAY_US(val);
37
   DELAY_US(val);
61
 //   return dval if not found or not a valid pin.
63
 //   return dval if not found or not a valid pin.
62
 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
64
 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
63
   const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100;
65
   const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100;
64
-  const  int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? GET_PIN_MAP_INDEX((port << 5) | pin) : -2;
66
+  const  int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? ((port << 5) | pin) : -2;
65
   return ind > -1 ? ind : dval;
67
   return ind > -1 ? ind : dval;
66
 }
68
 }
67
 
69
 

+ 33
- 4
Marlin/src/HAL/HAL_LPC1768/HAL.h View File

132
                                     // Memory usage per ADC channel (bytes): 4 (32 Bytes for 8 channels)
132
                                     // Memory usage per ADC channel (bytes): 4 (32 Bytes for 8 channels)
133
 
133
 
134
 using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
134
 using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
135
-#define HAL_adc_init()         FilteredADC::init()
135
+
136
+extern uint32_t HAL_adc_reading;
137
+[[gnu::always_inline]] inline void HAL_start_adc(const pin_t pin) {
138
+  HAL_adc_reading = FilteredADC::read(pin) >> 6; // returns 16bit value, reduce to 10bit
139
+}
140
+[[gnu::always_inline]] inline uint16_t HAL_read_adc() {
141
+  return HAL_adc_reading;
142
+}
143
+
144
+#define HAL_adc_init()
136
 #define HAL_ANALOG_SELECT(pin) FilteredADC::enable_channel(pin)
145
 #define HAL_ANALOG_SELECT(pin) FilteredADC::enable_channel(pin)
137
-#define HAL_START_ADC(pin)     FilteredADC::start_conversion(pin)
138
-#define HAL_READ_ADC()         FilteredADC::get_result()
139
-#define HAL_ADC_READY()        FilteredADC::finished_conversion()
146
+#define HAL_START_ADC(pin)     HAL_start_adc(pin)
147
+#define HAL_READ_ADC()         HAL_read_adc()
148
+#define HAL_ADC_READY()        (true)
149
+
150
+// Test whether the pin is valid
151
+constexpr bool VALID_PIN(const pin_t pin) {
152
+  return LPC176x::pin_is_valid(pin);
153
+}
154
+
155
+// Get the analog index for a digital pin
156
+constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t pin) {
157
+  return (LPC176x::pin_is_valid(pin) && LPC176x::pin_has_adc(pin)) ? pin : -1;
158
+}
159
+
160
+// Return the index of a pin number
161
+constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) {
162
+  return LPC176x::pin_index(pin);
163
+}
164
+
165
+// Get the pin number at the given index
166
+constexpr pin_t GET_PIN_MAP_PIN(const int16_t index) {
167
+  return LPC176x::pin_index(index);
168
+}
140
 
169
 
141
 // Parse a G-code word into a pin index
170
 // Parse a G-code word into a pin index
142
 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
171
 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);

+ 6
- 6
Marlin/src/HAL/HAL_LPC1768/HAL_SPI.cpp View File

125
     PinCfg.Funcnum = 2;
125
     PinCfg.Funcnum = 2;
126
     PinCfg.OpenDrain = 0;
126
     PinCfg.OpenDrain = 0;
127
     PinCfg.Pinmode = 0;
127
     PinCfg.Pinmode = 0;
128
-    PinCfg.Pinnum = LPC1768_PIN_PIN(SCK_PIN);
129
-    PinCfg.Portnum = LPC1768_PIN_PORT(SCK_PIN);
128
+    PinCfg.Pinnum = LPC176x::pin_bit(SCK_PIN);
129
+    PinCfg.Portnum = LPC176x::pin_port(SCK_PIN);
130
     PINSEL_ConfigPin(&PinCfg);
130
     PINSEL_ConfigPin(&PinCfg);
131
     SET_OUTPUT(SCK_PIN);
131
     SET_OUTPUT(SCK_PIN);
132
 
132
 
133
-    PinCfg.Pinnum = LPC1768_PIN_PIN(MISO_PIN);
134
-    PinCfg.Portnum = LPC1768_PIN_PORT(MISO_PIN);
133
+    PinCfg.Pinnum = LPC176x::pin_bit(MISO_PIN);
134
+    PinCfg.Portnum = LPC176x::pin_port(MISO_PIN);
135
     PINSEL_ConfigPin(&PinCfg);
135
     PINSEL_ConfigPin(&PinCfg);
136
     SET_INPUT(MISO_PIN);
136
     SET_INPUT(MISO_PIN);
137
 
137
 
138
-    PinCfg.Pinnum = LPC1768_PIN_PIN(MOSI_PIN);
139
-    PinCfg.Portnum = LPC1768_PIN_PORT(MOSI_PIN);
138
+    PinCfg.Pinnum = LPC176x::pin_bit(MOSI_PIN);
139
+    PinCfg.Portnum = LPC176x::pin_port(MOSI_PIN);
140
     PINSEL_ConfigPin(&PinCfg);
140
     PINSEL_ConfigPin(&PinCfg);
141
     SET_OUTPUT(MOSI_PIN);
141
     SET_OUTPUT(MOSI_PIN);
142
     // divide PCLK by 2 for SSP0
142
     // divide PCLK by 2 for SSP0

+ 2
- 0
Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h View File

42
 
42
 
43
 void setup_endstop_interrupts() {
43
 void setup_endstop_interrupts() {
44
   #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
44
   #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
45
+  #define LPC1768_PIN_INTERRUPT_M(pin) ((pin >> 0x5 & 0x7) == 0 || (pin >> 0x5 & 0x7) == 2)
46
+
45
   #if HAS_X_MAX
47
   #if HAS_X_MAX
46
     #if !LPC1768_PIN_INTERRUPT_M(X_MAX_PIN)
48
     #if !LPC1768_PIN_INTERRUPT_M(X_MAX_PIN)
47
       #error "X_MAX_PIN is not INTERRUPT-capable."
49
       #error "X_MAX_PIN is not INTERRUPT-capable."

+ 2
- 2
Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp View File

29
 #include <pwm.h>
29
 #include <pwm.h>
30
 
30
 
31
 void set_pwm_frequency(const pin_t pin, int f_desired) {
31
 void set_pwm_frequency(const pin_t pin, int f_desired) {
32
-  pwm_set_frequency(pin, f_desired);
32
+  LPC176x::pwm_set_frequency(pin, f_desired);
33
 }
33
 }
34
 
34
 
35
 void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
35
 void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
36
-  pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
36
+  LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
37
 }
37
 }
38
 
38
 
39
 #endif // FAST_PWM_FAN || SPINDLE_LASER_PWM
39
 #endif // FAST_PWM_FAN || SPINDLE_LASER_PWM

+ 10
- 10
Marlin/src/HAL/HAL_LPC1768/fastio.h View File

37
 
37
 
38
 #define PWM_PIN(P)            true // all pins are PWM capable
38
 #define PWM_PIN(P)            true // all pins are PWM capable
39
 
39
 
40
-#define LPC_PIN(pin)          gpio_pin(pin)
41
-#define LPC_GPIO(port)        gpio_port(port)
40
+#define LPC_PIN(pin)          LPC176x::gpio_pin(pin)
41
+#define LPC_GPIO(port)        LPC176x::gpio_port(port)
42
 
42
 
43
-#define SET_DIR_INPUT(IO)     gpio_set_input(IO)
44
-#define SET_DIR_OUTPUT(IO)    gpio_set_output(IO)
43
+#define SET_DIR_INPUT(IO)     LPC176x::gpio_set_input(IO)
44
+#define SET_DIR_OUTPUT(IO)    LPC176x::gpio_set_output(IO)
45
 
45
 
46
 #define SET_MODE(IO, mode)    pinMode(IO, mode)
46
 #define SET_MODE(IO, mode)    pinMode(IO, mode)
47
 
47
 
48
-#define WRITE_PIN_SET(IO)     gpio_set(IO)
49
-#define WRITE_PIN_CLR(IO)     gpio_clear(IO)
48
+#define WRITE_PIN_SET(IO)     LPC176x::gpio_set(IO)
49
+#define WRITE_PIN_CLR(IO)     LPC176x::gpio_clear(IO)
50
 
50
 
51
-#define READ_PIN(IO)          gpio_get(IO)
52
-#define WRITE_PIN(IO,V)       gpio_set(IO, V)
51
+#define READ_PIN(IO)          LPC176x::gpio_get(IO)
52
+#define WRITE_PIN(IO,V)       LPC176x::gpio_set(IO, V)
53
 
53
 
54
 /**
54
 /**
55
  * Magic I/O routines
55
  * Magic I/O routines
81
 #define _PULLDOWN(IO,V)       pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
81
 #define _PULLDOWN(IO,V)       pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
82
 
82
 
83
 /// check if pin is an input
83
 /// check if pin is an input
84
-#define _IS_INPUT(IO)         (!gpio_get_dir(IO))
84
+#define _IS_INPUT(IO)         (!LPC176x::gpio_get_dir(IO))
85
 
85
 
86
 /// check if pin is an output
86
 /// check if pin is an output
87
-#define _IS_OUTPUT(IO)        (gpio_get_dir(IO))
87
+#define _IS_OUTPUT(IO)        (LPC176x::gpio_get_dir(IO))
88
 
88
 
89
 /// Read a pin wrapper
89
 /// Read a pin wrapper
90
 #define READ(IO)              _READ(IO)
90
 #define READ(IO)              _READ(IO)

+ 7
- 0
Marlin/src/HAL/HAL_LPC1768/inc/SanityCheck.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
+#if PIO_PLATFORM_VERSION < 000001000
25
+  #error "nxplpc-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries. You may need to remove the platform and let it reinstall automatically."
26
+#endif
27
+#if PIO_FRAMEWORK_VERSION < 000002000
28
+  #error "framework-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries."
29
+#endif
30
+
24
 /**
31
 /**
25
  * Test LPC176x-specific configuration values for errors at compile-time.
32
  * Test LPC176x-specific configuration values for errors at compile-time.
26
  */
33
  */

+ 7
- 38
Marlin/src/HAL/HAL_LPC1768/pinsDebug.h View File

33
 #define PRINT_PORT(p)
33
 #define PRINT_PORT(p)
34
 #define GET_ARRAY_PIN(p) pin_array[p].pin
34
 #define GET_ARRAY_PIN(p) pin_array[p].pin
35
 #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
35
 #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
36
-#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%d.%02d"), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer); }while(0)
36
+#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%d.%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0)
37
 #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
37
 #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
38
 
38
 
39
 // pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
39
 // pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
40
-//  uses pin index
41
 #ifndef M43_NEVER_TOUCH
40
 #ifndef M43_NEVER_TOUCH
42
-  #define M43_NEVER_TOUCH(Q) ((Q) == 29 || (Q) == 30 || (Q) == 73)  // USB pins
41
+  #define M43_NEVER_TOUCH(Q) ((Q) == P0_29 || (Q) == P0_30 || (Q) == P2_09)  // USB pins
43
 #endif
42
 #endif
44
 
43
 
45
-// active ADC function/mode/code values for PINSEL registers
46
-constexpr int8_t ADC_pin_mode(pin_t pin) {
47
-  return (LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 2  ? 2 :
48
-          LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 3  ? 2 :
49
-          LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 23 ? 1 :
50
-          LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 24 ? 1 :
51
-          LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 25 ? 1 :
52
-          LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 26 ? 1 :
53
-          LPC1768_PIN_PORT(pin) == 1 && LPC1768_PIN_PIN(pin) == 30 ? 3 :
54
-          LPC1768_PIN_PORT(pin) == 1 && LPC1768_PIN_PIN(pin) == 31 ? 3 : -1);
55
-}
56
-
57
-int8_t get_pin_mode(pin_t pin) {
58
-  if (!VALID_PIN(pin)) return -1;
59
-  uint8_t pin_port = LPC1768_PIN_PORT(pin);
60
-  uint8_t pin_port_pin = LPC1768_PIN_PIN(pin);
61
-  //get appropriate PINSEL register
62
-  volatile uint32_t * pinsel_reg = (pin_port == 0 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL0 :
63
-                                   (pin_port == 0)                       ? &LPC_PINCON->PINSEL1 :
64
-                                   (pin_port == 1 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL2 :
65
-                                    pin_port == 1                        ? &LPC_PINCON->PINSEL3 :
66
-                                    pin_port == 2                        ? &LPC_PINCON->PINSEL4 :
67
-                                    pin_port == 3                        ? &LPC_PINCON->PINSEL7 : &LPC_PINCON->PINSEL9;
68
-  uint8_t pinsel_start_bit = pin_port_pin > 15 ? 2 * (pin_port_pin - 16) : 2 * pin_port_pin;
69
-  int8_t pin_mode = (int8_t) ((*pinsel_reg >> pinsel_start_bit) & 0x3);
70
-  return pin_mode;
71
-}
72
-
73
-bool GET_PINMODE(pin_t pin) {
74
-  int8_t pin_mode = get_pin_mode(pin);
75
-  if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin
44
+bool GET_PINMODE(const pin_t pin) {
45
+  if (!LPC176x::pin_is_valid(pin) || LPC176x::pin_adc_enabled(pin)) // found an invalid pin or active analog pin
76
     return false;
46
     return false;
77
 
47
 
78
-  uint32_t * FIO_reg[5] PROGMEM = {(uint32_t*) 0x2009C000,(uint32_t*)  0x2009C020,(uint32_t*)  0x2009C040,(uint32_t*)  0x2009C060,(uint32_t*)  0x2009C080};
79
-  return ((*FIO_reg[LPC1768_PIN_PORT(pin)] >> LPC1768_PIN_PIN(pin) & 1) != 0); //input/output state
48
+  return LPC176x::gpio_direction(pin);
80
 }
49
 }
81
 
50
 
82
-bool GET_ARRAY_IS_DIGITAL(pin_t pin) {
83
-  return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
51
+bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
52
+  return (!LPC176x::pin_has_adc(pin) || !LPC176x::pin_adc_enabled(pin));
84
 }
53
 }

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/timers.h View File

59
 typedef uint32_t hal_timer_t;
59
 typedef uint32_t hal_timer_t;
60
 #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
60
 #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
61
 
61
 
62
-#define HAL_TIMER_RATE         ((SystemCoreClock) / 4)  // frequency of timers peripherals
62
+#define HAL_TIMER_RATE         ((F_CPU) / 4)  // frequency of timers peripherals
63
 
63
 
64
 #define STEP_TIMER_NUM 0  // Timer Index for Stepper
64
 #define STEP_TIMER_NUM 0  // Timer Index for Stepper
65
 #define TEMP_TIMER_NUM 1  // Timer Index for Temperature
65
 #define TEMP_TIMER_NUM 1  // Timer Index for Temperature

+ 3
- 4
Marlin/src/HAL/HAL_LPC1768/u8g/LCD_I2C_routines.c View File

34
 #include <lpc17xx_libcfg_default.h>
34
 #include <lpc17xx_libcfg_default.h>
35
 
35
 
36
 #include "../../../core/millis_t.h"
36
 #include "../../../core/millis_t.h"
37
-
37
+extern int millis();
38
 //////////////////////////////////////////////////////////////////////////////////////
38
 //////////////////////////////////////////////////////////////////////////////////////
39
 
39
 
40
 // These two routines are exact copies of the lpc17xx_i2c.c routines.  Couldn't link to
40
 // These two routines are exact copies of the lpc17xx_i2c.c routines.  Couldn't link to
151
   u8g_i2c_start(0); // send slave address and write bit
151
   u8g_i2c_start(0); // send slave address and write bit
152
 }
152
 }
153
 
153
 
154
-volatile extern millis_t _millis;
155
 uint8_t u8g_i2c_send_byte(uint8_t data) {
154
 uint8_t u8g_i2c_send_byte(uint8_t data) {
156
   #define I2C_TIMEOUT 3
155
   #define I2C_TIMEOUT 3
157
   LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data
156
   LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data
158
   LPC_I2C1->I2CONSET = I2C_I2CONSET_AA;
157
   LPC_I2C1->I2CONSET = I2C_I2CONSET_AA;
159
   LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC;
158
   LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC;
160
-  const millis_t timeout = _millis + I2C_TIMEOUT;
161
-  while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && PENDING(_millis, timeout));  // wait for xmit to finish
159
+  const millis_t timeout = millis() + I2C_TIMEOUT;
160
+  while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && PENDING(millis(), timeout));  // wait for xmit to finish
162
   // had hangs with SH1106 so added time out - have seen temporary screen corruption when this happens
161
   // had hangs with SH1106 so added time out - have seen temporary screen corruption when this happens
163
   return 1;
162
   return 1;
164
 }
163
 }

+ 16
- 16
Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp View File

75
 
75
 
76
   for (uint8_t i = 0; i < 8; i++) {
76
   for (uint8_t i = 0; i < 8; i++) {
77
     if (spi_speed == 0) {
77
     if (spi_speed == 0) {
78
-      gpio_set(mosi_pin, !!(b & 0x80));
79
-      gpio_set(sck_pin, HIGH);
78
+      LPC176x::gpio_set(mosi_pin, !!(b & 0x80));
79
+      LPC176x::gpio_set(sck_pin, HIGH);
80
       b <<= 1;
80
       b <<= 1;
81
-      if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
82
-      gpio_set(sck_pin, LOW);
81
+      if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1;
82
+      LPC176x::gpio_set(sck_pin, LOW);
83
     }
83
     }
84
     else {
84
     else {
85
       const uint8_t state = (b & 0x80) ? HIGH : LOW;
85
       const uint8_t state = (b & 0x80) ? HIGH : LOW;
86
       for (uint8_t j = 0; j < spi_speed; j++)
86
       for (uint8_t j = 0; j < spi_speed; j++)
87
-        gpio_set(mosi_pin, state);
87
+        LPC176x::gpio_set(mosi_pin, state);
88
 
88
 
89
       for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
89
       for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
90
-        gpio_set(sck_pin, HIGH);
90
+        LPC176x::gpio_set(sck_pin, HIGH);
91
 
91
 
92
       b <<= 1;
92
       b <<= 1;
93
-      if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
93
+      if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1;
94
 
94
 
95
       for (uint8_t j = 0; j < spi_speed; j++)
95
       for (uint8_t j = 0; j < spi_speed; j++)
96
-        gpio_set(sck_pin, LOW);
96
+        LPC176x::gpio_set(sck_pin, LOW);
97
     }
97
     }
98
   }
98
   }
99
 
99
 
105
   for (uint8_t i = 0; i < 8; i++) {
105
   for (uint8_t i = 0; i < 8; i++) {
106
     const uint8_t state = (b & 0x80) ? HIGH : LOW;
106
     const uint8_t state = (b & 0x80) ? HIGH : LOW;
107
     if (spi_speed == 0) {
107
     if (spi_speed == 0) {
108
-      gpio_set(sck_pin, LOW);
109
-      gpio_set(mosi_pin, state);
110
-      gpio_set(mosi_pin, state);  // need some setup time
111
-      gpio_set(sck_pin, HIGH);
108
+      LPC176x::gpio_set(sck_pin, LOW);
109
+      LPC176x::gpio_set(mosi_pin, state);
110
+      LPC176x::gpio_set(mosi_pin, state);  // need some setup time
111
+      LPC176x::gpio_set(sck_pin, HIGH);
112
     }
112
     }
113
     else {
113
     else {
114
       for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
114
       for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
115
-        gpio_set(sck_pin, LOW);
115
+        LPC176x::gpio_set(sck_pin, LOW);
116
 
116
 
117
       for (uint8_t j = 0; j < spi_speed; j++)
117
       for (uint8_t j = 0; j < spi_speed; j++)
118
-        gpio_set(mosi_pin, state);
118
+        LPC176x::gpio_set(mosi_pin, state);
119
 
119
 
120
       for (uint8_t j = 0; j < spi_speed; j++)
120
       for (uint8_t j = 0; j < spi_speed; j++)
121
-        gpio_set(sck_pin, HIGH);
121
+        LPC176x::gpio_set(sck_pin, HIGH);
122
     }
122
     }
123
     b <<= 1;
123
     b <<= 1;
124
-    if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
124
+    if (miso_pin >= 0 && LPC176x::gpio_get(miso_pin)) b |= 1;
125
   }
125
   }
126
 
126
 
127
   return b;
127
   return b;

+ 4
- 4
Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h View File

25
  * AZSMZ MINI pin assignments
25
  * AZSMZ MINI pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef TARGET_LPC1768
28
+#ifndef MCU_LPC1768
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
71
 // Temperature Sensors
71
 // Temperature Sensors
72
 //  3.3V max when defined as an analog input
72
 //  3.3V max when defined as an analog input
73
 //
73
 //
74
-#define TEMP_0_PIN          0   // A0 (TH1)
75
-#define TEMP_BED_PIN        1   // A1 (TH2)
76
-#define TEMP_1_PIN          2   // A2 (TH3)
74
+#define TEMP_0_PIN          P0_23_A0   // A0 (TH1)
75
+#define TEMP_BED_PIN        P0_24_A1   // A1 (TH2)
76
+#define TEMP_1_PIN          P0_25_A2   // A2 (TH3)
77
 
77
 
78
 //
78
 //
79
 // Heaters / Fans
79
 // Heaters / Fans

+ 4
- 4
Marlin/src/pins/lpc1768/pins_BIGTREE_SKR_V1.1.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#ifndef TARGET_LPC1768
24
+#ifndef MCU_LPC1768
25
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
25
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
26
 #endif
26
 #endif
27
 
27
 
64
 // Temperature Sensors
64
 // Temperature Sensors
65
 //  3.3V max when defined as an analog input
65
 //  3.3V max when defined as an analog input
66
 //
66
 //
67
-#define TEMP_BED_PIN       0   // Analog Input
68
-#define TEMP_0_PIN         1   // Analog Input
69
-#define TEMP_1_PIN         2   // Analog Input
67
+#define TEMP_BED_PIN       P0_23_A0   // Analog Input
68
+#define TEMP_0_PIN         P0_24_A1   // Analog Input
69
+#define TEMP_1_PIN         P0_25_A2   // Analog Input
70
 
70
 
71
 //
71
 //
72
 // Heaters / Fans
72
 // Heaters / Fans

+ 4
- 4
Marlin/src/pins/lpc1768/pins_BIGTREE_SKR_V1.3.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#ifndef TARGET_LPC1768
24
+#ifndef MCU_LPC1768
25
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
25
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
26
 #endif
26
 #endif
27
 
27
 
160
 // Temperature Sensors
160
 // Temperature Sensors
161
 //  3.3V max when defined as an analog input
161
 //  3.3V max when defined as an analog input
162
 //
162
 //
163
-#define TEMP_BED_PIN       0   // A0 (T0) - (67) - TEMP_BED_PIN
164
-#define TEMP_0_PIN         1   // A1 (T1) - (68) - TEMP_0_PIN
165
-#define TEMP_1_PIN         2   // A2 (T2) - (69) - TEMP_1_PIN
163
+#define TEMP_BED_PIN       P0_23_A0   // A0 (T0) - (67) - TEMP_BED_PIN
164
+#define TEMP_0_PIN         P0_24_A1   // A1 (T1) - (68) - TEMP_0_PIN
165
+#define TEMP_1_PIN         P0_25_A2   // A2 (T2) - (69) - TEMP_1_PIN
166
 
166
 
167
 //
167
 //
168
 // Heaters / Fans
168
 // Heaters / Fans

+ 3
- 3
Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h View File

30
  *
30
  *
31
  */
31
  */
32
 
32
 
33
-#ifndef TARGET_LPC1768
33
+#ifndef MCU_LPC1768
34
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
34
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
35
 #endif
35
 #endif
36
 
36
 
98
 // Temperature Sensors
98
 // Temperature Sensors
99
 //  3.3V max when defined as an analog input
99
 //  3.3V max when defined as an analog input
100
 //
100
 //
101
-#define TEMP_0_PIN          1   // A0 (T0)
102
-#define TEMP_BED_PIN        0   // A1 (T1)
101
+#define TEMP_0_PIN          P0_24_A1   // A0 (T0)
102
+#define TEMP_BED_PIN        P0_23_A0   // A1 (T1)
103
 
103
 
104
 //
104
 //
105
 // Heaters / Fans
105
 // Heaters / Fans

+ 3
- 3
Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h View File

30
  *
30
  *
31
  */
31
  */
32
 
32
 
33
-#ifndef TARGET_LPC1768
33
+#ifndef MCU_LPC1768
34
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
34
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
35
 #endif
35
 #endif
36
 
36
 
71
 // Temperature Sensors
71
 // Temperature Sensors
72
 //  3.3V max when defined as an analog input
72
 //  3.3V max when defined as an analog input
73
 //
73
 //
74
-#define TEMP_0_PIN          0   // A0 (T0)
75
-#define TEMP_BED_PIN        1   // A1 (T1)
74
+#define TEMP_0_PIN          P0_23_A0   // A0 (T0)
75
+#define TEMP_BED_PIN        P0_24_A1   // A1 (T1)
76
 
76
 
77
 
77
 
78
 //
78
 //

+ 3
- 3
Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#ifndef TARGET_LPC1768
24
+#ifndef MCU_LPC1768
25
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
25
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
26
 #endif
26
 #endif
27
 
27
 
103
 // Temperature Sensors
103
 // Temperature Sensors
104
 //  3.3V max when defined as an analog input
104
 //  3.3V max when defined as an analog input
105
 //
105
 //
106
-#define TEMP_0_PIN          1   // AD0[0] on P0_23
107
-#define TEMP_BED_PIN        0   // AD0[1] on P0_24
106
+#define TEMP_0_PIN          P0_24_A1   // AD0[0] on P0_23
107
+#define TEMP_BED_PIN        P0_23_A0   // AD0[1] on P0_24
108
 
108
 
109
 //
109
 //
110
 // Heaters / Fans
110
 // Heaters / Fans

+ 5
- 5
Marlin/src/pins/lpc1768/pins_MKS_SBASE.h View File

25
  * MKS SBASE pin assignments
25
  * MKS SBASE pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef TARGET_LPC1768
28
+#ifndef MCU_LPC1768
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
90
 // Temperature Sensors
90
 // Temperature Sensors
91
 // 3.3V max when defined as an analog input
91
 // 3.3V max when defined as an analog input
92
 //
92
 //
93
-#define TEMP_BED_PIN        0   // A0 (TH1)
94
-#define TEMP_0_PIN          1   // A1 (TH2)
95
-#define TEMP_1_PIN          2   // A2 (TH3)
96
-#define TEMP_2_PIN          3   // A3 (TH4)
93
+#define TEMP_BED_PIN        P0_23_A0   // A0 (TH1)
94
+#define TEMP_0_PIN          P0_24_A1   // A1 (TH2)
95
+#define TEMP_1_PIN          P0_25_A2   // A2 (TH3)
96
+#define TEMP_2_PIN          P0_26_A3   // A3 (TH4)
97
 
97
 
98
 //
98
 //
99
 // Heaters / Fans
99
 // Heaters / Fans

+ 4
- 4
Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h View File

25
  * MKS SGEN-L pin assignments
25
  * MKS SGEN-L pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef TARGET_LPC1768
28
+#ifndef MCU_LPC1768
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
155
 // Temperature Sensors
155
 // Temperature Sensors
156
 // 3.3V max when defined as an analog input
156
 // 3.3V max when defined as an analog input
157
 //
157
 //
158
-#define TEMP_0_PIN         0   // Analog Input A0 (TH1)
159
-#define TEMP_BED_PIN       1   // Analog Input A1 (TB)
160
-#define TEMP_1_PIN         2   // Analog Input A2 (TH2)
158
+#define TEMP_0_PIN         P0_23_A0   // Analog Input A0 (TH1)
159
+#define TEMP_BED_PIN       P0_24_A1   // Analog Input A1 (TB)
160
+#define TEMP_1_PIN         P0_25_A2   // Analog Input A2 (TH2)
161
 
161
 
162
 //
162
 //
163
 // Heaters / Fans
163
 // Heaters / Fans

+ 9
- 9
Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h View File

36
 
36
 
37
 // Numbers in parentheses () are the corresponding mega2560 pin numbers
37
 // Numbers in parentheses () are the corresponding mega2560 pin numbers
38
 
38
 
39
-#ifndef TARGET_LPC1768
39
+#ifndef MCU_LPC1768
40
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
40
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
41
 #endif
41
 #endif
42
 
42
 
162
 // Temperature Sensors
162
 // Temperature Sensors
163
 //  3.3V max when defined as an analog input
163
 //  3.3V max when defined as an analog input
164
 //
164
 //
165
-#define TEMP_0_PIN          0   // A0 (T0) - (67) - TEMP_0_PIN
166
-#define TEMP_BED_PIN        1   // A1 (T1) - (68) - TEMP_BED_PIN
167
-#define TEMP_1_PIN          2   // A2 (T2) - (69) - TEMP_1_PIN
168
-#define TEMP_2_PIN          3   // A3 - (63) - J5-3 & AUX-2
169
-#define TEMP_3_PIN          4   // A4 - (37) - BUZZER_PIN
170
-//#define TEMP_4_PIN          5   // A5 - (49) - SD_DETECT_PIN
171
-//#define ??                  6   // A6 - ( 0)  - RXD0 - J4-4 & AUX-1
172
-#define FILWIDTH_PIN        7   // A7 - ( 1)  - TXD0 - J4-5 & AUX-1
165
+#define TEMP_0_PIN          P0_23_A0   // A0 (T0) - (67) - TEMP_0_PIN
166
+#define TEMP_BED_PIN        P0_24_A1   // A1 (T1) - (68) - TEMP_BED_PIN
167
+#define TEMP_1_PIN          P0_25_A2   // A2 (T2) - (69) - TEMP_1_PIN
168
+#define TEMP_2_PIN          P0_26_A3   // A3 - (63) - J5-3 & AUX-2
169
+#define TEMP_3_PIN          P1_30_A4   // A4 - (37) - BUZZER_PIN
170
+//#define TEMP_4_PIN          P1_31_A5   // A5 - (49) - SD_DETECT_PIN
171
+//#define ??                  P0_03_A6   // A6 - ( 0)  - RXD0 - J4-4 & AUX-1
172
+#define FILWIDTH_PIN        P0_02_A7   // A7 - ( 1)  - TXD0 - J4-5 & AUX-1
173
 
173
 
174
 //
174
 //
175
 // Augmentation for auto-assigning RAMPS plugs
175
 // Augmentation for auto-assigning RAMPS plugs

+ 4
- 4
Marlin/src/pins/lpc1768/pins_SELENA_COMPACT.h View File

25
  * Selena Compact pin assignments
25
  * Selena Compact pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef TARGET_LPC1768
28
+#ifndef MCU_LPC1768
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
75
 // Temperature Sensors
75
 // Temperature Sensors
76
 // 3.3V max when defined as an analog input
76
 // 3.3V max when defined as an analog input
77
 //
77
 //
78
-#define TEMP_BED_PIN        0   // A0 (TH1)
79
-#define TEMP_0_PIN          1   // A1 (TH2)
80
-#define TEMP_1_PIN          2   // A2 (TH3)
78
+#define TEMP_BED_PIN        P0_23_A0   // A0 (TH1)
79
+#define TEMP_0_PIN          P0_24_A1   // A1 (TH2)
80
+#define TEMP_1_PIN          P0_25_A2   // A2 (TH3)
81
 
81
 
82
 
82
 
83
 //
83
 //

+ 4
- 10
Marlin/src/pins/lpc1769/pins_AZTEEG_X5_GT.h View File

25
  * Azteeg X5 GT pin assignments
25
  * Azteeg X5 GT pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
33
 #define BOARD_WEBSITE_URL "tinyurl.com/yx8tdqa3"
33
 #define BOARD_WEBSITE_URL "tinyurl.com/yx8tdqa3"
34
 
34
 
35
 //
35
 //
36
-// Custom CPU Speed 120MHz
37
-//
38
-#undef F_CPU
39
-#define F_CPU 120000000
40
-
41
-//
42
 // Servos
36
 // Servos
43
 //
37
 //
44
 #define SERVO0_PIN         P1_23
38
 #define SERVO0_PIN         P1_23
96
 // Temperature Sensors
90
 // Temperature Sensors
97
 // 3.3V max when defined as an analog input
91
 // 3.3V max when defined as an analog input
98
 //
92
 //
99
-#define TEMP_BED_PIN        0   // A0 (TH1)
100
-#define TEMP_0_PIN          1   // A1 (TH2)
101
-#define TEMP_1_PIN          2   // A2 (TH3)
93
+#define TEMP_BED_PIN        P0_23_A0   // A0 (TH1)
94
+#define TEMP_0_PIN          P0_24_A1   // A1 (TH2)
95
+#define TEMP_1_PIN          P0_25_A2   // A2 (TH3)
102
 
96
 
103
 
97
 
104
 //
98
 //

+ 4
- 4
Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h View File

25
  * Azteeg X5 MINI pin assignments
25
  * Azteeg X5 MINI pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
56
 #endif
56
 #endif
57
 
57
 
58
 #ifndef FILWIDTH_PIN
58
 #ifndef FILWIDTH_PIN
59
-  #define FILWIDTH_PIN         2   // Analog Input (P0_25)
59
+  #define FILWIDTH_PIN         P0_25_A2   // Analog Input (P0_25)
60
 #endif
60
 #endif
61
 
61
 
62
 //
62
 //
93
 // Temperature Sensors
93
 // Temperature Sensors
94
 // 3.3V max when defined as an analog input
94
 // 3.3V max when defined as an analog input
95
 //
95
 //
96
-#define TEMP_BED_PIN        0   // A0 (TH1)
97
-#define TEMP_0_PIN          1   // A1 (TH2)
96
+#define TEMP_BED_PIN        P0_23_A0   // A0 (TH1)
97
+#define TEMP_0_PIN          P0_24_A1   // A1 (TH2)
98
 
98
 
99
 //
99
 //
100
 // Heaters / Fans
100
 // Heaters / Fans

+ 1
- 1
Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI_WIFI.h View File

25
  * Azteeg X5 MINI pin assignments
25
  * Azteeg X5 MINI pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 

+ 3
- 3
Marlin/src/pins/lpc1769/pins_COHESION3D_MINI.h View File

25
  * Cohesion3D Mini pin assignments
25
  * Cohesion3D Mini pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
88
 // Analog Inputs
88
 // Analog Inputs
89
 //  3.3V max when defined as an analog input
89
 //  3.3V max when defined as an analog input
90
 //
90
 //
91
-#define TEMP_0_PIN          0   // P0_23
92
-#define TEMP_BED_PIN        1   // P0_24
91
+#define TEMP_0_PIN          P0_23_A0   // P0_23
92
+#define TEMP_BED_PIN        P0_24_A1   // P0_24
93
 
93
 
94
 //
94
 //
95
 // Heaters / Fans
95
 // Heaters / Fans

+ 6
- 6
Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h View File

25
  * Cohesion3D ReMix pin assignments
25
  * Cohesion3D ReMix pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
98
 // Analog Inputs
98
 // Analog Inputs
99
 //  3.3V max when defined as an analog input
99
 //  3.3V max when defined as an analog input
100
 //
100
 //
101
-#define TEMP_0_PIN          0   // P0_23
102
-#define TEMP_BED_PIN        1   // P0_24
103
-#define TEMP_1_PIN          2   // P0_25
101
+#define TEMP_0_PIN          P0_23_A0
102
+#define TEMP_BED_PIN        P0_24_A1
103
+#define TEMP_1_PIN          P0_25_A2
104
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
104
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
105
-  #define FILWIDTH_PIN      3   // P0_26
105
+  #define FILWIDTH_PIN      P0_26_A3
106
 #else
106
 #else
107
-  #define TEMP_2_PIN        3   // P0_26
107
+  #define TEMP_2_PIN        P0_26_A3
108
 #endif
108
 #endif
109
 
109
 
110
 //
110
 //

+ 1
- 1
Marlin/src/pins/lpc1769/pins_MKS_SGEN.h View File

25
  * MKS SGen pin assignments
25
  * MKS SGen pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 

+ 5
- 11
Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h View File

25
  * Smoothieboard pin assignments
25
  * Smoothieboard pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
33
 #define BOARD_WEBSITE_URL "smoothieware.org/smoothieboard"
33
 #define BOARD_WEBSITE_URL "smoothieware.org/smoothieboard"
34
 
34
 
35
 //
35
 //
36
-// Custom CPU Speed 120MHz
37
-//
38
-#undef F_CPU
39
-#define F_CPU 120000000
40
-
41
-//
42
 // Servos
36
 // Servos
43
 //
37
 //
44
 #define SERVO0_PIN         P1_23
38
 #define SERVO0_PIN         P1_23
80
 // Temperature Sensors
74
 // Temperature Sensors
81
 // 3.3V max when defined as an analog input
75
 // 3.3V max when defined as an analog input
82
 //
76
 //
83
-#define TEMP_0_PIN          0   // P0.23 (T1)
84
-#define TEMP_BED_PIN        1   // P0.24 (T2)
85
-#define TEMP_1_PIN          2   // P0.25 (T3)
86
-#define TEMP_2_PIN          3   // P0.26 (T4)
77
+#define TEMP_0_PIN          P0_23_A0   // (T1)
78
+#define TEMP_BED_PIN        P0_24_A1   // (T2)
79
+#define TEMP_1_PIN          P0_25_A2   // (T3)
80
+#define TEMP_2_PIN          P0_26_A3   // (T4)
87
 
81
 
88
 //
82
 //
89
 // Heaters / Fans
83
 // Heaters / Fans

+ 7
- 7
Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h View File

25
  * TH3D EZBoard pin assignments
25
  * TH3D EZBoard pin assignments
26
  */
26
  */
27
 
27
 
28
-#ifndef LPC1769
28
+#ifndef MCU_LPC1769
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
29
   #error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30
 #endif
30
 #endif
31
 
31
 
94
 //  3.3V max when defined as an Analog Input!
94
 //  3.3V max when defined as an Analog Input!
95
 //
95
 //
96
 #if TEMP_SENSOR_0 == 20         // PT100 Adapter
96
 #if TEMP_SENSOR_0 == 20         // PT100 Adapter
97
-  #define TEMP_0_PIN        7   // Analog Input
97
+  #define TEMP_0_PIN        P0_02_A7   // Analog Input
98
 #else
98
 #else
99
-  #define TEMP_0_PIN        0   // Analog Input P0_23
99
+  #define TEMP_0_PIN        P0_23_A0   // Analog Input P0_23
100
 #endif
100
 #endif
101
 
101
 
102
-#define TEMP_BED_PIN        1   // Analog Input P0_24
103
-#define TEMP_1_PIN          2   // Analog Input P0_25
102
+#define TEMP_BED_PIN        P0_24_A1   // Analog Input P0_24
103
+#define TEMP_1_PIN          P0_25_A2   // Analog Input P0_25
104
 
104
 
105
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
105
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
106
-  #define FILWIDTH_PIN      3   // Analog Input P0_26
106
+  #define FILWIDTH_PIN      P0_26_A3   // Analog Input P0_26
107
 #else
107
 #else
108
-  #define TEMP_2_PIN        3   // Analog Input P0_26
108
+  #define TEMP_2_PIN        P0_26_A3   // Analog Input P0_26
109
 #endif
109
 #endif
110
 
110
 
111
 //
111
 //

+ 8
- 8
platformio.ini View File

144
 # NXP LPC176x ARM Cortex-M3
144
 # NXP LPC176x ARM Cortex-M3
145
 #
145
 #
146
 [env:LPC1768]
146
 [env:LPC1768]
147
-platform          = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/master.zip
147
+platform          = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.0.zip
148
 framework         = arduino
148
 framework         = arduino
149
 board             = nxp_lpc1768
149
 board             = nxp_lpc1768
150
-build_flags       = -DTARGET_LPC1768 -DU8G_HAL_LINKS  -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags}
150
+build_flags       = -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags}
151
 # debug options for backtrace
151
 # debug options for backtrace
152
 #  -funwind-tables
152
 #  -funwind-tables
153
 #  -mpoke-function-name
153
 #  -mpoke-function-name
159
 lib_deps          = Servo
159
 lib_deps          = Servo
160
   LiquidCrystal
160
   LiquidCrystal
161
   U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip
161
   U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip
162
-  TMCStepper@>=0.5.0,<1.0.0
163
-  Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/master.zip
162
+  TMCStepper=https://github.com/p3p/TMCStepper/archive/pr_lpctimingfix.zip
163
+  Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/release.zip
164
   SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
164
   SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
165
 
165
 
166
 [env:LPC1769]
166
 [env:LPC1769]
167
-platform          = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/master.zip
167
+platform          = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.0.zip
168
 framework         = arduino
168
 framework         = arduino
169
 board             = nxp_lpc1769
169
 board             = nxp_lpc1769
170
-build_flags       = -DTARGET_LPC1768 -DLPC1769 -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags}
170
+build_flags       = -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags}
171
 # debug options for backtrace
171
 # debug options for backtrace
172
 #  -funwind-tables
172
 #  -funwind-tables
173
 #  -mpoke-function-name
173
 #  -mpoke-function-name
179
 lib_deps          = Servo
179
 lib_deps          = Servo
180
   LiquidCrystal
180
   LiquidCrystal
181
   U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip
181
   U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip
182
-  TMCStepper@>=0.5.0,<1.0.0
183
-  Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/master.zip
182
+  TMCStepper=https://github.com/p3p/TMCStepper/archive/pr_lpctimingfix.zip
183
+  Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/release.zip
184
 
184
 
185
 #
185
 #
186
 # Sanguinololu (ATmega644p)
186
 # Sanguinololu (ATmega644p)

Loading…
Cancel
Save