first compiled version

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Revision:
4:6c17983d6192
Parent:
3:0945093f48ec
Parent:
2:43cd60e0e32f
Child:
5:d40a563e2c3b
--- a/main.cpp	Tue Mar 04 08:48:41 2014 +0000
+++ b/main.cpp	Tue Mar 04 08:56:46 2014 +0000
@@ -19,21 +19,49 @@
 C12832_LCD lcd;
 Serial pc(USBTX, USBRX); // tx, rx
 
+Serial      pc(USBTX, USBRX);   //To differentiate from LCD functions
+
 AnalogIn pot1(p19);
 MemoryPool<float, 10> potReadingBuffer;
 Queue<float,10> potReadingQueue;
 
+<<<<<<< local
 MemoryPool<char[BUFFER], COOKIEQUEUE> cookieReadingBuffer;
 Queue<char[BUFFER],COOKIEQUEUE> cookieReadingQueue;
+=======
+>>>>>>> other
 
+<<<<<<< local
+=======
+/******************************************************************
+*
+*An LCD thread that updates the LCD based on information 
+*received from other threads via IPC
+*
+*Uses the top 3 lines of the LCD to reflect the pot, the 
+*temperature, and the cookie. This task must use IPC (with 
+*timeout) methods to get data from each of the previous threads
+*
+*******************************************************************/
+>>>>>>> other
 void lcdUpdate(void const*){
 while(1){
+<<<<<<< local
        osEvent evtPot = potReadingQueue.get(1200);
         if (evtPot.status == osEventMessage) {
             float *queuePot = (float*)evtPot.value.p;
             lcd.locate(0,3);
             lcd.printf("Voltage: %.2f V", *queuePot);
             potReadingBuffer.free(queuePot);      
+=======
+       osEvent evt = potReadingQueue.get();
+        if (evt.status == osEventMail) {
+            float *queue = (float*)evt.value.p;
+            pc.printf("\nVoltage: %.2f V\n\r"   , *queue);
+            
+            pc.printf("LCD updated");
+            Thread::wait(1000);
+>>>>>>> other
         }
        osEvent evtCookie = cookieReadingQueue.get(1200);
         if (evtCookie.status == osEventMessage) {
@@ -47,29 +75,66 @@
     }
 }
 
+/******************************************************************
+*
+*A POT thread that reads the pot value in a polling loop 
+*every 10 seconds and sends value to LCD thread via IPC Queue 
+*
+*******************************************************************/
 void readPOT(void const*){    
 while(1){
         float *queue = potReadingBuffer.alloc();
         *queue = pot1; 
+<<<<<<< local
         potReadingQueue.put(queue,1200);
      
     Thread::wait(10000);
+=======
+        potReadingQueue.put(queue);
+        pc.printf("POT read");
+        Thread::wait(10000);
+>>>>>>> other
     }
     
 }
 
+<<<<<<< local
 
 
+=======
+/******************************************************************
+*
+*A TEMP thread that read the temperature every 60 seconds 
+*and sends the value to the LCD task via IPC Queue
+*
+*******************************************************************/
+>>>>>>> other
 void readTemp(void const*){
+    while(1){
+        pc.printf("TEMP read");
+        Thread::wait(60000);
+    }
     
 }
 
+<<<<<<< local
 void readCookie(void const*){
     pc.printf(">Enter your fortune cookie\n>");
     char (*ptrBuffer)[BUFFER] = cookieReadingBuffer.alloc();
     char *ptrChar;
     ptrChar=*ptrBuffer;
+=======
+/******************************************************************
+*
+*A SCANF thread that reads in a fortune cookie from user 
+*and sends it to the LCD task via IPC Memory Pool
+*
+*******************************************************************/
+void threadCookie(void const*){
+    //Checks often but low priority?
+>>>>>>> other
     while(1){
+<<<<<<< local
         if(pc.readable()){
             *ptrChar=pc.getc();
             pc.putc(*ptrChar);
@@ -88,6 +153,25 @@
         }
     Thread::wait(10);
     }
+=======
+        Thread::wait(1000);
+    }  
+}
+
+
+/******************************************************************
+*
+*A TOD thread that updates the 4th line of the LCD with time 
+*of day once a minute. It shares the LCD with the LCD thread 
+*using mutual exclusion
+*
+*******************************************************************/
+void threadTOD(void const*){
+        while(1){
+            pc.printf("TOD updated");
+            Thread::wait(60000);
+    } 
+>>>>>>> other
 }
 
 DigitalOut myled(LED1);