Safe changes from HAL cleanup

This commit is contained in:
Scott Lahteine 2019-08-28 21:21:38 -05:00
parent 95963121b0
commit 1d8ad7cf71
8 changed files with 36 additions and 25 deletions

View file

@ -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);
@ -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));
}

View file

@ -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)
@ -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)

View file

@ -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
@ -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

View file

@ -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)

View file

@ -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)
@ -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

View file

@ -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)
@ -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
@ -92,6 +96,7 @@
#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
@ -99,4 +104,5 @@
#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

View file

@ -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."

View file

@ -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