Warteschleife mit Inline Assembly

Files at this revision

API Documentation at this revision

Comitter:
jack1930
Date:
Fri Jan 21 16:53:34 2022 +0000
Parent:
0:154b19d0f047
Commit message:
test mit G474

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 06 14:11:48 2020 +0000
+++ b/main.cpp	Fri Jan 21 16:53:34 2022 +0000
@@ -10,6 +10,17 @@
 // Blinking rate in milliseconds
 #define BLINKING_RATE_MS                                                    500
 
+void warte()
+{   
+    asm("push   {R0,R1}          \n"
+        "ldr R0,=32000000/5*3   \n"
+        "mov R1,#1              \n"
+        "1:                     \n"  
+        "subs  R0,R1            \n"
+        "bne   1b               \n"
+        "pop   {R0,R1}          \n"
+        );    
+}
 
 int main()
 {
@@ -18,6 +29,8 @@
 
     while (true) {
         led = !led;
-        thread_sleep_for(BLINKING_RATE_MS);
+        //thread_sleep_for(BLINKING_RATE_MS);
+        //HAL_Delay(BLINKING_RATE_MS);
+        warte();
     }
 }
--- a/mbed-os.lib	Tue Oct 06 14:11:48 2020 +0000
+++ b/mbed-os.lib	Fri Jan 21 16:53:34 2022 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#cf4f12a123c05fcae83fc56d76442015cb8a39e9
+https://github.com/ARMmbed/mbed-os/#b1796dedeb8accde1cbaecf136fab96895e23d81