Nico Bollen / LIN

Dependents:   MBED_LIN_RGB_Master_Example

Revision:
1:58b5d1e8fae3
Parent:
0:c91a9ebab739
Child:
2:6d4c7f841a5d
--- a/LinMaster.h	Tue May 06 19:56:48 2014 +0000
+++ b/LinMaster.h	Tue May 06 20:17:35 2014 +0000
@@ -1,5 +1,5 @@
-/**
- * Master device LIN communication library for mbed
+/*
+ * A master device LIN communication library for mbed
  * 
  * Copyright (C) 2014 TASS Belgium NV
  * 
@@ -25,6 +25,25 @@
  
 #include "mbed.h"
 
+#ifndef MBED_LIN_MASTER_H
+#define MBED_LIN_MASTER_H
+
+#include "mbed.h"
+
+/**  A master device LIN communication library for mbed
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "LinMaster.h"
+ * 
+ * LinMaster lin(p30);
+ * 
+ * int main() {
+ *     (void)lin.init();
+ *     (void)lin.sendframe(M2S, 0x3C, (uint8_t*)u8Data, 8);
+ * }
+ * @endcode
+ */
 class LinMaster
 {
 public:
@@ -63,8 +82,23 @@
      */
     uint16_t Baudrate(void);
     
+    /** Send frame direction */
+    enum FrameDir {
+        M2S,     /**< Master to Slave */
+        S2M      /**< Slave to Master */
+    };
     
-    bool SendFrame(bool blDir, uint8_t u8ID, uint8_t* ptrData, uint8_t u8Len);
+    /** Send a frame on the LIN bus
+     *
+     * @param Dir direction of the frame
+     * @param u8ID LIN Frame ID
+     * @param ptrData pointer to the data to be transmitted/received
+     * @param u8Len lenght of the data to be transmitted/received
+     * @return
+     *   true on succes,
+     *   false on fail
+     */
+    bool SendFrame(FrameDir Dir, uint8_t u8ID, uint8_t* ptrData, uint8_t u8Len);
 
 private:
     uint16_t u16BitPeriod;
@@ -72,3 +106,5 @@
     uint8_t u8DelimLen;
     PinName MyPin;
 };
+
+#endif /* MBED_LIN_MASTER_H */