My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HAL.cpp 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* **************************************************************************
  2. Marlin 3D Printer Firmware
  3. Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ****************************************************************************/
  16. #ifdef __AVR__
  17. // --------------------------------------------------------------------------
  18. // Includes
  19. // --------------------------------------------------------------------------
  20. #include "../../inc/MarlinConfig.h"
  21. #include "HAL.h"
  22. // --------------------------------------------------------------------------
  23. // Externals
  24. // --------------------------------------------------------------------------
  25. // --------------------------------------------------------------------------
  26. // Local defines
  27. // --------------------------------------------------------------------------
  28. // --------------------------------------------------------------------------
  29. // Types
  30. // --------------------------------------------------------------------------
  31. // --------------------------------------------------------------------------
  32. // Variables
  33. // --------------------------------------------------------------------------
  34. // --------------------------------------------------------------------------
  35. // Public Variables
  36. // --------------------------------------------------------------------------
  37. //uint8_t MCUSR;
  38. // --------------------------------------------------------------------------
  39. // Private Variables
  40. // --------------------------------------------------------------------------
  41. // --------------------------------------------------------------------------
  42. // Function prototypes
  43. // --------------------------------------------------------------------------
  44. // --------------------------------------------------------------------------
  45. // Private functions
  46. // --------------------------------------------------------------------------
  47. // --------------------------------------------------------------------------
  48. // Public functions
  49. // --------------------------------------------------------------------------
  50. #if ENABLED(SDSUPPORT)
  51. #include "../../sd/SdFatUtil.h"
  52. int freeMemory() { return SdFatUtil::FreeRam(); }
  53. #else // !SDSUPPORT
  54. extern "C" {
  55. extern char __bss_end;
  56. extern char __heap_start;
  57. extern void* __brkval;
  58. int freeMemory() {
  59. int free_memory;
  60. if ((int)__brkval == 0)
  61. free_memory = ((int)&free_memory) - ((int)&__bss_end);
  62. else
  63. free_memory = ((int)&free_memory) - ((int)__brkval);
  64. return free_memory;
  65. }
  66. }
  67. #endif // !SDSUPPORT
  68. #endif // __AVR__