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.
Fork of Task330_blocking by
Revision 6:2050203fd22b, committed 2019-09-18
- Comitter:
- noutram
- Date:
- Wed Sep 18 10:49:18 2019 +0000
- Parent:
- 5:a9a9d3b7f62a
- Commit message:
- 2019
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo-self-test.cpp Wed Sep 18 10:49:18 2019 +0000 @@ -0,0 +1,21 @@ +#include "demo-self-test.hpp" + +void POST() +{ + puts("LEDs ON"); + red_led = 1; + yellow_led = 1; + green_led = 1; + onboardLED = 1; + wait(0.5); + puts("LEDs OFF"); + red_led = 0; + yellow_led = 0; + green_led = 0; + onboardLED = 0; + wait(0.5); + puts("Polling Switches"); + printf("sw1: %d\r\n", (sw1 == 1)); + printf("sw2: %d\r\n", (sw2 == 1)); + printf("Blue Button: %d\r\n", (button == 1)); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo-self-test.hpp Wed Sep 18 10:49:18 2019 +0000 @@ -0,0 +1,17 @@ +#ifndef __DEMO_SELF_TEST__ +#define __DEMO_SELF_TEST__ + +#include "mbed.h" +extern void POST(); + +//Hardware objects +extern DigitalOut red_led; //CountUp is in its critical section +extern DigitalOut yellow_led; //CountDown is in its critical section +extern DigitalOut green_led; //counter != 0 +extern DigitalOut onboardLED; + +extern DigitalIn button; +extern DigitalIn sw1; +extern DigitalIn sw2; + +#endif \ No newline at end of file
--- a/main.cpp Tue Oct 24 13:27:27 2017 +0000 +++ b/main.cpp Wed Sep 18 10:49:18 2019 +0000 @@ -2,6 +2,8 @@ #define N 1000000 #define RELEASED 0 #define PRESSED 1 +#include "demo-self-test.hpp" + //Hardware objects DigitalOut red_led(PE_15); //CountUp is in its critical section @@ -17,11 +19,8 @@ //illustrate the problem of blocking hardware int main() { - //Light up - red_led = 1; - yellow_led = 1; - green_led = 1; - onboardLED = 1; + //Power On Self Test (POST) + POST(); //Now loop forever while(1) { @@ -43,4 +42,3 @@ wait(0.5); }; } -
--- a/mbed-os.lib Tue Oct 24 13:27:27 2017 +0000 +++ b/mbed-os.lib Wed Sep 18 10:49:18 2019 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#6e0d01cd13e8aca7bf4d697c3699ec9225386881 +https://github.com/ARMmbed/mbed-os/#1bf6b20df9d3cd5f29f001ffc6f0d0fcbbb96118
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed_app.json Wed Sep 18 10:49:18 2019 +0000 @@ -0,0 +1,3 @@ +{ + "requires": ["bare-metal"] +} \ No newline at end of file