Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtosMemoryTest mbed
main.cpp
00001 #include "mbed.h" 00002 #include "heapsize.hpp" 00003 00004 DigitalOut GreenLed(LED_GREEN); 00005 DigitalOut RedLed(LED_RED); 00006 DigitalOut BlueLed(LED_BLUE); 00007 00008 void BlinkErrorCodeNoRtos( int blinks) 00009 { 00010 GreenLed = 1; 00011 BlueLed = 1; 00012 for( int i=0; i<blinks; i++) { 00013 RedLed = 0; 00014 wait( 0.15); 00015 RedLed = 1; 00016 wait( 0.15); 00017 } 00018 wait(0.5); 00019 } 00020 00021 extern "C" void HardFault_Handler() 00022 { 00023 while( 1) 00024 BlinkErrorCodeNoRtos(1); 00025 } 00026 00027 extern "C" void UsageFault_Handler() 00028 { 00029 while( 1) 00030 BlinkErrorCodeNoRtos( 2); 00031 } 00032 00033 extern "C" void BusFault_Handler() 00034 { 00035 while( 1) 00036 BlinkErrorCodeNoRtos( 3); 00037 } 00038 00039 extern "C" void MemManage_Handler() 00040 { 00041 while( 1) 00042 BlinkErrorCodeNoRtos( 4); 00043 } 00044 00045 /* 00046 extern "C" void SVC_Handler(int R0) 00047 { 00048 //wait(0.1); 00049 } 00050 00051 extern "C" void NMI_Handler() 00052 { 00053 } 00054 00055 extern "C" void DebugMon_Handler() 00056 { 00057 GreenLed = 1; 00058 00059 BlueLed = 0; 00060 RedLed = 0; 00061 wait( 0.1); 00062 BlueLed = 1; 00063 RedLed = 1; 00064 } 00065 00066 extern "C" void PendSV_Handler() 00067 { 00068 BlueLed = 1; 00069 00070 GreenLed = 0; 00071 RedLed = 0; 00072 wait( 0.1); 00073 GreenLed = 1; 00074 RedLed = 1; 00075 } 00076 00077 extern "C" void SysTick_Handler() 00078 { 00079 00080 } 00081 00082 extern "C" void IntDefaultHandler() 00083 { 00084 } 00085 */ 00086 00087 int main() 00088 { 00089 #ifdef __CC_ARM 00090 printf( "CC ARM \r\n"); 00091 #elif defined(__GNUC__) 00092 printf( "GNUC \r\n"); 00093 #elif defined(__ICCARM__) 00094 printf( "ICC ARM \r\n"); 00095 #endif 00096 00097 printf( "in main, heap free is: %ld\r\n", heapSize()); 00098 00099 while (true) { 00100 GreenLed = 0; 00101 BlueLed = 0; 00102 RedLed = 0; 00103 wait( 0.15); 00104 GreenLed = 1; 00105 BlueLed = 1; 00106 RedLed = 1; 00107 wait( 0.15); 00108 } 00109 }
Generated on Mon Jul 18 2022 20:36:50 by
1.7.2