update code
Dependencies: X_NUCLEO_IKS01A1 mbed-rtos mbed
Diff: main.cpp
- Revision:
- 4:2c73682f05b5
- Parent:
- 3:f61ae69ed662
- Child:
- 6:397db5c5ad11
--- a/main.cpp Tue May 03 12:27:07 2016 +0000 +++ b/main.cpp Tue May 03 14:48:13 2016 +0000 @@ -2,9 +2,7 @@ //#include <pthread.h> //#include <semaphore.h> #include "buffer.h" - #include "mbed.h" - //#include "string.h" #include <stdio.h> #include <ctype.h> @@ -14,6 +12,8 @@ #define RAND_DIVISOR 100000000 #define TRUE 1 +void thread1(const void *); + //setting out variables /** @@ -32,20 +32,18 @@ */ const int amountOfSample = 150; - const int BUFFER_SIZE = 75; -// mutex lock +// Mutex lock Mutex *bufferLock; - - //buffer char buffer_item[BUFFER_SIZE]; -Thread tid; //thread id -pthread_attr_t attr; //set of thread attributes + +Thread *tid; //thread id +//pthread_attr_t attr; //set of thread attributes void *producer(void *param); //producer thread void *consumer(void *param); //consumer thread @@ -633,12 +631,12 @@ while(!sampleRate -> lock()){}; char outputString = 'OUT OF RANGE'; - if(newSampleRate =>0.1 && newSampleRate =<60.0){ + if(newSampleRate >= 0.1 && newSampleRate <= 60.0){ sampleRate -> setSampleRate(newSampleRate); char decimel; printDouble(&decimel, newSampleRate, 2); - outputString = 'UPDATE<' + decimel+ '>'; + outputString = 'UPDATE<' + decimel + '>'; } sampleRate -> unlock(); @@ -747,7 +745,7 @@ //Thread pressTread(; //Thread displayTread; //Thread sampleTread; -Thread inputTread; +Thread *inputTread; Thread deleteRecordTread(deleteRecord); //Thread setDateTread; //Thread setTimeTread; @@ -763,7 +761,7 @@ int main() { - + tid = new Thread(&thread1); SampleRate sampleRate = SampleRate(); TakeSample takeSample = TakeSample(); SampleTemp sampleTemp = SampleTemp();