Microduino

Dependencies:   mbed

Fork of Io_moon by Li Weiyi

Committer:
lixianyu
Date:
Fri Jun 24 02:06:43 2016 +0000
Revision:
1:e34100dd6532
Parent:
0:740c1eb2df13
?Arduino??????????0~255??????LPC824????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lixianyu 0:740c1eb2df13 1 /**
lixianyu 0:740c1eb2df13 2 * @file BlynkDebug.cpp
lixianyu 0:740c1eb2df13 3 * @author Volodymyr Shymanskyy
lixianyu 0:740c1eb2df13 4 * @license This project is released under the MIT License (MIT)
lixianyu 0:740c1eb2df13 5 * @copyright Copyright (c) 2015 Volodymyr Shymanskyy
lixianyu 0:740c1eb2df13 6 * @date Jan 2015
lixianyu 0:740c1eb2df13 7 * @brief Debug utilities for Arduino
lixianyu 0:740c1eb2df13 8 */
lixianyu 0:740c1eb2df13 9
lixianyu 0:740c1eb2df13 10 #include <Blynk/BlynkDebug.h>
lixianyu 0:740c1eb2df13 11 #include "mbed.h"
lixianyu 0:740c1eb2df13 12
lixianyu 0:740c1eb2df13 13 size_t BlynkFreeRam()
lixianyu 0:740c1eb2df13 14 {
lixianyu 0:740c1eb2df13 15 #if defined(__AVR__)
lixianyu 0:740c1eb2df13 16 extern int __heap_start, *__brkval;
lixianyu 0:740c1eb2df13 17 int v;
lixianyu 0:740c1eb2df13 18 return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
lixianyu 0:740c1eb2df13 19 #else
lixianyu 0:740c1eb2df13 20 return 0;
lixianyu 0:740c1eb2df13 21 #endif
lixianyu 0:740c1eb2df13 22 }
lixianyu 0:740c1eb2df13 23
lixianyu 0:740c1eb2df13 24 void BlynkReset()
lixianyu 0:740c1eb2df13 25 {
lixianyu 0:740c1eb2df13 26 void(*resetFunc)(void) = 0;
lixianyu 0:740c1eb2df13 27 resetFunc();
lixianyu 0:740c1eb2df13 28 for(;;); // To make compiler happy
lixianyu 0:740c1eb2df13 29 }
lixianyu 0:740c1eb2df13 30
lixianyu 0:740c1eb2df13 31 void BlynkFatal()
lixianyu 0:740c1eb2df13 32 {
lixianyu 0:740c1eb2df13 33 wait_ms(10000L);
lixianyu 0:740c1eb2df13 34 BlynkReset();
lixianyu 0:740c1eb2df13 35 }
lixianyu 0:740c1eb2df13 36