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.
Diff: main.cpp
- Revision:
- 3:e5c2bfd464f7
- Parent:
- 2:5d467e30afbd
- Child:
- 4:e1c35030b91a
--- a/main.cpp Fri Sep 13 12:54:24 2019 +0000 +++ b/main.cpp Wed Sep 18 10:17:32 2019 +0000 @@ -5,7 +5,7 @@ #define PRESSED 1 #ifdef TARGET_NUCLEO_F429ZI -#define ONBOARD +//#define ONBOARD #endif #ifdef ONBOARD @@ -29,7 +29,6 @@ //RED MEANS THE COUNT UP FUNCTION IS IN ITS CRITICAL SECTION red_led = 1; for (unsigned int n=0; n<N; n++) { - __disable_irq(); counter++; counter++; counter++; @@ -39,8 +38,8 @@ counter++; counter++; counter++; - counter++; - __enable_irq(); + counter++; + } red_led = 0; @@ -56,7 +55,6 @@ //YELLOW MEANS THE COUNT DOWN FUNCTION IS IN ITS CRITICAL SECTION yellow_led = 1; for (unsigned int n=0; n<N; n++) { - __disable_irq(); counter--; counter--; counter--; @@ -67,7 +65,6 @@ counter--; counter--; counter--; - __enable_irq(); } yellow_led = 0; @@ -95,9 +92,10 @@ //Run count up on the main thread countUp(); - //Now spin-lock for ever + + //Now spin for ever while(1) { - asm("nop"); + wait(0.5); }; }