Philip McKenna / Mbed 2 deprecated MBED_LIN_RGB_Master_Example

Dependencies:   LIN mbed

Revision:
1:bf50812995c6
Parent:
0:015c04037667
--- a/main.cpp	Fri Oct 23 15:32:21 2015 +0000
+++ b/main.cpp	Fri Oct 23 16:39:06 2015 +0000
@@ -26,6 +26,16 @@
     {0x7F, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}  // Data BroadCast + LEDs OFF + USE NAD
 };
 
+LinMaster::Frame_t S2MFrame =
+{
+    LinMaster::S2M,                 // Direction
+    LinMaster::Enhanced,            // CRC Type
+    LinMaster::Normal,              // Break Type
+    8,                              // Data Length
+    0x05,                           // Frame ID
+    {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}  // Data BroadCast + LEDs OFF + USE NAD
+};
+
 void SetLED(int Address, int OnOff, int R, int G, int B, int I, int FadingTime, int FadingOnOff);
 void SetIntensity(int arg);
 void SetLEDsOnOff(int arg);
@@ -48,7 +58,11 @@
     for(;;)
     {
         SetLED(FIRSTNAD + (rand()%NUMBEROFNODES), 1, rand()%255, rand()%255, rand()%255, rand()%100, 1, 1); //set random node to random color and intensity
-        wait_ms(40);
+        wait_ms(40);    //delay 40ms
+        LinMaster.send_frame(&S2MFrame);    //Send S2M message to get VS voltage form nodes
+        while(LinMaster.status() != LinMaster::IDLE); //wait for bus to become idle before rtreiving data from slvae
+        LinMaster.get_rx_data(S2MFrame);    //move data form slave into data bytes of S2MFrame
+        wait_ms(40);    //delay 40ms
     }
 }
 
@@ -63,8 +77,8 @@
     M2SFrame.Data[6] = G;
     M2SFrame.Data[7] = B;
    
-    (void)LinMaster.send_frame(&M2SFrame);
-    while(LinMaster.status() != LinMaster::IDLE);
+    LinMaster.send_frame(&M2SFrame);
+    //while(LinMaster.status() != LinMaster::IDLE);
 }
 
 void SetLEDsOnOff(int arg)