Browse Source

Safe changes from HAL cleanup

Scott Lahteine 6 years ago
parent
commit
1d8ad7cf71

+ 5
- 5
Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h View File

160
 
160
 
161
 void _delay_ms(const int delay);
161
 void _delay_ms(const int delay);
162
 
162
 
163
-#pragma GCC diagnostic push
164
-#pragma GCC diagnostic ignored "-Wunused-function"
165
-
166
 /*
163
 /*
167
 extern "C" {
164
 extern "C" {
168
   int freeMemory(void);
165
   int freeMemory(void);
172
 extern "C" char* _sbrk(int incr);
169
 extern "C" char* _sbrk(int incr);
173
 
170
 
174
 /*
171
 /*
175
-static int freeMemory() {
172
+int freeMemory() {
176
   volatile int top;
173
   volatile int top;
177
   top = (int)((char*)&top - reinterpret_cast<char*>(_sbrk(0)));
174
   top = (int)((char*)&top - reinterpret_cast<char*>(_sbrk(0)));
178
   return top;
175
   return top;
179
 }
176
 }
180
 */
177
 */
181
 
178
 
182
-static int freeMemory() {
179
+#pragma GCC diagnostic push
180
+#pragma GCC diagnostic ignored "-Wunused-function"
181
+
182
+static inline int freeMemory(void) {
183
   volatile char top;
183
   volatile char top;
184
   return &top - reinterpret_cast<char*>(_sbrk(0));
184
   return &top - reinterpret_cast<char*>(_sbrk(0));
185
 }
185
 }

+ 6
- 0
Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h View File

27
  * These use GPIO functions instead of Direct Port Manipulation, as on AVR.
27
  * These use GPIO functions instead of Direct Port Manipulation, as on AVR.
28
  */
28
  */
29
 
29
 
30
+#ifndef PWM
31
+  #define PWM OUTPUT
32
+#endif
33
+
30
 #define READ(IO)                digitalRead(IO)
34
 #define READ(IO)                digitalRead(IO)
31
 #define WRITE(IO,V)             digitalWrite(IO,V)
35
 #define WRITE(IO,V)             digitalWrite(IO,V)
32
 
36
 
61
 #define PORTC 2
65
 #define PORTC 2
62
 #define PORTD 3
66
 #define PORTD 3
63
 #define PORTE 4
67
 #define PORTE 4
68
+#define PORTF 5
69
+#define PORTG 6
64
 
70
 
65
 #define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)
71
 #define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)
66
 
72
 

+ 6
- 0
Marlin/src/HAL/shared/Marduino.h View File

31
 #undef sq             // Redefined by teensy3/wiring.h
31
 #undef sq             // Redefined by teensy3/wiring.h
32
 #undef SBI            // Redefined by arduino/const_functions.h
32
 #undef SBI            // Redefined by arduino/const_functions.h
33
 #undef CBI            // Redefined by arduino/const_functions.h
33
 #undef CBI            // Redefined by arduino/const_functions.h
34
+#undef UNUSED         // Redefined by stm32f4xx_hal_def.h
34
 
35
 
35
 #include <Arduino.h>  // NOTE: If included earlier then this line is a NOOP
36
 #include <Arduino.h>  // NOTE: If included earlier then this line is a NOOP
36
 
37
 
74
 #ifndef M_PI
75
 #ifndef M_PI
75
   #define M_PI 3.14159265358979323846f
76
   #define M_PI 3.14159265358979323846f
76
 #endif
77
 #endif
78
+
79
+// Remove compiler warning on an unused variable
80
+#ifndef UNUSED
81
+  #define UNUSED(x) ((void)(x))
82
+#endif

+ 0
- 9
Marlin/src/core/macros.h View File

53
 // Nanoseconds per cycle
53
 // Nanoseconds per cycle
54
 #define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
54
 #define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
55
 
55
 
56
-// Remove compiler warning on an unused variable
57
-#ifndef UNUSED
58
-  #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
59
-    #define UNUSED(X) (void)X
60
-  #else
61
-    #define UNUSED(x) ((void)(x))
62
-  #endif
63
-#endif
64
-
65
 // Macros to make a string from a macro
