Module Communication Protocol Wrapper 1.3.0

Compact host implementation of Module Communication Protocol

  1. Ole-Johan
    Module Communication Protocol (MCP) is the lowest level communication protocol implementation for the XeThru modules, used on the module FW and XeThru host components, e.g. Module Connector. MCP Wrapper (MCPW) goes one step further for embedded host implementation adding a wrapper with convenience methods around the MCP. Compared to Module Connector, which is a more feature rich component with logging and buffering capabilities, MCWP offers a similar interface with only the basic transport methods wrapped in a more easy-to-use interface.

    Typical use for MCPW is when implementing a host application communicating with a XeThru module on an embedded target that does not need or have available the Module Connector.

    MCPW is implemented in C. Example code available in C and C++.

    Example code setting up the X4M300 Presence profile:
    Code:
        int res = 0;
        res = mcpw_set_sensor_mode(mcpw, XTS_SM_STOP, 0);
        res |= mcpw_load_profile(mcpw, XTS_ID_APP_PRESENCE_2);
        res |= mcpw_set_detection_zone(mcpw, 0.6, 3.0);
        res |= mcpw_set_sensitivity(mcpw, 9);
        res |= mcpw_set_led_control(mcpw, 2, 100);
        res |= mcpw_set_sensor_mode(mcpw, XTS_SM_RUN, 0);
    

    Presence Single message parsed and presented in callback:
    Code:
    void mcpw_on_host_parser_presence_single(PresenceSingleData presence_single_data, void * user_data)
    {
        cout << "Counter=" << presence_single_data.frame_counter;
        cout << ", State=";
        if (presence_single_data.presence_state == XTS_VAL_PRESENCE_PRESENCESTATE_PRESENCE)
            cout << "Presence";
        else if (presence_single_data.presence_state == XTS_VAL_PRESENCE_PRESENCESTATE_NO_PRESENCE)
            cout << "No presence";
        else
            cout << "Initializing";
        if (presence_single_data.distance>0)
            cout << ", Distance=" << presence_single_data.distance;
    
        cout << endl;
    }
    

    This resource contains source code, example code, and documentation.
    Example code is available for Windows, Raspberry Pi and Atmel SAMG55 (with FreeRTOS) platforms, and easily portable to more platforms.

Recent Updates

  1. MCP Wrapper v1.3.0
  2. MCP Wrapper v1.1.0

Recent Reviews

  1. Yoda
    Yoda
    5/5,
    Version: 1.0.1
    This wrapper is very helpful! a couple questions though, I wrote my own function and tried to enable baseband data with the following code:
    const int ec[1] = { XTS_SACR_ID_BASEBAND_OUTPUT_AMPLITUDE_PHASE };
    createAppSetIntCommand(XTS_SACR_OUTPUTBASEBAND, &ec, 1, mcpw->on_mcp_messagebuild, (void*)mcpw);
    but I am not getting data, any idea why this is happening?
    1. Ole-Johan
      Author's Response
      Check out the latest update, which supports baseband output.