Driver for the capacitive sense slider available on the EFM32 Giant, Wonder and Leopard starter kits.

Dependents:   EFM32 RDA5807M RDS Radio EMF32-Segment-Touch-Demo EFM32_Bugs MFALHIMOHAMMED ... more

Information

All examples in this repo are considered EXPERIMENTAL QUALITY, meaning this code has been created as one-off proof-of-concept and is suitable as a demonstration for experimental purposes only. This code will not be regularly maintained by Silicon Labs and there is no guarantee that these projects will work across all environments, SDK versions and hardware.

/media/uploads/stevew817/screenshot_2015-03-17_13.40.06.png

Files at this revision

API Documentation at this revision

Comitter:
Steven Cooreman
Date:
Tue Mar 17 12:44:15 2015 -0500
Child:
1:6647338e62d8
Child:
2:f361a6f65884
Commit message:
Initial commit

Changed in this revision

EFM32_CapSenseSlider.cpp Show annotated file Show diff for this revision Revisions of this file
EFM32_CapSenseSlider.h Show annotated file Show diff for this revision Revisions of this file
caplesense.c Show annotated file Show diff for this revision Revisions of this file
caplesense.h Show annotated file Show diff for this revision Revisions of this file
capsenseconfig_gg_stk.h Show annotated file Show diff for this revision Revisions of this file
capsenseconfig_lg_stk .h Show annotated file Show diff for this revision Revisions of this file
capsenseconfig_tg_stk.h Show annotated file Show diff for this revision Revisions of this file
capsenseconfig_wg_stk.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EFM32_CapSenseSlider.cpp	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,153 @@
+/***************************************************************************//**
+ * @file EFM32_CapSenseSlider.cpp
+ * @brief Driver class for the capacitive touch slider on some EFM32 STK's.
+ *******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
+ * obligation to support this Software. Silicon Labs is providing the
+ * Software "AS IS", with no express or implied warranties of any kind,
+ * including, but not limited to, any implied warranties of merchantability
+ * or fitness for any particular purpose or warranties against infringement
+ * of any proprietary rights of a third party.
+ *
+ * Silicon Labs will not be liable for any consequential, incidental, or
+ * special damages, or any other relief, or for any claim by any third party,
+ * arising from your use of this Software.
+ *
+ ******************************************************************************/
+
+#include <mbed.h>
+#include "platform.h"
+
+#include "EFM32_CapSenseSlider.h"
+#include "em_lesense.h"
+
+namespace silabs {
+    /*
+     * Constructor.
+     */
+    EFM32_CapSenseSlider::EFM32_CapSenseSlider() :
+        _channelCallback(this, &EFM32_CapSenseSlider::channelCallbackHandler),
+        _scanCallback(this, &EFM32_CapSenseSlider::scanCallbackHandler)
+    {
+        _touchCb = NULL;
+        _untouchCb = NULL;
+        _slideCb = NULL;
+        _trippingPoint = 0;
+        _lastValue = -1;
+        _position = -1;
+        _touched = false;
+        _running = false;
+    }
+
+    /*
+     * Start measuring
+     */
+    void EFM32_CapSenseSlider::start() {
+        if(_running == false) {
+            CAPLESENSE_Init(true);
+            CAPLESENSE_setupCallbacks((cbptr_t)_scanCallback.entry(), (cbptr_t)_channelCallback.entry());
+            blockSleepMode(EM2);
+            _running = true;
+        }
+    }
+
+    /*
+     * Stop measuring
+     */
+    void EFM32_CapSenseSlider::stop() {
+        if(_running == true) {
+            LESENSE_ScanStop();
+            unblockSleepMode(EM2);
+            _running = false;
+        }
+    }
+
+    /*
+     * Attach a callback handler, which gets called once on touch
+     * callback: pointer to a void (void) function. If null, then the callback gets disabled.
+     */
+    void EFM32_CapSenseSlider::attach_touch(cbptr_t callback) {
+        _touchCb = callback;
+    }
+
+    /*
+     * Attach a callback handler, which gets called once on releasing touch
+     * callback: pointer to a void (void) function. If null, then the callback gets disabled.
+     */
+    void EFM32_CapSenseSlider::attach_untouch(cbptr_t callback) {
+        _untouchCb = callback;
+    }
+
+    /*
+     * Attach a callback which will trigger once the slider value passes a certain point.
+     *
+     * trip: point accross which the callback gets called.
+     * callback: pointer to a void (void) function. If null, then the callback gets disabled.
+     */
+    void EFM32_CapSenseSlider::attach_slide(int32_t trip, cbptr_t callback) {
+        _slideCb = callback;
+        _trippingPoint = trip;
+    }
+
+    /*
+     * Check whether the slider is currently being touched.
+     */
+    bool EFM32_CapSenseSlider::isTouched() {
+        return _touched;
+    }
+
+    /*
+     * Get the current position
+     */
+    int32_t EFM32_CapSenseSlider::get_position() {
+        return _position;
+    }
+
+    void EFM32_CapSenseSlider::channelCallbackHandler(void) {
+        /* When a touch is detected, go to responsive scan mode */
+        CAPLESENSE_setupLESENSE(false);
+    }
+
+    void EFM32_CapSenseSlider::scanCallbackHandler(void) {
+        /* Calculate slider position */
+        _position = CAPLESENSE_getSliderPosition();
+        /* Check for touch */
+        if(_position < 0) {
+            /* Slider is no longer being touched */
+            if(_touched == true) {
+                _touched = false;
+                if(_untouchCb != NULL) _untouchCb();
+            }
+            /* When no longer touched, go to sense mode */
+            CAPLESENSE_setupLESENSE(true);
+            return;
+        }
+
+        /* Touched, check if this is the first touch */
+        if(_touched == false) {
+            _touched = true;
+            if(_touchCb != NULL) _touchCb();
+        }
+
+        /* Check if we tripped the threshold */
+        if((_lastValue != _position) && (_slideCb != NULL)) {
+            if((_trippingPoint == -1) || (_position >= _trippingPoint)) _slideCb();
+        }
+
+        _lastValue = _position;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EFM32_CapSenseSlider.h	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,151 @@
+/***************************************************************************//**
+ * @file EFM32_CapSenseSlider.h
+ * @brief Driver class for the capacitive touch slider on some EFM32 STK's.
+ *******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
+ * obligation to support this Software. Silicon Labs is providing the
+ * Software "AS IS", with no express or implied warranties of any kind,
+ * including, but not limited to, any implied warranties of merchantability
+ * or fitness for any particular purpose or warranties against infringement
+ * of any proprietary rights of a third party.
+ *
+ * Silicon Labs will not be liable for any consequential, incidental, or
+ * special damages, or any other relief, or for any claim by any third party,
+ * arising from your use of this Software.
+ *
+ ******************************************************************************/
+
+#ifndef SILABS_EFM32_CAPSENSESLIDER_H
+#define SILABS_EFM32_CAPSENSESLIDER_H
+
+#define TARGET_EFM32
+#define TARGET_EFM32GG_STK3700
+
+#ifndef TARGET_EFM32
+#error "The Silicon Labs EFM32 CapSenseSlider library is specifically designed for EFM32 targets."
+#elif (defined(TARGET_EFM32GG_STK3700) || defined(TARGET_EFM32TG_STK3300) || defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800))
+#include "platform.h"
+#include <mbed.h>
+
+#include "caplesense.h"
+#include "CThunk.h"
+
+typedef void (*cbptr_t)(void);
+
+namespace silabs {
+    
+/**  A driver for the capacitive touch slider on some EFM32 STKs
+ *
+ * Currently supports EFM32 Wonder, Giant and Leopard Gecko kits.
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "EFM32_CapSenseSlider.h"
+ * 
+ * silabs::EFM32_CapSenseSlider capSlider;
+ *
+ * void touchCallback(void) {
+ *   if(!capSlider.isTouched()) {
+ *       printf("Lost touch");
+ *   } else {
+ *       printf("Finger detected! Position %d", capSlider.getPosition());
+ *   }
+ * }
+ * 
+ * int main() {
+ *     capSlider.start();
+ *     capSlider.attach_touch(touchCallback);
+ *     
+ *     while(1) sleep();
+ * }
+ * @endcode
+ */
+class EFM32_CapSenseSlider {
+public:
+    /**
+     * Constructor.
+     */
+    EFM32_CapSenseSlider();
+
+    /**
+     * Start measuring
+     */
+    void start();
+
+    /**
+     * Stop measuring
+     */
+    void stop();
+
+    /**
+     * Attach a callback handler, which gets called once on touch
+     *
+     * @param callback   pointer to a void (void) function. If null, then the callback gets disabled.
+     */
+    void attach_touch(cbptr_t callback = NULL);
+
+    /**
+     * Attach a callback handler, which gets called once on releasing touch
+     *
+     * @param callback   pointer to a void (void) function. If null, then the callback gets disabled.
+     */
+    void attach_untouch(cbptr_t callback = NULL);
+
+    /**
+     * Attach a callback which will trigger once the slider value passes a certain point.
+     *
+     * @param trip       point after which the callback gets called. If -1, the callback gets called on any change in position.
+     * @param callback   pointer to a void (void) function. If null, then the callback gets disabled.
+     */
+    void attach_slide(int32_t trip = -1, cbptr_t callback = NULL);
+
+    /**
+     * Check whether the slider is currently being touched.
+     *
+     * @return           True if a finger is currently detected.
+     */
+    bool isTouched();
+
+    /**
+     * Get the current position
+     *
+     * @return           The finger position on the slider (0-48). -1 if not touched.
+     */
+    int32_t get_position();
+
+protected:
+    CThunk<EFM32_CapSenseSlider> _channelCallback;
+    CThunk<EFM32_CapSenseSlider> _scanCallback;
+
+    cbptr_t _slideCb;
+    cbptr_t _touchCb;
+    cbptr_t _untouchCb;
+    int32_t _trippingPoint;
+    bool _running;
+    bool _touched;
+    volatile int32_t _lastValue, _position;
+
+    void channelCallbackHandler(void);
+    void scanCallbackHandler(void);
+
+};
+}
+#else
+#error "Target is not supported. (supported targets: EFM32WG/LG/GG/TG/G STK's)"
+#endif //TARGET Check
+
+#endif //SILABS_EFM32_CAPSENSESLIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/caplesense.c	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,544 @@
+/**************************************************************************//**
+ * @file
+ * @brief Capacitive sense driver
+ * @version 3.20.9
+ ******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * This file is licensensed under the Silabs License Agreement. See the file
+ * "Silabs_License_Agreement.txt" for details. Before using this software for
+ * any purpose, you must agree to the terms of that agreement.
+ *
+ ******************************************************************************/
+
+
+
+
+/* EM header files */
+#include "em_device.h"
+
+/* Drivers */
+#include "caplesense.h"
+#include "em_emu.h"
+#include "em_acmp.h"
+#include "em_assert.h"
+#include "em_cmu.h"
+#include "em_emu.h"
+#include "em_gpio.h"
+#include "em_int.h"
+#include "em_lesense.h"
+
+/* Capacitive sense configuration */
+//#include "caplesenseconfig.h"
+// ^^ Already included through caplesense.h ^^
+
+/**************************************************************************//**
+ * @brief This vector stores the latest read values from LESENSE
+ * @param LESENSE_CHANNELS Vector of channels.
+ *****************************************************************************/
+static volatile uint32_t channelValues[LESENSE_CHANNELS] =
+{
+/*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */
+  0, 0, 0, 0, 0, 0, 0, 0,
+/*  Ch8,   Ch9,   Ch10,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */
+  0, 0, 0, 0, 0, 0, 0, 0
+};
+
+
+/**************************************************************************//**
+ * @brief  This stores the maximum values seen by a channel
+ * @param LESENSE_CHANNELS Vector of channels.
+ *****************************************************************************/
+static volatile uint32_t channelMaxValues[LESENSE_CHANNELS] =
+{
+/*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */
+  1, 1, 1, 1, 1, 1, 1, 1,
+/*  Ch8,   Ch9,   Ch11,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */
+  1, 1, 1, 1, 1, 1, 1, 1
+};
+
+/**************************************************************************//**
+ * @brief  A bit vector which represents the channels to iterate through
+ * @param LESENSE_CHANNELS Vector of channels.
+ *****************************************************************************/
+static const bool channelsInUse[LESENSE_CHANNELS] = LESENSE_CAPSENSE_CH_IN_USE;
+static bool init = true;
+
+/**************************************************************************//**
+ * Prototypes
+ *****************************************************************************/
+void CAPLESENSE_setupCMU(void);
+void CAPLESENSE_setupGPIO(void);
+void CAPLESENSE_setupACMP(void);
+
+
+/**************************************************************************//**
+ * Local variables
+ *****************************************************************************/
+/** Callback function for LESENSE interrupts. */
+static void (*lesenseScanCb)(void);
+/** Callback function for LESENSE interrupts. */
+static void (*lesenseChCb)(void);
+
+/** The current channel we are sensing */
+static volatile uint8_t currentChannel;
+
+
+
+/**************************************************************************//**
+ * @brief  Setup the CMU
+ *****************************************************************************/
+void CAPLESENSE_setupCMU(void)
+{
+  /* Ensure core frequency has been updated */
+  SystemCoreClockUpdate();
+
+  /* Enable HF peripheral clock. */
+  CMU_ClockEnable(cmuClock_HFPER, 1);
+  /* Enable clock for GPIO. */
+  CMU_ClockEnable(cmuClock_GPIO, 1);
+  /* Enable clock for ACMP0. */
+  CMU_ClockEnable(cmuClock_ACMP0, 1);
+  /* Enable clock for ACMP1. */
+  CMU_ClockEnable(cmuClock_ACMP1, 1);
+  /* Enable CORELE clock. */
+  CMU_ClockEnable(cmuClock_CORELE, 1);
+  /* Enable clock for LESENSE. */
+  CMU_ClockEnable(cmuClock_LESENSE, 1);
+
+  /* Enable clock divider for LESENSE. */
+  CMU_ClockDivSet(cmuClock_LESENSE, cmuClkDiv_1);
+}
+
+
+/**************************************************************************//**
+ * @brief  Setup the GPIO
+ *****************************************************************************/
+void CAPLESENSE_setupGPIO(void)
+{
+  /* Configure the drive strength of the ports for the light sensor. */
+  GPIO_DriveModeSet(CAPLESENSE_SLIDER_PORT0, gpioDriveModeStandard);
+
+  /* Initialize the 4 GPIO pins of the touch slider for using them as LESENSE
+   * scan channels for capacitive sensing. */
+  GPIO_PinModeSet(CAPLESENSE_SLIDER_PORT0, CAPLESENSE_SLIDER0_PIN, gpioModeDisabled, 0);
+  GPIO_PinModeSet(CAPLESENSE_SLIDER_PORT0, CAPLESENSE_SLIDER1_PIN, gpioModeDisabled, 0);
+  GPIO_PinModeSet(CAPLESENSE_SLIDER_PORT0, CAPLESENSE_SLIDER2_PIN, gpioModeDisabled, 0);
+  GPIO_PinModeSet(CAPLESENSE_SLIDER_PORT0, CAPLESENSE_SLIDER3_PIN, gpioModeDisabled, 0);
+}
+
+
+/**************************************************************************//**
+ * @brief  Setup the ACMP
+ *****************************************************************************/
+void CAPLESENSE_setupACMP(void)
+{
+  /* ACMP capsense configuration constant table. */
+  static const ACMP_CapsenseInit_TypeDef initACMP =
+  {
+    .fullBias                 = false,
+    .halfBias                 = false,
+    .biasProg                 =                  0x7,
+    .warmTime                 = acmpWarmTime512,
+    .hysteresisLevel          = acmpHysteresisLevel7,
+    .resistor                 = acmpResistor0,
+    .lowPowerReferenceEnabled = false,
+    .vddLevel                 =                 0x3D,
+    .enable                   = false
+  };
+
+
+  /* Configure ACMP locations, ACMP output to pin disabled. */
+  ACMP_GPIOSetup(ACMP0, 0, false, false);
+  ACMP_GPIOSetup(ACMP1, 0, false, false);
+
+  /* Initialize ACMPs in capacitive sense mode. */
+  ACMP_CapsenseInit(ACMP0, &initACMP);
+  ACMP_CapsenseInit(ACMP1, &initACMP);
+
+  /* Don't enable ACMP, LESENSE controls it! */
+}
+
+
+/**************************************************************************//**
+ * @brief  Setup the LESENSE for capavitive sensing
+ * @param sleep If true, go into sleep mode.
+ *****************************************************************************/
+void CAPLESENSE_setupLESENSE(bool sleep)
+{
+  uint8_t     i;
+
+  /* Array for storing the calibration values. */
+  static uint16_t capsenseCalibrateVals[4];
+
+  /* LESENSE channel configuration constant table in sense mode. */
+  static const LESENSE_ChAll_TypeDef initChsSense = LESENSE_CAPSENSE_SCAN_CONF_SENSE;
+  /* LESENSE channel configuration constant table in sleep mode. */
+  static const LESENSE_ChAll_TypeDef initChsSleep = LESENSE_CAPSENSE_SCAN_CONF_SLEEP;
+  /* LESENSE central configuration constant table. */
+  static const LESENSE_Init_TypeDef  initLESENSE =
+  {
+    .coreCtrl         =
+    {
+      .scanStart    = lesenseScanStartPeriodic,
+      .prsSel       = lesensePRSCh0,
+      .scanConfSel  = lesenseScanConfDirMap,
+      .invACMP0     = false,
+      .invACMP1     = false,
+      .dualSample   = false,
+      .storeScanRes = false,
+      .bufOverWr    = true,
+      .bufTrigLevel = lesenseBufTrigHalf,
+      .wakeupOnDMA  = lesenseDMAWakeUpDisable,
+      .biasMode     = lesenseBiasModeDutyCycle,
+      .debugRun     = false
+    },
+
+    .timeCtrl         =
+    {
+      .startDelay     =          0U
+    },
+
+    .perCtrl          =
+    {
+      .dacCh0Data     = lesenseDACIfData,
+      .dacCh0ConvMode = lesenseDACConvModeDisable,
+      .dacCh0OutMode  = lesenseDACOutModeDisable,
+      .dacCh1Data     = lesenseDACIfData,
+      .dacCh1ConvMode = lesenseDACConvModeDisable,
+      .dacCh1OutMode  = lesenseDACOutModeDisable,
+      .dacPresc       =                        0U,
+      .dacRef         = lesenseDACRefBandGap,
+      .acmp0Mode      = lesenseACMPModeMuxThres,
+      .acmp1Mode      = lesenseACMPModeMuxThres,
+      .warmupMode     = lesenseWarmupModeNormal
+    },
+
+    .decCtrl          =
+    {
+      .decInput  = lesenseDecInputSensorSt,
+      .chkState  = false,
+      .intMap    = true,
+      .hystPRS0  = false,
+      .hystPRS1  = false,
+      .hystPRS2  = false,
+      .hystIRQ   = false,
+      .prsCount  = true,
+      .prsChSel0 = lesensePRSCh0,
+      .prsChSel1 = lesensePRSCh1,
+      .prsChSel2 = lesensePRSCh2,
+      .prsChSel3 = lesensePRSCh3
+    }
+  };
+
+  /* Only initialize main LESENSE parameters once. */
+  if (init)
+  {
+    /* Initialize LESENSE interface with RESET. */
+    LESENSE_Init(&initLESENSE, true);
+  }
+
+  /* Different configuration for "sleep" and "sense" modes. */
+  if (sleep)
+  {
+    /* Stop LESENSE before configuration. */
+    LESENSE_ScanStop();
+
+    /* Wait until the currently active scan is finished. */
+    while (LESENSE_STATUS_SCANACTIVE & LESENSE_StatusGet()) ;
+
+    /* Clear result buffer. */
+    LESENSE_ResultBufferClear();
+
+    /* Set scan frequency (in Hz). */
+    (void) LESENSE_ScanFreqSet(0U, 4U);
+
+    /* Set clock divisor for LF clock. */
+    LESENSE_ClkDivSet(lesenseClkLF, lesenseClkDiv_1);
+
+    /* Configure scan channels. */
+    LESENSE_ChannelAllConfig(&initChsSleep);
+
+    /* Restore calibration values. */
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER0_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[0]);
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER1_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[1]);
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER2_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[2]);
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER3_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[3]);
+
+    /* Disable scan complete interrupt. */
+    LESENSE_IntDisable(LESENSE_IEN_SCANCOMPLETE);
+  }
+  else
+  {
+    /* Stop LESENSE before configuration. */
+    LESENSE_ScanStop();
+
+    /* Wait until the currently active scan is finished. */
+    while (LESENSE_STATUS_SCANACTIVE & LESENSE_StatusGet()) ;
+
+    /* Clean scan complete interrupt flag. */
+    LESENSE_IntClear(LESENSE_IEN_SCANCOMPLETE);
+
+    /* Clear result buffer. */
+    LESENSE_ResultBufferClear();
+
+    /* Set scan frequency (in Hz). */
+    (void) LESENSE_ScanFreqSet(0U, 5U);
+
+    /* Set clock divisor for LF clock. */
+    LESENSE_ClkDivSet(lesenseClkLF, lesenseClkDiv_8);
+
+    /* Configure scan channels. */
+    LESENSE_ChannelAllConfig(&initChsSense);
+
+    /* Enable scan complete interrupt. */
+    LESENSE_IntEnable(LESENSE_IEN_SCANCOMPLETE);
+  }
+
+  /* Enable LESENSE interrupt in NVIC. */
+  NVIC_SetPriority(LESENSE_IRQn, 2);
+  NVIC_EnableIRQ(LESENSE_IRQn);
+
+  /* Start scanning LESENSE channels. */
+  LESENSE_ScanStart();
+
+  /* Run it only once. */
+  if (init)
+  {
+    /* Assuming that the pads are not touched at first, we can use the result as
+     * the threshold value to calibrate the capacitive sensing in LESENSE. */
+    init = false;
+
+    /* Waiting for buffer to be full. */
+    while (!(LESENSE->STATUS & LESENSE_STATUS_BUFHALFFULL)) ;
+
+    /* Read out steady state values from LESENSE for calibration. */
+    for (i = 0U; i < CAPLESENSE_NUMOF_SLIDERS; i++)
+    {
+      capsenseCalibrateVals[i] = LESENSE_ScanResultDataBufferGet(i) - CAPLESENSE_SENSITIVITY_OFFS;
+    }
+
+    /* Set calibration values. */
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER0_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[0]);
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER1_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[1]);
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER2_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[2]);
+    LESENSE_ChannelThresSet(CAPLESENSE_SLIDER3_PIN, CAPLESENSE_ACMP_VDD_SCALE, capsenseCalibrateVals[3]);
+  }
+}
+
+
+/**************************************************************************//**
+ * @brief  LESENSE callback setup
+ * @param  scanCb Scan callback
+ * @param  chCb Channel callback
+ *****************************************************************************/
+void CAPLESENSE_setupCallbacks(void (*scanCb)(void), void (*chCb)(void))
+{
+  lesenseScanCb = scanCb;
+  lesenseChCb   = chCb;
+}
+
+
+/**************************************************************************//**
+ * @brief  LESENSE interrupt handler
+ *****************************************************************************/
+void LESENSE_IRQHandler(void)
+{
+  uint32_t count;
+
+
+  /* LESENSE scan complete interrupt. */
+  if (LESENSE_IF_SCANCOMPLETE & LESENSE_IntGetEnabled())
+  {
+    LESENSE_IntClear(LESENSE_IF_SCANCOMPLETE);
+
+    /* Iterate trough all channels */
+    for (currentChannel = 0; currentChannel < LESENSE_CHANNELS; currentChannel++)
+    {
+      /* If this channel is not in use, skip to the next one */
+      if (!channelsInUse[currentChannel])
+      {
+        continue;
+      }
+
+      /* Read out value from LESENSE buffer */
+      count = LESENSE_ScanResultDataGet();
+
+      /* Store value in channelValues */
+      channelValues[currentChannel] = count;
+
+      /* Update channelMaxValues */
+      if (count > channelMaxValues[currentChannel])
+      {
+        channelMaxValues[currentChannel] = count;
+      }
+    }
+
+    /* Call callback function. */
+    if (lesenseScanCb != 0x00000000)
+    {
+      lesenseScanCb();
+    }
+  }
+
+  /* LESENSE channel interrupt. */
+  if (CAPLESENSE_CHANNEL_INT & LESENSE_IntGetEnabled())
+  {
+    /* Clear flags. */
+    LESENSE_IntClear(CAPLESENSE_CHANNEL_INT);
+
+    /* Call callback function. */
+    if (lesenseChCb != 0x00000000)
+    {
+      lesenseChCb();
+    }
+  }
+}
+
+
+/**************************************************************************//**
+ * @brief Get the channelValue for a sensor segment
+ * @param capSegment
+ * @return channel
+ *****************************************************************************/
+uint8_t  CAPLESENSE_getSegmentChannel(uint8_t capSegment)
+{
+  uint8_t channel;
+
+  switch (capSegment)
+  {
+  case(0):
+    channel = SLIDER_PART0_CHANNEL;
+    break;
+  case(1):
+    channel = SLIDER_PART1_CHANNEL;
+    break;
+  case(2):
+    channel = SLIDER_PART2_CHANNEL;
+    break;
+  default:
+    channel = SLIDER_PART3_CHANNEL;
+    break;
+  }
+  return channel;
+
+}
+
+
+/**************************************************************************//**
+ * @brief Get the current channelValue for a channel
+ * @param channel The channel.
+ * @return The channelValue.
+ *****************************************************************************/
+uint32_t CAPLESENSE_getVal(uint8_t channel)
+{
+  return channelValues[channel];
+}
+
+/**************************************************************************//**
+ * @brief Get the current normalized channelValue for a channel
+ * @param channel The channel.
+ * @return The channel value in range (0-256).
+ *****************************************************************************/
+uint32_t CAPLESENSE_getNormalizedVal(uint8_t channel)
+{
+  uint32_t max = channelMaxValues[channel];
+  return (channelValues[channel] << 8) / max;
+}
+
+
+
+/**************************************************************************//**
+ * @brief Get the position of the slider
+ * @return The position of the slider if it can be determined,
+ *         -1 otherwise.
+ *****************************************************************************/
+int32_t CAPLESENSE_getSliderPosition(void)
+{
+  int      i;
+  int      minPos = -1;
+  uint32_t minVal = 236; /* adjust it */
+  /* Values used for interpolation. There is two more which represents the edges.
+   * This makes the interpolation code a bit cleaner as we do not have to make special
+   * cases for handling them */
+  uint32_t interpol[6]      = { 255, 255, 255, 255, 255, 255 };
+  uint32_t channelPattern[] = { 0,                        SLIDER_PART0_CHANNEL + 1,
+                                SLIDER_PART1_CHANNEL + 1,
+                                SLIDER_PART2_CHANNEL + 1,
+                                SLIDER_PART3_CHANNEL + 1 };
+
+  /* The calculated slider position. */
+  int position;
+
+  /* Iterate through the 4 slider bars and calculate the current value divided by
+   * the maximum value multiplied by 256.
+   * Note that there is an offset of 1 between channelValues and interpol.
+   * This is done to make interpolation easier.
+   */
+  for (i = 1; i < CAPLESENSE_NUMOF_SLIDERS + 1; i++)
+  {
+    /* interpol[i] will be in the range 0-256 depending on channelMax */
+    interpol[i]  = channelValues[channelPattern[i] - 1] << 8;
+    interpol[i] /= channelMaxValues[channelPattern[i] - 1];
+    /* Find the minimum value and position */
+    if (interpol[i] < minVal)
+    {
+      minVal = interpol[i];
+      minPos = i;
+    }
+  }
+  /* Check if the slider has not been touched */
+  if (minPos == -1)
+    return -1;
+
+  /* Start position. Shift by 4 to get additional resolution. */
+  /* Because of the interpol trick earlier we have to substract one to offset that effect */
+  position = (minPos - 1) << 4;
+
+  /* Interpolate with pad to the left */
+  position -= ((256 - interpol[minPos - 1]) << 3)
+              / (256 - interpol[minPos]);
+
+  /* Interpolate with pad to the right */
+  position += ((256 - interpol[minPos + 1]) << 3)
+              / (256 - interpol[minPos]);
+
+  return position;
+}
+
+
+/**************************************************************************//**
+ * @brief Send the capacative sense system to sleep mode.
+ *****************************************************************************/
+void CAPLESENSE_Sleep(void)
+{
+  /* Go to EM2 and wait for the measurement to complete. */
+  EMU_EnterEM2(true);
+}
+
+
+/**************************************************************************//**
+ * @brief Initializes the capacative sense system without LESENSE.
+ * @param sleep If true, go into sleep mode.
+ *****************************************************************************/
+void CAPLESENSE_Init(bool sleep)
+{
+  /* Disable interrupts */
+  INT_Disable();
+
+  /* Setup CMU. */
+  CAPLESENSE_setupCMU();
+  /* Setup GPIO. */
+  CAPLESENSE_setupGPIO();
+  /* Setup ACMP. */
+  CAPLESENSE_setupACMP();
+  /* Setup LESENSE. */
+  CAPLESENSE_setupLESENSE(sleep);
+
+  /* Initialization done, enable interrupts globally. */
+  INT_Enable();
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/caplesense.h	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,66 @@
+/**************************************************************************//**
+ * @file
+ * @brief Capacitive sense driver
+ * @version 3.20.9
+ ******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * This file is licensensed under the Silabs License Agreement. See the file
+ * "Silabs_License_Agreement.txt" for details. Before using this software for
+ * any purpose, you must agree to the terms of that agreement.
+ *
+ ******************************************************************************/
+
+
+
+#ifndef __CAPLESENSE_H_
+#define __CAPLESENSE_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#if defined(TARGET_EFM32GG_STK3700)
+#include "capsenseconfig_gg_stk.h"
+#elif defined(TARGET_EFM32TG_STK3300)
+#include "capsenseconfig_tg_stk.h"
+#elif defined(TARGET_EFM32LG_STK3600)
+#include "capsenseconfig_lg_stk.h"
+#elif defined(TARGET_EFM32WG_STK3800)
+#include "capsenseconfig_wg_stk.h"
+#else
+#error "Unknown target for EFM32 CapSenseSlider driver."
+#endif
+
+/***************************************************************************//**
+ * @addtogroup Drivers
+ * @{
+ ******************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup CapSense
+ * @{
+ ******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8_t  CAPLESENSE_getSegmentChannel(uint8_t capSegment);
+uint32_t CAPLESENSE_getVal(uint8_t channel);
+uint32_t CAPLESENSE_getNormalizedVal(uint8_t channel);
+int32_t CAPLESENSE_getSliderPosition(void);
+void CAPLESENSE_Init(bool sleep);
+void CAPLESENSE_setupLESENSE(bool sleep);
+void CAPLESENSE_setupCallbacks(void (*scanCb)(void), void (*chCb)(void));
+void CAPLESENSE_Sleep(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} (end group CapSense) */
+/** @} (end group Drivers) */
+
+#endif /* __CAPSENSE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/capsenseconfig_gg_stk.h	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,194 @@
+/***************************************************************************//**
+ * @file
+ * @brief Low Energy Sensor (LESENSE) configuration file for capacitive slider
+ *        on EFM32 Giant Gecko STK (STK_3700).
+ * @version 3.20.5
+ *******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * This file is licensensed under the Silabs License Agreement. See the file
+ * "Silabs_License_Agreement.txt" for details. Before using this software for
+ * any purpose, you must agree to the terms of that agreement.
+ *
+ ******************************************************************************/
+
+
+#include "em_lesense.h"
+
+/***************************************************************************//**
+ * @addtogroup Drivers
+ * @{
+ ******************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup CapSense
+ * @{
+ ******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**************************************************************************//**
+ * Macro definitions
+ *****************************************************************************/
+#define CAPLESENSE_SENSITIVITY_OFFS    1U
+#define CAPLESENSE_NUMOF_SLIDERS       4                          /**< Number of sliders */
+#define CAPLESENSE_ACMP_VDD_SCALE      LESENSE_ACMP_VDD_SCALE     /**< Upper voltage threshold */
+
+#define CAPLESENSE_SLIDER_PORT0        gpioPortC                  /**< Slider Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 0 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PIN         8UL                        /**< Slider 0 Pin 8 */
+#define CAPLESENSE_SLIDER1_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 1 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER1_PIN         9UL                        /**< Slider 1 Pin 9 */
+#define CAPLESENSE_SLIDER2_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 2 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER2_PIN         10UL                       /**< Slider 2 Pin 10 */
+#define CAPLESENSE_SLIDER3_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 3 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER3_PIN         11UL                       /**< Slider 3 Pin 11 */
+
+
+#define CAPLESENSE_CHANNEL_INT        (LESENSE_IF_CH8 | LESENSE_IF_CH9 | LESENSE_IF_CH10 | LESENSE_IF_CH11)
+#define LESENSE_CHANNELS        16  /**< Number of channels for the Low Energy Sensor Interface. */
+
+#define SLIDER_PART0_CHANNEL    8   /**< Touch slider channel Part 0 */
+#define SLIDER_PART1_CHANNEL    9   /**< Touch slider channel Part 1 */
+#define SLIDER_PART2_CHANNEL    10  /**< Touch slider channel Part 2 */
+#define SLIDER_PART3_CHANNEL    11  /**< Touch slider channel Part 3 */
+
+/** Upper voltage threshold. */
+#define LESENSE_ACMP_VDD_SCALE    0x37U
+
+
+#define LESENSE_CAPSENSE_CH_IN_USE {\
+/*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */\
+  false, false, false, false, false, false, false, false,\
+/*  Ch8,   Ch9,   Ch10,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */\
+  true,  true,  true,  true,  false, false, false, false\
+}
+
+/** Configuration for capacitive sense channels in sense mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SENSE                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x0FU,                    /* Sample delay is set to 15(+1) sample clock cycles. */                   \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* ACMP will be used in comparison. */                                     \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x00U,                    /* Counter threshold has been set to 0x00. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for capacitive sense channels in sleep mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SLEEP                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    true,                     /* Enable interrupts on channel. */                                        \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x01U,                    /* Sample delay is set to 1(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* Counter will be used in comparison. */                                  \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x0EU,                    /* Counter threshold has been set to 0x0E. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for disabled channels. */
+#define LESENSE_DISABLED_CH_CONF                                                                         \
+  {                                                                                                      \
+    false,                    /* Disable scan channel. */                                                \
+    false,                    /* Disable the assigned pin on scan channel. */                            \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    false,                    /* Disabled to store counter value in the result buffer. */                \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 5(+1) excitation clock cycles. */             \
+    0x00U,                    /* Sample delay is set to 7(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    0x00U,                    /* ACMP threshold has been set to 0. */                                    \
+    lesenseSampleModeCounter, /* ACMP output will be used in comparison. */                              \
+    lesenseSetIntNone,        /* No interrupt is generated by the channel. */                            \
+    0x00U,                    /* Counter threshold has been set to 0x01. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for scan in sense mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SENSE                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 8. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 9. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 10. */ \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 11. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+/** Configuration for scan in sleep mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SLEEP                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 8. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 9. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 10. */ \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 11. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} (end group CapSense) */
+/** @} (end group Drivers) */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/capsenseconfig_lg_stk .h	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,194 @@
+/***************************************************************************//**
+ * @file
+ * @brief Low Energy Sensor (LESENSE) configuration file for capacitive slider
+ *        on EFM32 Leopard Gecko STK (STK_3600).
+ * @version 3.20.5
+ *******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * This file is licensensed under the Silabs License Agreement. See the file
+ * "Silabs_License_Agreement.txt" for details. Before using this software for
+ * any purpose, you must agree to the terms of that agreement.
+ *
+ ******************************************************************************/
+
+
+#include "em_lesense.h"
+
+/***************************************************************************//**
+ * @addtogroup Drivers
+ * @{
+ ******************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup CapSense
+ * @{
+ ******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**************************************************************************//**
+ * Macro definitions
+ *****************************************************************************/
+#define CAPLESENSE_SENSITIVITY_OFFS    1U
+#define CAPLESENSE_NUMOF_SLIDERS       4                          /**< Number of sliders */
+#define CAPLESENSE_ACMP_VDD_SCALE      LESENSE_ACMP_VDD_SCALE     /**< Upper voltage threshold */
+
+#define CAPLESENSE_SLIDER_PORT0        gpioPortC                  /**< Slider Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 0 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PIN         8UL                        /**< Slider 0 Pin 8 */
+#define CAPLESENSE_SLIDER1_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 1 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER1_PIN         9UL                        /**< Slider 1 Pin 9 */
+#define CAPLESENSE_SLIDER2_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 2 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER2_PIN         10UL                       /**< Slider 2 Pin 10 */
+#define CAPLESENSE_SLIDER3_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 3 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER3_PIN         11UL                       /**< Slider 3 Pin 11 */
+
+
+#define CAPLESENSE_CHANNEL_INT        (LESENSE_IF_CH8 | LESENSE_IF_CH9 | LESENSE_IF_CH10 | LESENSE_IF_CH11)
+#define LESENSE_CHANNELS        16  /**< Number of channels for the Low Energy Sensor Interface. */
+
+#define SLIDER_PART0_CHANNEL    8   /**< Touch slider channel Part 0 */
+#define SLIDER_PART1_CHANNEL    9   /**< Touch slider channel Part 1 */
+#define SLIDER_PART2_CHANNEL    10  /**< Touch slider channel Part 2 */
+#define SLIDER_PART3_CHANNEL    11  /**< Touch slider channel Part 3 */
+
+/** Upper voltage threshold. */
+#define LESENSE_ACMP_VDD_SCALE    0x37U
+
+
+#define LESENSE_CAPSENSE_CH_IN_USE {\
+/*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */\
+  false, false, false, false, false, false, false, false,\
+/*  Ch8,   Ch9,   Ch10,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */\
+  true,  true,  true,  true,  false, false, false, false\
+}
+
+/** Configuration for capacitive sense channels in sense mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SENSE                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x0FU,                    /* Sample delay is set to 15(+1) sample clock cycles. */                   \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* ACMP will be used in comparison. */                                     \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x00U,                    /* Counter threshold has been set to 0x00. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for capacitive sense channels in sleep mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SLEEP                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    true,                     /* Enable interrupts on channel. */                                        \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x01U,                    /* Sample delay is set to 1(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* Counter will be used in comparison. */                                  \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x0EU,                    /* Counter threshold has been set to 0x0E. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for disabled channels. */
+#define LESENSE_DISABLED_CH_CONF                                                                         \
+  {                                                                                                      \
+    false,                    /* Disable scan channel. */                                                \
+    false,                    /* Disable the assigned pin on scan channel. */                            \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    false,                    /* Disabled to store counter value in the result buffer. */                \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 5(+1) excitation clock cycles. */             \
+    0x00U,                    /* Sample delay is set to 7(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    0x00U,                    /* ACMP threshold has been set to 0. */                                    \
+    lesenseSampleModeCounter, /* ACMP output will be used in comparison. */                              \
+    lesenseSetIntNone,        /* No interrupt is generated by the channel. */                            \
+    0x00U,                    /* Counter threshold has been set to 0x01. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for scan in sense mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SENSE                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 8. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 9. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 10. */ \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 11. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+/** Configuration for scan in sleep mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SLEEP                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 8. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 9. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 10. */ \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 11. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} (end group CapSense) */
+/** @} (end group Drivers) */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/capsenseconfig_tg_stk.h	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,198 @@
+/***************************************************************************//**
+ * @file
+ * @brief Low Energy Sensor (LESENSE) configuration file for capacitive slider
+ *        on EFM32 Tiny Gecko STK (STK_3300).
+ * @version 3.20.5
+ *******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * This file is licensensed under the Silabs License Agreement. See the file
+ * "Silabs_License_Agreement.txt" for details. Before using this software for
+ * any purpose, you must agree to the terms of that agreement.
+ *
+ ******************************************************************************/
+
+
+#include "em_lesense.h"
+
+/***************************************************************************//**
+ * @addtogroup Drivers
+ * @{
+ ******************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup CapSense
+ * @{
+ ******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**************************************************************************//**
+ * Macro definitions
+ *****************************************************************************/
+#define CAPLESENSE_SENSITIVITY_OFFS    1U
+#define CAPLESENSE_NUMOF_SLIDERS       4                          /**< Number of sliders */
+#define CAPLESENSE_ACMP_VDD_SCALE      LESENSE_ACMP_VDD_SCALE     /**< Upper voltage threshold */
+
+#define CAPLESENSE_SLIDER_PORT0        gpioPortC                  /**< Slider Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PORT        CAPSENSE_SLIDER_PORT0      /**< Slider 0 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PIN         5UL                        /**< Slider 0 Pin 5 */
+#define CAPLESENSE_SLIDER1_PORT        CAPSENSE_SLIDER_PORT0      /**< Slider 1 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER1_PIN         7UL                        /**< Slider 1 Pin 7 */
+#define CAPLESENSE_SLIDER2_PORT        CAPSENSE_SLIDER_PORT0      /**< Slider 2 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER2_PIN         12UL                       /**< Slider 2 Pin 12 */
+#define CAPLESENSE_SLIDER3_PORT        CAPSENSE_SLIDER_PORT0      /**< Slider 3 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER3_PIN         13UL                       /**< Slider 3 Pin 13 */
+
+
+#define LESENSE_CHANNELS        16  /**< Number of channels for the Low Energy Sensor Interface. */
+
+#define SLIDER_PART0_CHANNEL    5   /**< Touch slider channel Part 0 */
+#define SLIDER_PART1_CHANNEL    7   /**< Touch slider channel Part 1 */
+#define SLIDER_PART2_CHANNEL    12  /**< Touch slider channel Part 2 */
+#define SLIDER_PART3_CHANNEL    13  /**< Touch slider channel Part 3 */
+
+#define CAPLESENSE_CHANNEL_INT  (LESENSE_IF_CH5 | LESENSE_IF_CH7 | LESENSE_IF_CH12 | LESENSE_IF_CH13)
+
+/** Upper voltage threshold. */
+#define LESENSE_ACMP_VDD_SCALE    0x37U
+
+/**************************************************************************//**
+ * @brief  A bit vector which represents the channels to iterate through
+ * @param LESENSE_CHANNELS Vector of channels.
+ *****************************************************************************/
+#define LESENSE_CAPSENSE_CH_IN_USE {\
+/*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */\
+  false, false, false, false, false, true, false, true,\
+/*  Ch8,   Ch9,   Ch10,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */\
+  false, false, false, false, true,  true, false, false\
+}
+
+/** Configuration for capacitive sense channels in sense mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SENSE                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x0FU,                    /* Sample delay is set to 15(+1) sample clock cycles. */                   \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* ACMP will be used in comparison. */                                     \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x00U,                    /* Counter threshold has been set to 0x00. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for capacitive sense channels in sleep mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SLEEP                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    true,                     /* Enable interrupts on channel. */                                        \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x01U,                    /* Sample delay is set to 1(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* Counter will be used in comparison. */                                  \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x0EU,                    /* Counter threshold has been set to 0x0E. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for disabled channels. */
+#define LESENSE_DISABLED_CH_CONF                                                                         \
+  {                                                                                                      \
+    false,                    /* Disable scan channel. */                                                \
+    false,                    /* Disable the assigned pin on scan channel. */                            \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    false,                    /* Disabled to store counter value in the result buffer. */                \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 5(+1) excitation clock cycles. */             \
+    0x00U,                    /* Sample delay is set to 7(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    0x00U,                    /* ACMP threshold has been set to 0. */                                    \
+    lesenseSampleModeCounter, /* ACMP output will be used in comparison. */                              \
+    lesenseSetIntNone,        /* No interrupt is generated by the channel. */                            \
+    0x00U,                    /* Counter threshold has been set to 0x01. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for scan in sense mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SENSE                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 7. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 8. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 9. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 10. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 11. */ \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 12. */ \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+/** Configuration for scan in sleep mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SLEEP                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 7. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 8. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 9. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 10. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 11. */ \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 12. */ \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} (end group CapSense) */
+/** @} (end group Drivers) */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/capsenseconfig_wg_stk.h	Tue Mar 17 12:44:15 2015 -0500
@@ -0,0 +1,194 @@
+/***************************************************************************//**
+ * @file
+ * @brief Low Energy Sensor (LESENSE) configuration file for capacitive slider
+ *        on EFM32 Wonder Gecko STK (STK_3800).
+ * @version 3.20.5
+ *******************************************************************************
+ * @section License
+ * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
+ *******************************************************************************
+ *
+ * This file is licensensed under the Silabs License Agreement. See the file
+ * "Silabs_License_Agreement.txt" for details. Before using this software for
+ * any purpose, you must agree to the terms of that agreement.
+ *
+ ******************************************************************************/
+
+
+#include "em_lesense.h"
+
+/***************************************************************************//**
+ * @addtogroup Drivers
+ * @{
+ ******************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup CapSense
+ * @{
+ ******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**************************************************************************//**
+ * Macro definitions
+ *****************************************************************************/
+#define CAPLESENSE_SENSITIVITY_OFFS    1U
+#define CAPLESENSE_NUMOF_SLIDERS       4                          /**< Number of sliders */
+#define CAPLESENSE_ACMP_VDD_SCALE      LESENSE_ACMP_VDD_SCALE     /**< Upper voltage threshold */
+
+#define CAPLESENSE_SLIDER_PORT0        gpioPortC                  /**< Slider Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 0 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER0_PIN         8UL                        /**< Slider 0 Pin 8 */
+#define CAPLESENSE_SLIDER1_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 1 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER1_PIN         9UL                        /**< Slider 1 Pin 9 */
+#define CAPLESENSE_SLIDER2_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 2 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER2_PIN         10UL                       /**< Slider 2 Pin 10 */
+#define CAPLESENSE_SLIDER3_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 3 Port. GPIO Port C */
+#define CAPLESENSE_SLIDER3_PIN         11UL                       /**< Slider 3 Pin 11 */
+
+
+#define CAPLESENSE_CHANNEL_INT        (LESENSE_IF_CH8 | LESENSE_IF_CH9 | LESENSE_IF_CH10 | LESENSE_IF_CH11)
+#define LESENSE_CHANNELS        16  /**< Number of channels for the Low Energy Sensor Interface. */
+
+#define SLIDER_PART0_CHANNEL    8   /**< Touch slider channel Part 0 */
+#define SLIDER_PART1_CHANNEL    9   /**< Touch slider channel Part 1 */
+#define SLIDER_PART2_CHANNEL    10  /**< Touch slider channel Part 2 */
+#define SLIDER_PART3_CHANNEL    11  /**< Touch slider channel Part 3 */
+
+/** Upper voltage threshold. */
+#define LESENSE_ACMP_VDD_SCALE    0x37U
+
+
+#define LESENSE_CAPSENSE_CH_IN_USE {\
+/*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */\
+  false, false, false, false, false, false, false, false,\
+/*  Ch8,   Ch9,   Ch10,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */\
+  true,  true,  true,  true,  false, false, false, false\
+}
+
+/** Configuration for capacitive sense channels in sense mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SENSE                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x0FU,                    /* Sample delay is set to 15(+1) sample clock cycles. */                   \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* ACMP will be used in comparison. */                                     \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x00U,                    /* Counter threshold has been set to 0x00. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for capacitive sense channels in sleep mode. */
+#define LESENSE_CAPSENSE_CH_CONF_SLEEP                                                                   \
+  {                                                                                                      \
+    true,                     /* Enable scan channel. */                                                 \
+    true,                     /* Enable the assigned pin on scan channel. */                             \
+    true,                     /* Enable interrupts on channel. */                                        \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    true,                     /* Enabled to store counter value in the result buffer. */                 \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
+    0x01U,                    /* Sample delay is set to 1(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
+    lesenseSampleModeCounter, /* Counter will be used in comparison. */                                  \
+    lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
+    0x0EU,                    /* Counter threshold has been set to 0x0E. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for disabled channels. */
+#define LESENSE_DISABLED_CH_CONF                                                                         \
+  {                                                                                                      \
+    false,                    /* Disable scan channel. */                                                \
+    false,                    /* Disable the assigned pin on scan channel. */                            \
+    false,                    /* Disable interrupts on channel. */                                       \
+    lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
+    lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
+    false,                    /* Don't use alternate excitation pins for excitation. */                  \
+    false,                    /* Disabled to shift results from this channel to the decoder register. */ \
+    false,                    /* Disabled to invert the scan result bit. */                              \
+    false,                    /* Disabled to store counter value in the result buffer. */                \
+    lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
+    lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
+    0x00U,                    /* Excitation time is set to 5(+1) excitation clock cycles. */             \
+    0x00U,                    /* Sample delay is set to 7(+1) sample clock cycles. */                    \
+    0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
+    0x00U,                    /* ACMP threshold has been set to 0. */                                    \
+    lesenseSampleModeCounter, /* ACMP output will be used in comparison. */                              \
+    lesenseSetIntNone,        /* No interrupt is generated by the channel. */                            \
+    0x00U,                    /* Counter threshold has been set to 0x01. */                              \
+    lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
+  }
+
+/** Configuration for scan in sense mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SENSE                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 8. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 9. */  \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 10. */ \
+      LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 11. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+/** Configuration for scan in sleep mode. */
+#define LESENSE_CAPSENSE_SCAN_CONF_SLEEP                 \
+  {                                                      \
+    {                                                    \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 8. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 9. */  \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 10. */ \
+      LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 11. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
+      LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
+      LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
+    }                                                    \
+  }
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} (end group CapSense) */
+/** @} (end group Drivers) */