Jarda Pajskr / freemaster_lib

Dependents:   FreeMASTER_HelloWorld FreeMASTER_HelloWorld2 FreeMASTER_HelloWorld3

Fork of freemaster_lib by Jarda Pajskr

Revision:
17:b2a783a8691f
Parent:
16:be9b137b888c
Child:
20:355a9738a180
--- a/class/freemaster_class.h	Wed Sep 10 12:31:59 2014 +0000
+++ b/class/freemaster_class.h	Wed Sep 10 16:04:07 2014 +0000
@@ -29,17 +29,18 @@
  * FMSTR_TSA_TABLE_LIST_END()
  *
  * //define global variables
- * volatile unsigned char example_var8;
- * volatile unsigned short example_var16;
+ * volatile unsigned char var8;
+ * volatile unsigned short var16;
  *
  * int main() {
  *     //register global or static variables
- *     fm.TsaAddVar(FMSTR_TSA_RW_VAR_CFG(example_var8,FMSTR_TSA_UINT8));
+ *     fm.TsaAddVar(FMSTR_TSA_RW_VAR_CFG(var8,FMSTR_TSA_UINT8));
  *     //register read only variable
- *     fm.TsaAddVar(FMSTR_TSA_RO_VAR_CFG(example_var16,FMSTR_TSA_UINT16));
+ *     fm.TsaAddVar(FMSTR_TSA_RO_VAR_CFG(var16,FMSTR_TSA_UINT16));
  *     while(1)
  *     {
- *         //your application     
+ *         //your application
+ *         var16+=var8;
  *     }
  * }
  * @endcode
@@ -69,40 +70,72 @@
      */
     void Recorder(void);
 
-    /** Triggert sampling of the recorder.
+    /** Trigger sampling of the recorder by SW.
      */
     void TriggerRec(void);
 
     /** This function can be used to detect if any Application Command is waiting to be processed by the application.
+     *
+     *  @returns
+     *    1-247                     - command needs to be processed by application\n
+     *    FMSTR_APPCMDRESULT_NOCMD  - no command is pending
      */
-    void GetAppCmd(void);
+    FMSTR_APPCMD_CODE GetAppCmd(void);
 
     /** This function can be used to retrieve the Application Command data.
+     *
+     *  @param pDataLen   Pointer to variable, which receives length of the data available in buffer.
+     *
+     *  @returns          Pointer to buffer, which holds received data. The data needs to be handled before FMSTR_AppCmdAck() call.
      */
     FMSTR_APPCMD_PDATA GetAppCmdData(FMSTR_SIZE* pDataLen);
 
     /** This function can be used to register a given function as a callback handler for an Application Command.
+     *
+     *  @param nAppCmdCode    An Application Command code for which the callback is to be registered.
+     *  @param pCallbackFunc  A pointer to a callback function which is to be registered. Use NULL to un-register a callback 
+     *                        registered previously with this Application Command.
+     *
+     *  @returns
+     *    1 if there is space to register a variable /n
+     *    0 otherwise
      */
     FMSTR_BOOL RegisterAppCmdCall(FMSTR_APPCMD_CODE nAppCmdCode, FMSTR_PAPPCMDFUNC pCallbackFunc);
 
     /** This function is used when Application Command processing is finished in the application.
+     *
+     *  @param nResultCode    The result code, which is to be returned to the FreeMASTER tool.
      */
     void AppCmdAck(FMSTR_APPCMD_RESULT nResultCode);
 
     /** This function can be used before the Application Command processing is finished.
+     *
+     *  @param nResultDataAddr  A pointer to data buffer which is to be copied to the Application Command data buffer.
+     *  @param nResultDataLen   The length of a data to be copied. It must not exceed the FMSTR_APPCMD_BUFF_SIZE value.
      */
     void AppCmdSetResponseData(FMSTR_ADDR nResultDataAddr, FMSTR_SIZE nResultDataLen);
 
     void Poll(void);
 
-    /** Register variables to TSA table
+    /** Register variables to dynamic TSA table
      *
-     *  @param name, type, addr, info, use following macros to register variable
-     @ref fmstr_tsa_table "FMSTR_TSA__xxx()" constants.
+     *  @param (name, type, addr, info) use following macros to register variable\n
+     *               FMSTR_TSA_STRUCT_CFG(name) - register structure(name)\n
+     *               FMSTR_TSA_MEMBER_CFG(parenttype,name,type) - register member(name) of (type) in structure(parenttype), \n
+     *               FMSTR_TSA_RO_VAR_CFG(name,type) - register Read Only variable(name) of (type)\n
+     *               FMSTR_TSA_RW_VAR_CFG(name,type) - register variable(name) of (type)\n
+     *               FMSTR_TSA_RO_MEM_CFG(name,type,addr,size) - register Read Only memory block(name) of (type)\n
+     *               FMSTR_TSA_RW_MEM_CFG(name,type,addr,size) - register memory block(name) of (type)\n
      *
      *  @returns
-     *    1 if there is space to register a variable,
+     *    1 if there is space to register a variable \n
      *    0 otherwise
+     *  @note use following macros to define type of variable:\n
+     *   FMSTR_TSA_UINT8, FMSTR_TSA_UINT16, FMSTR_TSA_UINT32, FMSTR_TSA_UINT64, \n
+     *   FMSTR_TSA_SINT8, FMSTR_TSA_SINT16, FMSTR_TSA_SINT32, FMSTR_TSA_SINT64, \n
+     *   FMSTR_TSA_UFRAC16, FMSTR_TSA_UFRAC32, FMSTR_TSA_FRAC16, FMSTR_TSA_FRAC32,\n
+     *   FMSTR_TSA_FLOAT, FMSTR_TSA_DOUBLE
+     *  @note Default configuration can register up to 20 variables
      */
     FMSTR_BOOL TsaAddVar(FMSTR_TSATBL_STRPTR name, FMSTR_TSATBL_STRPTR type, FMSTR_TSATBL_VOIDPTR addr, FMSTR_TSATBL_VOIDPTR info);