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