Merge pull request #453 from tekka007/HWabstractions
Add hwFreeMem() function
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user