Add hwFreeMem() function

This commit is contained in:
tekka007
2016-05-30 22:29:23 +02:00
parent 9d6a25dc5a
commit c0e11732d4
3 changed files with 26 additions and 1 deletions
+7 -1
View File
@@ -152,7 +152,7 @@ uint16_t hwCPUVoltage() {
return (1125300UL) / ADC;
}
uint8_t hwCPUFrequency() {
uint16_t hwCPUFrequency() {
noInterrupts();
// setup timer1
TIFR1 = 0xFF;
@@ -180,6 +180,12 @@ uint8_t hwCPUFrequency() {
return TCNT1 * 2048UL / 100000UL;
}
uint16_t hwFreeMem() {
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
#ifdef MY_DEBUG
+4
View File
@@ -126,6 +126,10 @@ uint16_t hwCPUFrequency() {
return ESP.getCpuFreqMHz()*10;
}
uint16_t hwFreeMem() {
return ESP.getFreeHeap();
}
#ifdef MY_DEBUG
void hwDebugPrint(const char *fmt, ... ) {
char fmtBuffer[300];
+15
View File
@@ -138,6 +138,21 @@ int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mo
return -2;
}
uint16_t hwCPUVoltage() {
// TODO: Not supported!
return 0;
}
uint16_t hwCPUFrequency() {
// TODO: Not supported!
return 0;
}
uint16_t hwFreeMem() {
// TODO: Not supported!
return 0;
}
#ifdef MY_DEBUG
void hwDebugPrint(const char *fmt, ... ) {
if (MY_SERIALDEVICE) {