gdfgdh
Dependencies: ELEC350-Practicals-FZ429
Fork of Task633-mbedos-FZ429 by
Diff: main.cpp
- Revision:
- 12:4605f1c51824
- Parent:
- 11:ae623ddb2eff
- Child:
- 13:f05daa68720c
--- a/main.cpp Mon Apr 03 14:24:10 2017 +0000 +++ b/main.cpp Tue Nov 14 18:15:59 2017 +0000 @@ -1,4 +1,5 @@ #include "mbed.h" +#include "sample_hardware.hpp" #include "string.h" #include <stdio.h> #include <ctype.h> @@ -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 { @@ -58,8 +46,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 = mail_box.alloc(); @@ -118,9 +106,8 @@ // Main thread int main() { - redLED = 0; - yellowLED = 0; - greenLED = 0; + //Power on self-test + post(); //Start message printf("Welcome\n"); @@ -130,8 +117,7 @@ timer.attach(&adcISR, 0.1); //Threads - t1 = new Thread(); - t1->start(thread1); + t1.start(thread1); printf("Main Thread\n"); while (true) {