Memory pools

Dependencies:   ELEC350-Practicals-FZ429

Fork of Task632-mbedos54 by Nicholas Outram

Files at this revision

API Documentation at this revision

Comitter:
noutram
Date:
Tue Nov 14 15:36:59 2017 +0000
Parent:
11:6cfaf7dfecb9
Commit message:
Converted to F429ZI

Changed in this revision

ELEC350-Practicals-FZ429.lib 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
diff -r 6cfaf7dfecb9 -r 087a7d135bf4 ELEC350-Practicals-FZ429.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ELEC350-Practicals-FZ429.lib	Tue Nov 14 15:36:59 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/University-of-Plymouth-Stage-2-and-3/code/ELEC350-Practicals-FZ429/#3250ba797c16
diff -r 6cfaf7dfecb9 -r 087a7d135bf4 main.cpp
--- a/main.cpp	Mon Apr 03 14:16:17 2017 +0000
+++ b/main.cpp	Tue Nov 14 15:36:59 2017 +0000
@@ -2,6 +2,7 @@
 #include "string.h"
 #include <stdio.h>
 #include <ctype.h>
+#include "sample_hardware.hpp"
 
 #define SWITCH1_RELEASE 1
 
@@ -9,22 +10,9 @@
 void thread2();
 void switchISR();
 
-//Analogue inputs
-AnalogIn adcIn(A0);
-
-//Digital outputs
-DigitalOut onBoardLED(LED1);
-DigitalOut redLED(D7);
-DigitalOut yellowLED(D6);
-DigitalOut greenLED(D5);
-
-//Digital inputs
-DigitalIn  onBoardSwitch(USER_BUTTON);
-DigitalIn  sw1(D4);                         //CONSIDER CHANGING THIS TO AN INTERRUPT
-DigitalIn  sw2(D3);
 
 //Threads
-Thread *t1;
+Thread t1;
 
 //Class type
 class message_t {
@@ -53,8 +41,8 @@
     //Read sample - make a copy
     float sample = adcIn;
     //Grab switch state
-    uint32_t switch1State = sw1;
-    uint32_t switch2State = sw2;
+    uint32_t switch1State = SW1;
+    uint32_t switch2State = SW2;
     
     //Allocate a block from the memory pool
     message_t *message = mpool.alloc();
@@ -121,8 +109,7 @@
     timer.attach(&adcISR, 0.1);
                
     //Threads
-    t1 = new Thread(); 
-    t1->start(thread1);
+    t1.start(thread1);
     
     printf("Main Thread\n");
     while (true) {
@@ -130,5 +117,3 @@
         puts("Main Thread Alive");
     }
 }
-
-   
diff -r 6cfaf7dfecb9 -r 087a7d135bf4 mbed-os.lib
--- a/mbed-os.lib	Mon Apr 03 14:16:17 2017 +0000
+++ b/mbed-os.lib	Tue Nov 14 15:36:59 2017 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#50b3418e45484ebf442b88cd935a2d5355402d7d
+https://github.com/ARMmbed/mbed-os/#78474a5129e18e136cc7e872adbaa5b74fbb8f6a