1 /***************************************************************************//**
\r
3 * @brief Low Energy Sensor (LESENSE) example configuration file.
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * This file is licensed under the Silabs License Agreement. See the file
\r
11 * "Silabs_License_Agreement.txt" for details. Before using this software for
\r
12 * any purpose, you must agree to the terms of that agreement.
\r
14 ******************************************************************************/
\r
17 #include "em_lesense.h"
\r
19 /***************************************************************************//**
\r
20 * @addtogroup Drivers
\r
22 ******************************************************************************/
\r
24 /***************************************************************************//**
\r
25 * @addtogroup CapSense
\r
27 ******************************************************************************/
\r
33 /**************************************************************************//**
\r
35 *****************************************************************************/
\r
36 #define CAPLESENSE_SENSITIVITY_OFFS 1U
\r
37 #define CAPLESENSE_NUMOF_SLIDERS 4 /**< Number of sliders */
\r
38 #define CAPLESENSE_ACMP_VDD_SCALE LESENSE_ACMP_VDD_SCALE /**< Upper voltage threshold */
\r
40 #define CAPLESENSE_SLIDER_PORT0 gpioPortC /**< Slider Port. GPIO Port C */
\r
41 #define CAPLESENSE_SLIDER0_PORT CAPLESENSE_SLIDER_PORT0 /**< Slider 0 Port. GPIO Port C */
\r
42 #define CAPLESENSE_SLIDER0_PIN 8UL /**< Slider 0 Pin 8 */
\r
43 #define CAPLESENSE_SLIDER1_PORT CAPLESENSE_SLIDER_PORT0 /**< Slider 1 Port. GPIO Port C */
\r
44 #define CAPLESENSE_SLIDER1_PIN 9UL /**< Slider 1 Pin 9 */
\r
45 #define CAPLESENSE_SLIDER2_PORT CAPLESENSE_SLIDER_PORT0 /**< Slider 2 Port. GPIO Port C */
\r
46 #define CAPLESENSE_SLIDER2_PIN 10UL /**< Slider 2 Pin 10 */
\r
47 #define CAPLESENSE_SLIDER3_PORT CAPLESENSE_SLIDER_PORT0 /**< Slider 3 Port. GPIO Port C */
\r
48 #define CAPLESENSE_SLIDER3_PIN 11UL /**< Slider 3 Pin 11 */
\r
51 #define CAPLESENSE_CHANNEL_INT (LESENSE_IF_CH8 | LESENSE_IF_CH9 | LESENSE_IF_CH10 | LESENSE_IF_CH11)
\r
52 #define LESENSE_CHANNELS 16 /**< Number of channels for the Low Energy Sensor Interface. */
\r
54 #define SLIDER_PART0_CHANNEL 8 /**< Touch slider channel Part 0 */
\r
55 #define SLIDER_PART1_CHANNEL 9 /**< Touch slider channel Part 1 */
\r
56 #define SLIDER_PART2_CHANNEL 10 /**< Touch slider channel Part 2 */
\r
57 #define SLIDER_PART3_CHANNEL 11 /**< Touch slider channel Part 3 */
\r
59 /** Upper voltage threshold. */
\r
60 #define LESENSE_ACMP_VDD_SCALE 0x37U
\r
63 #define LESENSE_CAPSENSE_CH_IN_USE {\
\r
64 /* Ch0, Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7 */\
\r
65 false, false, false, false, false, false, false, false,\
\r
66 /* Ch8, Ch9, Ch10, Ch11, Ch12, Ch13, Ch14, Ch15 */\
\r
67 true, true, true, true, false, false, false, false\
\r
70 /** Configuration for capacitive sense channels in sense mode. */
\r
71 #define LESENSE_CAPSENSE_CH_CONF_SENSE \
\r
73 true, /* Enable scan channel. */ \
\r
74 true, /* Enable the assigned pin on scan channel. */ \
\r
75 false, /* Disable interrupts on channel. */ \
\r
76 lesenseChPinExDis, /* GPIO pin is disabled during the excitation period. */ \
\r
77 lesenseChPinIdleDis, /* GPIO pin is disabled during the idle period. */ \
\r
78 false, /* Don't use alternate excitation pins for excitation. */ \
\r
79 false, /* Disabled to shift results from this channel to the decoder register. */ \
\r
80 false, /* Disabled to invert the scan result bit. */ \
\r
81 true, /* Enabled to store counter value in the result buffer. */ \
\r
82 lesenseClkLF, /* Use the LF clock for excitation timing. */ \
\r
83 lesenseClkLF, /* Use the LF clock for sample timing. */ \
\r
84 0x00U, /* Excitation time is set to 0 excitation clock cycles. */ \
\r
85 0x0FU, /* Sample delay is set to 15(+1) sample clock cycles. */ \
\r
86 0x00U, /* Measure delay is set to 0 excitation clock cycles.*/ \
\r
87 LESENSE_ACMP_VDD_SCALE, /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */ \
\r
88 lesenseSampleModeCounter, /* ACMP will be used in comparison. */ \
\r
89 lesenseSetIntLevel, /* Interrupt is generated if the sensor triggers. */ \
\r
90 0x00U, /* Counter threshold has been set to 0x00. */ \
\r
91 lesenseCompModeLess /* Compare mode has been set to trigger interrupt on "less". */ \
\r
94 /** Configuration for capacitive sense channels in sleep mode. */
\r
95 #define LESENSE_CAPSENSE_CH_CONF_SLEEP \
\r
97 true, /* Enable scan channel. */ \
\r
98 true, /* Enable the assigned pin on scan channel. */ \
\r
99 true, /* Enable interrupts on channel. */ \
\r
100 lesenseChPinExDis, /* GPIO pin is disabled during the excitation period. */ \
\r
101 lesenseChPinIdleDis, /* GPIO pin is disabled during the idle period. */ \
\r
102 false, /* Don't use alternate excitation pins for excitation. */ \
\r
103 false, /* Disabled to shift results from this channel to the decoder register. */ \
\r
104 false, /* Disabled to invert the scan result bit. */ \
\r
105 true, /* Enabled to store counter value in the result buffer. */ \
\r
106 lesenseClkLF, /* Use the LF clock for excitation timing. */ \
\r
107 lesenseClkLF, /* Use the LF clock for sample timing. */ \
\r
108 0x00U, /* Excitation time is set to 0 excitation clock cycles. */ \
\r
109 0x01U, /* Sample delay is set to 1(+1) sample clock cycles. */ \
\r
110 0x00U, /* Measure delay is set to 0 excitation clock cycles.*/ \
\r
111 LESENSE_ACMP_VDD_SCALE, /* ACMP threshold has been set to LESENSE_ACMP_VDD_SCALE. */ \
\r
112 lesenseSampleModeCounter, /* Counter will be used in comparison. */ \
\r
113 lesenseSetIntLevel, /* Interrupt is generated if the sensor triggers. */ \
\r
114 0x0EU, /* Counter threshold has been set to 0x0E. */ \
\r
115 lesenseCompModeLess /* Compare mode has been set to trigger interrupt on "less". */ \
\r
118 /** Configuration for disabled channels. */
\r
119 #define LESENSE_DISABLED_CH_CONF \
\r
121 false, /* Disable scan channel. */ \
\r
122 false, /* Disable the assigned pin on scan channel. */ \
\r
123 false, /* Disable interrupts on channel. */ \
\r
124 lesenseChPinExDis, /* GPIO pin is disabled during the excitation period. */ \
\r
125 lesenseChPinIdleDis, /* GPIO pin is disabled during the idle period. */ \
\r
126 false, /* Don't use alternate excitation pins for excitation. */ \
\r
127 false, /* Disabled to shift results from this channel to the decoder register. */ \
\r
128 false, /* Disabled to invert the scan result bit. */ \
\r
129 false, /* Disabled to store counter value in the result buffer. */ \
\r
130 lesenseClkLF, /* Use the LF clock for excitation timing. */ \
\r
131 lesenseClkLF, /* Use the LF clock for sample timing. */ \
\r
132 0x00U, /* Excitation time is set to 5(+1) excitation clock cycles. */ \
\r
133 0x00U, /* Sample delay is set to 7(+1) sample clock cycles. */ \
\r
134 0x00U, /* Measure delay is set to 0 excitation clock cycles.*/ \
\r
135 0x00U, /* ACMP threshold has been set to 0. */ \
\r
136 lesenseSampleModeCounter, /* ACMP output will be used in comparison. */ \
\r
137 lesenseSetIntNone, /* No interrupt is generated by the channel. */ \
\r
138 0x00U, /* Counter threshold has been set to 0x01. */ \
\r
139 lesenseCompModeLess /* Compare mode has been set to trigger interrupt on "less". */ \
\r
142 /** Configuration for scan in sense mode. */
\r
143 #define LESENSE_CAPSENSE_SCAN_CONF_SENSE \
\r
146 LESENSE_DISABLED_CH_CONF, /* Channel 0. */ \
\r
147 LESENSE_DISABLED_CH_CONF, /* Channel 1. */ \
\r
148 LESENSE_DISABLED_CH_CONF, /* Channel 2. */ \
\r
149 LESENSE_DISABLED_CH_CONF, /* Channel 3. */ \
\r
150 LESENSE_DISABLED_CH_CONF, /* Channel 4. */ \
\r
151 LESENSE_DISABLED_CH_CONF, /* Channel 5. */ \
\r
152 LESENSE_DISABLED_CH_CONF, /* Channel 6. */ \
\r
153 LESENSE_DISABLED_CH_CONF, /* Channel 7. */ \
\r
154 LESENSE_CAPSENSE_CH_CONF_SENSE, /* Channel 8. */ \
\r
155 LESENSE_CAPSENSE_CH_CONF_SENSE, /* Channel 9. */ \
\r
156 LESENSE_CAPSENSE_CH_CONF_SENSE, /* Channel 10. */ \
\r
157 LESENSE_CAPSENSE_CH_CONF_SENSE, /* Channel 11. */ \
\r
158 LESENSE_DISABLED_CH_CONF, /* Channel 12. */ \
\r
159 LESENSE_DISABLED_CH_CONF, /* Channel 13. */ \
\r
160 LESENSE_DISABLED_CH_CONF, /* Channel 14. */ \
\r
161 LESENSE_DISABLED_CH_CONF /* Channel 15. */ \
\r
165 /** Configuration for scan in sleep mode. */
\r
166 #define LESENSE_CAPSENSE_SCAN_CONF_SLEEP \
\r
169 LESENSE_DISABLED_CH_CONF, /* Channel 0. */ \
\r
170 LESENSE_DISABLED_CH_CONF, /* Channel 1. */ \
\r
171 LESENSE_DISABLED_CH_CONF, /* Channel 2. */ \
\r
172 LESENSE_DISABLED_CH_CONF, /* Channel 3. */ \
\r
173 LESENSE_DISABLED_CH_CONF, /* Channel 4. */ \
\r
174 LESENSE_DISABLED_CH_CONF, /* Channel 5. */ \
\r
175 LESENSE_DISABLED_CH_CONF, /* Channel 6. */ \
\r
176 LESENSE_DISABLED_CH_CONF, /* Channel 7. */ \
\r
177 LESENSE_CAPSENSE_CH_CONF_SLEEP, /* Channel 8. */ \
\r
178 LESENSE_CAPSENSE_CH_CONF_SLEEP, /* Channel 9. */ \
\r
179 LESENSE_CAPSENSE_CH_CONF_SLEEP, /* Channel 10. */ \
\r
180 LESENSE_CAPSENSE_CH_CONF_SLEEP, /* Channel 11. */ \
\r
181 LESENSE_DISABLED_CH_CONF, /* Channel 12. */ \
\r
182 LESENSE_DISABLED_CH_CONF, /* Channel 13. */ \
\r
183 LESENSE_DISABLED_CH_CONF, /* Channel 14. */ \
\r
184 LESENSE_DISABLED_CH_CONF /* Channel 15. */ \
\r
192 /** @} (end group CapSense) */
\r
193 /** @} (end group Drivers) */
\r