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.
Dependencies: ELEC350-Practicals-FZ429
Fork of Task621-mbedos54 by
Revision 9:ac5a5458abe3, committed 2017-11-09
- Comitter:
- noutram
- Date:
- Thu Nov 09 15:19:28 2017 +0000
- Parent:
- 8:2deeed44c6c3
- Commit message:
- updated for ELEC350
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ELEC350-Practicals-FZ429.lib Thu Nov 09 15:19:28 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/University-of-Plymouth-Stage-2-and-3/code/ELEC350-Practicals-FZ429/#6f9f2e93a0be
--- a/main.cpp Mon Apr 03 11:45:25 2017 +0000
+++ b/main.cpp Thu Nov 09 15:19:28 2017 +0000
@@ -1,31 +1,19 @@
#include "mbed.h"
-#include "rtos.h"
+
#include "string.h"
#include <stdio.h>
#include <ctype.h>
+#include "sample_hardware.hpp"
#define DELAY 200
-//Digital outputs
-DigitalOut onBoardLED(LED1);
-DigitalOut redLED(D7);
-DigitalOut yellowLED(D6);
-DigitalOut greenLED(D5);
-
-//Serial Interface
-Serial pc(USBTX, USBRX);
-
-//Digital inputs
-DigitalIn onBoardSwitch(USER_BUTTON);
-DigitalIn SW1(D4);
-DigitalIn SW2(D3);
//Thread ID for the Main function (CMSIS API)
osThreadId tidMain;
void thread1()
{
- pc.printf("Entering thread 1\n");
+ printf("Entering thread 1\n");
while (true) {
yellowLED = 1;
Thread::wait(DELAY);
@@ -37,7 +25,7 @@
//This thread has higher priority
void thread2()
{
- pc.printf("Entering thread 2\n");
+ printf("Entering thread 2\n");
while (true) {
redLED = 1;
if (SW1 == 1) {
@@ -57,13 +45,12 @@
//Main thread
int main() {
- redLED = 0;
- yellowLED = 0;
- greenLED = 0;
-
+ post();
+
//Main thread ID
tidMain = Thread::gettid();
+ //Create a thread with normal priority
Thread t1(osPriorityNormal);
t1.start(thread1);
@@ -73,7 +60,7 @@
Thread t2(osPriorityAboveNormal);
t2.start(thread2);
- pc.printf("Main Thread\n");
+ printf("Main Thread\n");
while (true) {
Thread::wait(osWaitForever);
}
--- a/mbed-os.lib Mon Apr 03 11:45:25 2017 +0000 +++ b/mbed-os.lib Thu Nov 09 15:19:28 2017 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#50b3418e45484ebf442b88cd935a2d5355402d7d +https://github.com/ARMmbed/mbed-os/#78474a5129e18e136cc7e872adbaa5b74fbb8f6a
