Jarda Pajskr / freemaster_lib

Dependents:   FreeMASTER_HelloWorld FreeMASTER_HelloWorld2 FreeMASTER_HelloWorld3

Fork of freemaster_lib by Jarda Pajskr

Revision:
0:fb135bf60f82
Child:
1:5033fe82d4c2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/class/freemaster_class.h	Mon May 05 20:13:09 2014 +0000
@@ -0,0 +1,67 @@
+#ifndef MBED_FREEMASTER_H
+#define MBED_FREEMASTER_H
+
+#include "platform.h"
+
+#if DEVICE_SERIAL
+
+#include "serial_api.h"
+#include "freemaster.h"
+
+namespace mbed {
+
+/** A FreeMASTER serial driver
+ *
+ * Can be used for debugging code over the serial line
+ *
+ * Example:
+ * @code
+ * // Set up the FreeMASTER serial driver
+ *
+ * #include "mbed.h"
+ * #include "freemaster_class.h"
+ *
+ * Freemaster fm(USBTX, USBRX);
+ *
+ * FMSTR_TSA_TABLE_LIST_BEGIN()
+ * FMSTR_TSA_TABLE_LIST_END()
+ *
+ * //define global variables
+ * volatile unsigned char example_var8;
+ * volatile unsigned short example_var16;
+ *
+ * int main() {
+ *     //register global or static variables
+ *     fm.TsaAddVar(FMSTR_TSA_RW_VAR_CFG(example_var8,FMSTR_TSA_UINT8));
+ *     //register read only variable
+ *     fm.TsaAddVar(FMSTR_TSA_RO_VAR_CFG(example_var16,FMSTR_TSA_UINT16));
+ *     while(1)
+ *     {
+ *         //your application     
+ *     }
+ * }
+ * @endcode
+ */
+class Freemaster {
+
+public:
+    Freemaster(PinName tx, PinName rx, uint32_t tsaMembers = 20, uint32_t recBufferSize = 1024, uint32_t flags = 0);
+    void baud(int baudrate);
+    void Recorder(void);
+    void Poll(void);
+
+    FMSTR_BOOL TsaAddVar(FMSTR_TSATBL_STRPTR name, FMSTR_TSATBL_STRPTR type, FMSTR_TSATBL_VOIDPTR addr, FMSTR_TSATBL_VOIDPTR info);
+
+    static void _irq_handler(uint32_t id, SerialIrq irq_type);
+protected:
+    serial_t        _serial;
+    int             _baud;
+    void*           tsaTable;
+    void*           recBuf;
+  
+};
+
+} // namespace mbed
+#endif
+
+#endif
\ No newline at end of file