1.1.7 How to create Low-power sensor

Overview

This section provides step by step information for generating Low power sensor using Touch Configurator in MCC.

Note: To create a new project, follow the steps in the Generate Touch Project with MCC Melody page in the case of MPLAB® Code Configurator (MCC) Melody or the Generate Touch Project with MCC Harmony page in the case of MPLAB® Code Configurator (MCC) Harmony.

Creating Low-power sensor

Step 1: Open Touch Configurator

Select MCC and open Touch Configurator in Resource Management (MCC) tab

Step 2: Create Low Power Sensor

Once the Touch Configurator is opened, in Create tab → Add the required number of Buttons/Sliders/Wheels. Select the required sensor and click Configure as Low power.

Step 3: Creating a Low-Power sensor

  1. Event System Driven Low-Power

    To create Event System Driven Low Power, once the sensor is configured as Low power, open Touch Configurator ConfigureLow power Configure Event System option will be checked by default.

    Note: Event System Driven Low Power can be configured with only one Low-power sensor.

    Note: In case multiple sensors are selected while enabling Low Power, on enabling Configure event system, a dialog box appears indicating that only one sensor can be configured as low power sensor and provides an option to select the Low power sensor from a drop down.

    The following animation shows how to configure event system based low power sensor.

  2. Configuring Low-Power without Event System

    To create a Low Power sensor without Event system, open Touch Configurator ConfigureLow power → and uncheck Configure Event System

    To configure Low Power parameters, select Configure tab → Low power option and the following parameters can be configured according to user requirements.

    1. Low Power Measurement Period
    2. Touch inactivity Timeout &
    3. Low Power Drift Wakeup

    The details of each parameter can be seen by hovering the mouse over the parameter value drop downs in the configurator.

    The following animation shows how to configure low power sensor without event system.

  3. Configuring Lump as Low-Power

    Initially, the required sensors are selected and lump is configured. A detailed description on creating a lump sensor is given in How to create Lump Sensor page.

    Select the Lump Sensor and click Configure as Low Power.

    Once the lump sensor is configured as Low power sensor, it can be setup with either Event system enabled or disabled as given in Section 2 and 3.

Step 4: Update Important Notes

Update the specified hints in the Project files and the Devices Resources tab.

Note: The first and second hints given can be added to the project after Generation.

Enable SLPCTRL frm Device Resources

In Device ResourcesSystem → Add SLPCTRL as below. It gets added in the Project Graph/Builder.

Step 5: Generate Low-power sensor code

Click Generate in Resource Management (MCC) tab.

Add touch_process() and call sleep instruction in the mainwhile() loop as shown.