|
1 | 1 | #pragma once |
2 | | -/* |
| 2 | +/*\ |
3 | 3 | * |
4 | | - * ESP32-yaml |
| 4 | + * YAMLDuino |
5 | 5 | * Project Page: https://github.com/tobozo/YAMLDuino |
6 | 6 | * |
7 | 7 | * Copyright 2022 tobozo http://github.com/tobozo |
8 | 8 | * |
9 | 9 | * Permission is hereby granted, free of charge, to any person |
10 | 10 | * obtaining a copy of this software and associated documentation |
11 | | - * files ("ESP32-yaml"), to deal in the Software without |
| 11 | + * files ("YAMLDuino"), to deal in the Software without |
12 | 12 | * restriction, including without limitation the rights to use, |
13 | 13 | * copy, modify, merge, publish, distribute, sublicense, and/or |
14 | 14 | * sell copies of the Software, and to permit persons to whom the |
|
27 | 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
28 | 28 | * OTHER DEALINGS IN THE SOFTWARE. |
29 | 29 | * |
30 | | - */ |
| 30 | +\*/ |
31 | 31 |
|
32 | 32 | // Emit logs in arduino style at software level rather than firmware level |
33 | 33 |
|
|
59 | 59 | #include <Arduino.h> |
60 | 60 | #define LOG_PRINTF Serial.printf |
61 | 61 | #define HEAP_AVAILABLE() rp2040.getFreeHeap() |
| 62 | +#elif defined CORE_TEENSY |
| 63 | + #include <stdarg.h> |
| 64 | + #include <Arduino.h> |
| 65 | + #define LOG_PRINTF Serial.printf |
| 66 | + extern unsigned long _heap_start; |
| 67 | + extern unsigned long _heap_end; |
| 68 | + extern char *__brkval; |
| 69 | + static int getFreeRam() |
| 70 | + { |
| 71 | + return (char *)&_heap_end - __brkval; |
| 72 | + } |
| 73 | + #define HEAP_AVAILABLE() getFreeRam() |
62 | 74 | #elif defined ARDUINO_ARCH_SAMD |
63 | 75 | #include <stdarg.h> |
64 | 76 | #include <Arduino.h> |
|
74 | 86 | char top; |
75 | 87 | #ifdef __arm__ |
76 | 88 | return &top - reinterpret_cast<char*>(sbrk(0)); |
77 | | - #elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151) |
| 89 | + #elif (ARDUINO > 103 && ARDUINO != 151) |
78 | 90 | return &top - __brkval; |
79 | 91 | #else // __arm__ |
80 | 92 | return __brkval ? &top - __brkval : &top - __malloc_heap_start; |
|
0 commit comments