Skip to content

Commit

Permalink
Safe changes from HAL cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 29, 2019
1 parent 9596312 commit 1d8ad7c
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 25 deletions.
10 changes: 5 additions & 5 deletions Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ uint8_t HAL_get_reset_source(void);

void _delay_ms(const int delay);

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"

/*
extern "C" {
int freeMemory(void);
Expand All @@ -172,14 +169,17 @@ extern "C" {
extern "C" char* _sbrk(int incr);

/*
static int freeMemory() {
int freeMemory() {
volatile int top;
top = (int)((char*)&top - reinterpret_cast<char*>(_sbrk(0)));
return top;
}
*/

static int freeMemory() {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"

static inline int freeMemory(void) {
volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0));
}
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
* These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/

#ifndef PWM
#define PWM OUTPUT
#endif

#define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V)

Expand Down Expand Up @@ -61,6 +65,8 @@
#define PORTC 2
#define PORTD 3
#define PORTE 4
#define PORTF 5
#define PORTG 6

#define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)

Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/HAL/shared/Marduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#undef sq // Redefined by teensy3/wiring.h
#undef SBI // Redefined by arduino/const_functions.h
#undef CBI // Redefined by arduino/const_functions.h
#undef UNUSED // Redefined by stm32f4xx_hal_def.h

#include <Arduino.h> // NOTE: If included earlier then this line is a NOOP

Expand Down Expand Up @@ -74,3 +75,8 @@
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif

// Remove compiler warning on an unused variable
#ifndef UNUSED
#define UNUSED(x) ((void)(x))
#endif
9 changes: 0 additions & 9 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@
// Nanoseconds per cycle
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)

// Remove compiler warning on an unused variable
#ifndef UNUSED
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#define UNUSED(X) (void)X
#else
#define UNUSED(x) ((void)(x))
#endif
#endif

// Macros to make a string from a macro
#define STRINGIFY_(M) #M
#define STRINGIFY(M) STRINGIFY_(M)
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,11 @@
#error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
#endif

#define BOARD_MKS_13 -1109
#define BOARD_TRIGORILLA -1131
#define BOARD_RURAMPS4D -3020
#define BOARD_FORMBOT_TREX2 -1125
#define BOARD_BIQU_SKR_V1_1 -2014
#define BOARD_MKS_13 -1000
#define BOARD_TRIGORILLA -1001
#define BOARD_RURAMPS4D -1002
#define BOARD_FORMBOT_TREX2 -1003
#define BOARD_BIQU_SKR_V1_1 -1004
#if MB(MKS_13)
#error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration."
#elif MB(TRIGORILLA)
Expand All @@ -403,8 +403,8 @@
#error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration."
#elif MB(FORMBOT_TREX2)
#error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration."
#elif MB(BOARD_BIQU_SKR_V1_1)
#error "BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration."
#elif MB(BIQU_SKR_V1_1)
#error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration."
#endif
#undef BOARD_MKS_13
#undef BOARD_TRIGORILLA
Expand Down
10 changes: 8 additions & 2 deletions Marlin/src/lcd/dogm/HAL_LCD_com_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
#endif

uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#ifdef TARGET_LPC1768
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#endif

#define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn

#if PIN_EXISTS(FSMC_CS)
Expand All @@ -73,7 +76,8 @@
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
#endif

#elif TARGET_LPC1768
#elif defined(TARGET_LPC1768)

uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn

Expand All @@ -92,11 +96,13 @@
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn

#else // need to give them some definition or else get compiler errors

uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn
#define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn
#define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn

#endif
2 changes: 1 addition & 1 deletion Marlin/src/pins/ramps/pins_RAMPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* 7 | 11
*/

#if ENABLED(TARGET_LPC1768)
#ifdef TARGET_LPC1768
#error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768."
#elif defined(__STM32F1__)
#error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1."
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/pins/stm32/pins_STM32F4.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@

//#define I2C_EEPROM

#define E2END 0xFFF // 4KB
#ifndef E2END
#define E2END 0xFFF // 4KB
#endif

// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
Expand Down

0 comments on commit 1d8ad7c

Please sign in to comment.