Add freeRam() function for stm32
This commit is contained in:
parent
5ddfde074f
commit
a09c5772ee
|
@ -13,6 +13,7 @@
|
||||||
#define CORE_STM32
|
#define CORE_STM32
|
||||||
#define LED_BUILTIN 33
|
#define LED_BUILTIN 33
|
||||||
|
|
||||||
|
extern "C" char* sbrk(int incr); //Used to freeRam
|
||||||
inline unsigned char digitalPinToInterrupt(unsigned char Interrupt_pin) { return Interrupt_pin; } //This isn't included in the stm32duino libs (yet)
|
inline unsigned char digitalPinToInterrupt(unsigned char Interrupt_pin) { return Interrupt_pin; } //This isn't included in the stm32duino libs (yet)
|
||||||
#define portOutputRegister(port) (volatile byte *)( &(port->regs->ODR) ) //These are defined in STM32F1/variants/generic_stm32f103c/variant.h but return a non byte* value
|
#define portOutputRegister(port) (volatile byte *)( &(port->regs->ODR) ) //These are defined in STM32F1/variants/generic_stm32f103c/variant.h but return a non byte* value
|
||||||
#define portInputRegister(port) (volatile byte *)( &(port->regs->IDR) ) //These are defined in STM32F1/variants/generic_stm32f103c/variant.h but return a non byte* value
|
#define portInputRegister(port) (volatile byte *)( &(port->regs->IDR) ) //These are defined in STM32F1/variants/generic_stm32f103c/variant.h but return a non byte* value
|
||||||
|
|
|
@ -34,8 +34,9 @@ uint16_t freeRam ()
|
||||||
// The difference is the free, available ram.
|
// The difference is the free, available ram.
|
||||||
return (uint16_t)stackTop - heapTop;
|
return (uint16_t)stackTop - heapTop;
|
||||||
#elif defined(CORE_STM32)
|
#elif defined(CORE_STM32)
|
||||||
//Figure this out some_time
|
char top = 't';
|
||||||
return 0;
|
return &top - reinterpret_cast<char*>(sbrk(0));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue