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.
example_assert.cpp
00001 #include "MicroBit.h" 00002 #include "MicroBitI2C.h" 00003 #include "MicroBitPin.h" 00004 #include "MicroBitDisplay.h" 00005 00006 #include "OLED.h" 00007 #include "Display.h" 00008 #include "common.h" 00009 00010 void assert(uint16_t file,uint16_t line, bool assertion) { 00011 if (!assertion) { 00012 uint8_t ld2 = line/100; 00013 uint8_t ld1 = (line-100*ld2)/10; 00014 uint8_t fd1 = file/10; 00015 display.vertDecimal(file-10*fd1,fd1,line-10*ld1-100*ld2,ld1,ld2); 00016 } 00017 } 00018 00019 void example_assert() { 00020 int a=2; 00021 int b=3; 00022 // this is line 345, wee assume this file has number 27 00023 assert(27,346,a*b==6); 00024 assert(27,2047,a*b==7); 00025 release_fiber(); 00026 } 00027
Generated on Mon Jul 18 2022 21:57:34 by
 1.7.2