Silicon Labs / EFM32_CapSenseSlider

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers capsenseconfig_gg_stk.h Source File

capsenseconfig_gg_stk.h

Go to the documentation of this file.
00001 /***************************************************************************//**
00002  * @file
00003  * @brief Low Energy Sensor (LESENSE) configuration file for capacitive slider
00004  *        on EFM32 Giant Gecko STK (STK_3700).
00005  * @version 3.20.5
00006  *******************************************************************************
00007  * @section License
00008  * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
00009  *******************************************************************************
00010  *
00011  * This file is licensensed under the Silabs License Agreement. See the file
00012  * "Silabs_License_Agreement.txt" for details. Before using this software for
00013  * any purpose, you must agree to the terms of that agreement.
00014  *
00015  ******************************************************************************/
00016 
00017 
00018 #include "em_lesense.h"
00019 
00020 /***************************************************************************//**
00021  * @addtogroup Drivers
00022  * @{
00023  ******************************************************************************/
00024 
00025 /***************************************************************************//**
00026  * @addtogroup CapSense
00027  * @{
00028  ******************************************************************************/
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 /**************************************************************************//**
00035  * Macro definitions
00036  *****************************************************************************/
00037 #define CAPLESENSE_SENSITIVITY_OFFS    1U
00038 #define CAPLESENSE_NUMOF_SLIDERS       4                          /**< Number of sliders */
00039 #define CAPLESENSE_ACMP_VDD_SCALE      LESENSE_ACMP_VDD_SCALE     /**< Upper voltage threshold */
00040 
00041 #define CAPLESENSE_SLIDER_PORT0        gpioPortC                  /**< Slider Port. GPIO Port C */
00042 #define CAPLESENSE_SLIDER0_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 0 Port. GPIO Port C */
00043 #define CAPLESENSE_SLIDER0_PIN         8UL                        /**< Slider 0 Pin 8 */
00044 #define CAPLESENSE_SLIDER1_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 1 Port. GPIO Port C */
00045 #define CAPLESENSE_SLIDER1_PIN         9UL                        /**< Slider 1 Pin 9 */
00046 #define CAPLESENSE_SLIDER2_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 2 Port. GPIO Port C */
00047 #define CAPLESENSE_SLIDER2_PIN         10UL                       /**< Slider 2 Pin 10 */
00048 #define CAPLESENSE_SLIDER3_PORT        CAPLESENSE_SLIDER_PORT0      /**< Slider 3 Port. GPIO Port C */
00049 #define CAPLESENSE_SLIDER3_PIN         11UL                       /**< Slider 3 Pin 11 */
00050 
00051 
00052 #define CAPLESENSE_CHANNEL_INT        (LESENSE_IF_CH8 | LESENSE_IF_CH9 | LESENSE_IF_CH10 | LESENSE_IF_CH11)
00053 #define LESENSE_CHANNELS        16  /**< Number of channels for the Low Energy Sensor Interface. */
00054 
00055 #define SLIDER_PART0_CHANNEL    8   /**< Touch slider channel Part 0 */
00056 #define SLIDER_PART1_CHANNEL    9   /**< Touch slider channel Part 1 */
00057 #define SLIDER_PART2_CHANNEL    10  /**< Touch slider channel Part 2 */
00058 #define SLIDER_PART3_CHANNEL    11  /**< Touch slider channel Part 3 */
00059 
00060 /** Upper voltage threshold. */
00061 #define LESENSE_ACMP_VDD_SCALE    0x37U
00062 
00063 
00064 #define LESENSE_CAPSENSE_CH_IN_USE {\
00065 /*  Ch0,   Ch1,   Ch2,   Ch3,   Ch4,   Ch5,   Ch6,   Ch7    */\
00066   false, false, false, false, false, false, false, false,\
00067 /*  Ch8,   Ch9,   Ch10,  Ch11,  Ch12,  Ch13,  Ch14,  Ch15   */\
00068   true,  true,  true,  true,  false, false, false, false\
00069 }
00070 
00071 /** Configuration for capacitive sense channels in sense mode. */
00072 #define LESENSE_CAPSENSE_CH_CONF_SENSE                                                                   \
00073   {                                                                                                      \
00074     true,                     /* Enable scan channel. */                                                 \
00075     true,                     /* Enable the assigned pin on scan channel. */                             \
00076     false,                    /* Disable interrupts on channel. */                                       \
00077     lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
00078     lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
00079     false,                    /* Don't use alternate excitation pins for excitation. */                  \
00080     false,                    /* Disabled to shift results from this channel to the decoder register. */ \
00081     false,                    /* Disabled to invert the scan result bit. */                              \
00082     true,                     /* Enabled to store counter value in the result buffer. */                 \
00083     lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
00084     lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
00085     0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
00086     0x0FU,                    /* Sample delay is set to 15(+1) sample clock cycles. */                   \
00087     0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
00088     LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
00089     lesenseSampleModeCounter, /* ACMP will be used in comparison. */                                     \
00090     lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
00091     0x00U,                    /* Counter threshold has been set to 0x00. */                              \
00092     lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
00093   }
00094 
00095 /** Configuration for capacitive sense channels in sleep mode. */
00096 #define LESENSE_CAPSENSE_CH_CONF_SLEEP                                                                   \
00097   {                                                                                                      \
00098     true,                     /* Enable scan channel. */                                                 \
00099     true,                     /* Enable the assigned pin on scan channel. */                             \
00100     true,                     /* Enable interrupts on channel. */                                        \
00101     lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
00102     lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
00103     false,                    /* Don't use alternate excitation pins for excitation. */                  \
00104     false,                    /* Disabled to shift results from this channel to the decoder register. */ \
00105     false,                    /* Disabled to invert the scan result bit. */                              \
00106     true,                     /* Enabled to store counter value in the result buffer. */                 \
00107     lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
00108     lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
00109     0x00U,                    /* Excitation time is set to 0 excitation clock cycles. */                 \
00110     0x01U,                    /* Sample delay is set to 1(+1) sample clock cycles. */                    \
00111     0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
00112     LESENSE_ACMP_VDD_SCALE,   /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */               \
00113     lesenseSampleModeCounter, /* Counter will be used in comparison. */                                  \
00114     lesenseSetIntLevel,       /* Interrupt is generated if the sensor triggers. */                       \
00115     0x0EU,                    /* Counter threshold has been set to 0x0E. */                              \
00116     lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
00117   }
00118 
00119 /** Configuration for disabled channels. */
00120 #define LESENSE_DISABLED_CH_CONF                                                                         \
00121   {                                                                                                      \
00122     false,                    /* Disable scan channel. */                                                \
00123     false,                    /* Disable the assigned pin on scan channel. */                            \
00124     false,                    /* Disable interrupts on channel. */                                       \
00125     lesenseChPinExDis,        /* GPIO pin is disabled during the excitation period. */                   \
00126     lesenseChPinIdleDis,      /* GPIO pin is disabled during the idle period. */                         \
00127     false,                    /* Don't use alternate excitation pins for excitation. */                  \
00128     false,                    /* Disabled to shift results from this channel to the decoder register. */ \
00129     false,                    /* Disabled to invert the scan result bit. */                              \
00130     false,                    /* Disabled to store counter value in the result buffer. */                \
00131     lesenseClkLF,             /* Use the LF clock for excitation timing. */                              \
00132     lesenseClkLF,             /* Use the LF clock for sample timing. */                                  \
00133     0x00U,                    /* Excitation time is set to 5(+1) excitation clock cycles. */             \
00134     0x00U,                    /* Sample delay is set to 7(+1) sample clock cycles. */                    \
00135     0x00U,                    /* Measure delay is set to 0 excitation clock cycles.*/                    \
00136     0x00U,                    /* ACMP threshold has been set to 0. */                                    \
00137     lesenseSampleModeCounter, /* ACMP output will be used in comparison. */                              \
00138     lesenseSetIntNone,        /* No interrupt is generated by the channel. */                            \
00139     0x00U,                    /* Counter threshold has been set to 0x01. */                              \
00140     lesenseCompModeLess       /* Compare mode has been set to trigger interrupt on "less". */            \
00141   }
00142 
00143 /** Configuration for scan in sense mode. */
00144 #define LESENSE_CAPSENSE_SCAN_CONF_SENSE                 \
00145   {                                                      \
00146     {                                                    \
00147       LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
00148       LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
00149       LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
00150       LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
00151       LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
00152       LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
00153       LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
00154       LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
00155       LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 8. */  \
00156       LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 9. */  \
00157       LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 10. */ \
00158       LESENSE_CAPSENSE_CH_CONF_SENSE,  /* Channel 11. */ \
00159       LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
00160       LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
00161       LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
00162       LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
00163     }                                                    \
00164   }
00165 
00166 /** Configuration for scan in sleep mode. */
00167 #define LESENSE_CAPSENSE_SCAN_CONF_SLEEP                 \
00168   {                                                      \
00169     {                                                    \
00170       LESENSE_DISABLED_CH_CONF,        /* Channel 0. */  \
00171       LESENSE_DISABLED_CH_CONF,        /* Channel 1. */  \
00172       LESENSE_DISABLED_CH_CONF,        /* Channel 2. */  \
00173       LESENSE_DISABLED_CH_CONF,        /* Channel 3. */  \
00174       LESENSE_DISABLED_CH_CONF,        /* Channel 4. */  \
00175       LESENSE_DISABLED_CH_CONF,        /* Channel 5. */  \
00176       LESENSE_DISABLED_CH_CONF,        /* Channel 6. */  \
00177       LESENSE_DISABLED_CH_CONF,        /* Channel 7. */  \
00178       LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 8. */  \
00179       LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 9. */  \
00180       LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 10. */ \
00181       LESENSE_CAPSENSE_CH_CONF_SLEEP,  /* Channel 11. */ \
00182       LESENSE_DISABLED_CH_CONF,        /* Channel 12. */ \
00183       LESENSE_DISABLED_CH_CONF,        /* Channel 13. */ \
00184       LESENSE_DISABLED_CH_CONF,        /* Channel 14. */ \
00185       LESENSE_DISABLED_CH_CONF         /* Channel 15. */ \
00186     }                                                    \
00187   }
00188 
00189 #ifdef __cplusplus
00190 }
00191 #endif
00192 
00193 /** @} (end group CapSense) */
00194 /** @} (end group Drivers) */