Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As mentioned above, the registered callback handler is executed whenever a value was written to a mapped variable node.

Code Block
languagec
static void appl_fieldbusVariableChangeExec(
    void *pCbArg,                               /**< application specific callback argument */
    uint32_t fbVarId0,                          /**< fieldbus specific variable ID 0 */
    uint32_t fbVarId1,                          /**< fieldbus specific variable ID 1 */
    uint32_t fbVarId2,                          /**< fieldbus specific variable ID 2 */
    void *pData,                                /**< new fieldbus variable value */
    uint32_t size                               /**< size of new value (if non-numeric data type) */
)
{
    GOAL_APPL_FB_HANDLER_T *pFbHandle;          /* fieldbus handle */
    uint32_t cpySize;                           /* string copy size */

    pFbHandle = (GOAL_APPL_FB_HANDLER_T *) pCbArg;
    if ((GOAL_APPL_FB_VAR2_ID0 == fbVarId0) &&
             (GOAL_APPL_FB_VAR2_ID1 == fbVarId1) &&
             (GOAL_APPL_FB_VAR2_ID2 == fbVarId2)) {
        goal_logInfo("write access to variable 02: %"FMT_d32, *((int32_t *) pData));
        GOAL_MEMCPY(&pFbHandle->var02, pData, size);
    }

    /* ... */
}

...