56
 // Macros to make a string from a macro
66
 #define STRINGIFY_(M) #M
57
 #define STRINGIFY_(M) #M
67
 #define STRINGIFY(M) STRINGIFY_(M)
58
 #define STRINGIFY(M) STRINGIFY_(M)

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

390
   #error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
390
   #error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
391
 #endif
391
 #endif
392
 
392
 
393
-#define BOARD_MKS_13        -1109
394
-#define BOARD_TRIGORILLA    -1131
395
-#define BOARD_RURAMPS4D     -3020
396
-#define BOARD_FORMBOT_TREX2 -1125
397
-#define BOARD_BIQU_SKR_V1_1 -2014
393
+#define BOARD_MKS_13        -1000
394
+#define BOARD_TRIGORILLA    -1001
395
+#define BOARD_RURAMPS4D     -1002
396
+#define BOARD_FORMBOT_TREX2 -1003
397
+#define BOARD_BIQU_SKR_V1_1 -1004
398
 #if MB(MKS_13)
398
 #if MB(MKS_13)
399
   #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration."
399
   #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration."
400
 #elif MB(TRIGORILLA)
400
 #elif MB(TRIGORILLA)
403
   #error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration."
403
   #error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration."
404
 #elif MB(FORMBOT_TREX2)
404
 #elif MB(FORMBOT_TREX2)
405
   #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration."
405
   #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration."
406
-#elif MB(BOARD_BIQU_SKR_V1_1)
407
-  #error "BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration."
406
+#elif MB(BIQU_SKR_V1_1)
407
+  #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration."
408
 #endif
408
 #endif
409
 #undef BOARD_MKS_13
409
 #undef BOARD_MKS_13
410
 #undef BOARD_TRIGORILLA
410
 #undef BOARD_TRIGORILLA

+ 8
- 2
Marlin/src/lcd/dogm/HAL_LCD_com_defines.h View File

63
     #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
63
     #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
64
   #endif
64
   #endif
65
 
65
 
66
-  uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
66
+  #ifdef TARGET_LPC1768
67
+    uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
68
+  #endif
69
+
67
   #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
70
   #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
68
 
71
 
69
   #if PIN_EXISTS(FSMC_CS)
72
   #if PIN_EXISTS(FSMC_CS)
73
     #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
76
     #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
74
   #endif
77
   #endif
75
 
78
 
76
-#elif TARGET_LPC1768
79
+#elif defined(TARGET_LPC1768)
80
+
77
   uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
81
   uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
78
   #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn
82
   #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn
79
 
83
 
92
   #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
96
   #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
93
 
97
 
94
 #else  // need to give them some definition or else get compiler errors
98
 #else  // need to give them some definition or else get compiler errors
99
+
95
   uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
100
   uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
96
   #define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn
101
   #define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn
97
   #define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn
102
   #define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn
99
   #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn
104
   #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn
100
   #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
105
   #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
101
   #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
106
   #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
107
+
102
 #endif
108
 #endif

+ 1
- 1
Marlin/src/pins/ramps/pins_RAMPS.h View File

45
  *         7 | 11
45
  *         7 | 11
46
  */
46
  */
47
 
47
 
48
-#if ENABLED(TARGET_LPC1768)
48
+#ifdef TARGET_LPC1768
49
   #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768."
49
   #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768."
50
 #elif defined(__STM32F1__)
50
 #elif defined(__STM32F1__)
51
   #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1."
51
   #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1."

+ 3
- 1
Marlin/src/pins/stm32/pins_STM32F4.h View File

32
 
32
 
33
 //#define I2C_EEPROM
33
 //#define I2C_EEPROM
34
 
34
 
35
-#define E2END 0xFFF // 4KB
35
+#ifndef E2END
36
+  #define E2END 0xFFF // 4KB
37
+#endif
36
 
38
 
37
 // Ignore temp readings during development.
39
 // Ignore temp readings during development.
38
 //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
40
 //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

Loading…
Cancel
Save