University of Plymouth - Stages 1, 2 and 3 / Mbed OS Task330_blocking

Fork of Task330_blocking by University of Plymouth - Stages 1, 2 and 3

Files at this revision

API Documentation at this revision

Comitter:
noutram
Date:
Wed Sep 18 10:49:18 2019 +0000
Parent:
5:a9a9d3b7f62a
Commit message:
2019

Changed in this revision

demo-self-test.cpp Show annotated file Show diff for this revision Revisions of this file
demo-self-test.hpp Show annotated file Show diff for this revision Revisions of this file
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
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- /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