1.0

Dependencies:   EthernetInterface mbed-rtos

Revision:
9:4e882da5a890
Parent:
8:2cd23c180dfe
Child:
10:ad8346bafe5e
--- a/Telemetry.h	Fri Dec 04 15:54:30 2015 +0000
+++ b/Telemetry.h	Fri Dec 04 16:03:16 2015 +0000
@@ -7,97 +7,95 @@
 #include "mbed.h"
 #include "EthernetInterface.h"
 
-/** Ethernet Interface for send/receive Datastructs over udp 
- *
- * By Sebastian Donner
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * @code
- * #include "mbed.h"
- * #include "Telemetry.h"
- *
- * Telemetry Network(p21,p22);
+/* Ethernet Interface for send/receive Datastructs over udp 
+ 
+  By Sebastian Donner
+ 
+  Permission is hereby granted, free of charge, to any person
+  obtaining a copy of this software and associated documentation
+  files (the "Software"), to deal in the Software without
+  restriction, including without limitation the rights to use,
+  copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following
+  conditions:
+ 
+  The above copyright notice and this permission notice shall be
+  included in all copies or substantial portions of the Software.
+  
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  OTHER DEALINGS IN THE SOFTWARE.
+ 
+  @code
+  #include "mbed.h"
+  #include "Telemetry.h"
+ 
+  Telemetry Network(p21,p22);
 
- * Serial debug(USBTX, USBRX);
-
-
- * uint8_t buffer[255];
- * int     SELF_PORT        = 8889;
+  Serial debug(USBTX, USBRX);
+  uint8_t buffer[255];
+  int     SELF_PORT        = 8889;
 
- * typedef struct struct_test
- * {
- * struct_test()
- * :length(9), ID(0)
- * {}
- * uint8_t  length              ;//1
- * uint8_t  ID                  ;//2
- * uint8_t  flag_bit0      : 1  ;//3.0
- * uint8_t  flag_bit1      : 1  ;//3.1
- * uint8_t  flagbyte_2          ;//4
- * uint16_t word                ;//6
- * int16_t counter             ;//8
- * uint8_t  cs                  ;//9
- * } Tstruct_test;
- *
- *
- * struct_test  test;
- *
- * uint8_t* struct_id[5];
- *
- * main()
- * {
- *  debug.baud(115200);
- *  Network.InitEthernetConnection();
- *  Network.ConnectSocket_UDP_Client();
- *  Network.ConnectSocket_UDP_Server(SELF_PORT);
- *
- *  struct_id[0]=&test.length;
- *
- *  debug.printf("%s",Network.ip_self);
- *  while(1)
- *{
- * Network.Rec_Data_UDP_Server((char*)buffer, 255);
- * if (Network.Rec_Struct(buffer))                  // receive and CS check
- *   {
- *    uint8_t* b_pointer;
- *
- *    b_pointer = struct_id[buffer[1]];     // Pointer to received Struct
- *
- *    for(int i = 0; i < (buffer[0]); i++)  // Copy buffer to Struct
- *    {
- *     *b_pointer = buffer[i];
- *      b_pointer++;
- *    }
- *
- *    b_pointer = struct_id[buffer[1]];     // Pointer to received Struct
- *
- *    Network.Send_Struct_UDP_Client(Network.input_Server, b_pointer); // Send received Struct back to sender
- *   }
- *
- * wait(1);
- *  }
- *}
- * @endcode
+  typedef struct struct_test
+  {
+  struct_test()
+  :length(9), ID(0)
+  {}
+  uint8_t  length              ;//1
+  uint8_t  ID                  ;//2
+  uint8_t  flag_bit0      : 1  ;//3.0
+  uint8_t  flag_bit1      : 1  ;//3.1
+  uint8_t  flagbyte_2          ;//4
+  uint16_t word                ;//6
+  int16_t counter             ;//8
+  uint8_t  cs                  ;//9
+  } Tstruct_test;
+ 
+ 
+  struct_test  test;
+ 
+  uint8_t* struct_id[5];
+ 
+  main()
+  {
+   debug.baud(115200);
+   Network.InitEthernetConnection();
+   Network.ConnectSocket_UDP_Client();
+   Network.ConnectSocket_UDP_Server(SELF_PORT);
+ 
+   struct_id[0]=&test.length;
+ 
+   debug.printf("%s",Network.ip_self);
+   while(1)
+   {
+    Network.Rec_Data_UDP_Server((char*)buffer, 255);
+    if (Network.Rec_Struct(buffer))                  // receive and CS check
+    {
+     uint8_t* b_pointer;
+ 
+     b_pointer = struct_id[buffer[1]];     // Pointer to received Struct
+ 
+     for(int i = 0; i < (buffer[0]); i++)  // Copy buffer to Struct
+     {
+       b_pointer = buffer[i];
+       b_pointer++;
+     }
+ 
+     b_pointer = struct_id[buffer[1]];     // Pointer to received Struct
+ 
+     Network.Send_Struct_UDP_Client(Network.input_Server, b_pointer); // Send received Struct back to sender
+    }
+ 
+    wait(1);
+   }
+  }
+ @endcode
  */