2 ******************************************************************************
\r
3 * @file tsl_conf_stm32f0xx.h
\r
4 * @author MCD Application Team
\r
6 * @date 22-January-2013
\r
7 * @brief Acquisition parameters for STM32F0xx products.
\r
8 * @note This file must be copied in the application project and values
\r
9 * changed for the application.
\r
10 ******************************************************************************
\r
13 * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
\r
15 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
\r
16 * You may not use this file except in compliance with the License.
\r
17 * You may obtain a copy of the License at:
\r
19 * http://www.st.com/software_license_agreement_liberty_v2
\r
21 * Unless required by applicable law or agreed to in writing, software
\r
22 * distributed under the License is distributed on an "AS IS" BASIS,
\r
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
24 * See the License for the specific language governing permissions and
\r
25 * limitations under the License.
\r
27 ******************************************************************************
\r
30 /* Define to prevent recursive inclusion -------------------------------------*/
\r
31 #ifndef __TSL_CONF_STM32F0XX_H
\r
32 #define __TSL_CONF_STM32F0XX_H
\r
34 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
35 //+++++++++++++++++++++++++++ COMMON PARAMETERS ++++++++++++++++++++++++++++++++
\r
36 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
38 /** @defgroup Common_Parameters Common Parameters
\r
41 //==============================================================================
\r
42 // Number of elements
\r
43 //==============================================================================
\r
45 /** @defgroup Common_Parameters_Number_Of_Elements 01 - Number of elements
\r
48 /** Total number of channels in application (range=1..255)
\r
50 #define TSLPRM_TOTAL_CHANNELS (1)
\r
52 /** Total number of banks in application (range=1..255)
\r
54 #define TSLPRM_TOTAL_BANKS (1)
\r
56 /** Total number of "Extended" TouchKeys in application (range=0..255)
\r
58 #define TSLPRM_TOTAL_TOUCHKEYS (1)
\r
60 /** Total number of "Basic" TouchKeys in application (range=0..255)
\r
62 #define TSLPRM_TOTAL_TOUCHKEYS_B (1)
\r
64 /** Total number of "Extended" Linear and Rotary sensors in application (range=0..255)
\r
65 - Count also the 1-channel linear sensor used as TouchKey
\r
67 #define TSLPRM_TOTAL_LINROTS (1)
\r
69 /** Total number of "Basic" Linear and Rotary sensors in application (range=0..255)
\r
70 - Count also the 1-channel linear sensor used as TouchKey
\r
72 #define TSLPRM_TOTAL_LINROTS_B (1)
\r
74 /** Total number of sensors/objects in application (range=1..255)
\r
75 - Count all TouchKeys, Linear and Rotary sensors
\r
77 #define TSLPRM_TOTAL_OBJECTS (1)
\r
79 /** @} Common_Parameters_Number_Of_Elements */
\r
81 //==============================================================================
\r
82 // Optional features
\r
83 //==============================================================================
\r
85 /** @defgroup Common_Parameters_Options 02 - Optional features
\r
88 /** Record the last measure (0=No, 1=Yes)
\r
89 - If No the measure is recalculated using the Reference and Delta
\r
91 #define TSLPRM_USE_MEAS (1)
\r
93 /** Zone management usage (0=No, 1=Yes)
\r
95 #define TSLPRM_USE_ZONE (1)
\r
97 /** Proximity detection usage (0=No, 1=Yes)
\r
99 #define TSLPRM_USE_PROX (1)
\r
101 /** Use the Timer tick callback (0=No, 1=Yes)
\r
102 - When equal to 1, the function TSL_CallBack_TimerTick must be defined in
\r
103 the application code. It is called for each timer interruption.
\r
105 #define TSLPRM_USE_TIMER_CALLBACK (1)
\r
107 /** Acquisition interrupt mode (0=No, 1=Yes)
\r
108 - If No the TS interrupt is not used.
\r
109 - If Yes the TS interrupt is used.
\r
111 #define TSLPRM_USE_ACQ_INTERRUPT (1)
\r
113 /** @} Common_Parameters_Options */
\r
115 //==============================================================================
\r
116 // Acquisition limits
\r
117 //==============================================================================
\r
119 /** @defgroup Common_Parameters_Acquisition_Limits 03 - Acquisition limits
\r
122 /** Minimum acquisition measurement (range=0..65535)
\r
123 - This is the minimum acceptable value for the acquisition measure.
\r
124 - The acquisition will be in error if the measure is below this value.
\r
126 #define TSLPRM_ACQ_MIN (10)
\r
128 /** Maximum acquisition measurement (range=255, 511, 1023, 2047, 8191, 16383)
\r
129 - This is the maximum acceptable value for the acquisition measure.
\r
130 - The acquisition will be in error if the measure is above this value.
\r
132 #define TSLPRM_ACQ_MAX (8191)
\r
134 /** @} Common_Parameters_Acquisition_Limits */
\r
136 //==============================================================================
\r
138 //==============================================================================
\r
140 /** @defgroup Common_Parameters_Calibration 04 - Calibration
\r
143 /** Number of calibration samples (range=4, 8, 16)
\r
144 - Low value = faster calibration but less precision.
\r
145 - High value = slower calibration but more precision.
\r
147 #define TSLPRM_CALIB_SAMPLES (8)
\r
149 /** Delay in measurement samples before starting the calibration (range=0..40)
\r
150 - This is usefull if a noise filter is used.
\r
151 - Write 0 to disable the delay.
\r
153 #define TSLPRM_CALIB_DELAY (10)
\r
155 /** @} Common_Parameters_Calibration */
\r
157 //==============================================================================
\r
158 // Thresholds for TouchKey sensors
\r
159 //==============================================================================
\r
161 /** @defgroup Common_Parameters_TouchKey_Thresholds 05 - Thresholds for TouchKey sensors
\r
164 /** TouchKeys Proximity state input threshold (range=0..255)
\r
165 - Enter Proximity state if delta is above
\r
167 #define TSLPRM_TKEY_PROX_IN_TH (10)
\r
169 /** TouchKeys Proximity state output threshold (range=0..255)
\r
170 - Exit Proximity state if delta is below
\r
172 #define TSLPRM_TKEY_PROX_OUT_TH (5)
\r
174 /** TouchKeys Detect state input threshold (range=0..255)
\r
175 - Enter Detect state if delta is above
\r
177 #define TSLPRM_TKEY_DETECT_IN_TH (20)
\r
179 /** TouchKeys Detect state output threshold (range=0..255)
\r
180 - Exit Detect state if delta is below
\r
182 #define TSLPRM_TKEY_DETECT_OUT_TH (15)
\r
184 /** TouchKeys re-Calibration threshold (range=0..255)
\r
185 - @warning The value is inverted in the sensor state machine
\r
186 - Enter Calibration state if delta is below
\r
188 #define TSLPRM_TKEY_CALIB_TH (20)
\r
190 /** TouchKey, Linear and Rotary sensors thresholds coefficient (range=0..4)
\r
191 This multiplier coefficient is applied on Detect thresholds only.
\r
192 - 0: feature disabled
\r
193 - 1: thresholds x 2
\r
194 - 2: thresholds x 4
\r
195 - 3: thresholds x 8
\r
196 - 4: thresholds x 16
\r
198 #define TSLPRM_COEFF_TH (1)
\r
200 /** @} Common_Parameters_TouchKey_Thresholds */
\r
202 //==============================================================================
\r
203 // Thresholds for Linear and Rotary sensors
\r
204 //==============================================================================
\r
206 /** @defgroup Common_Parameters_LinRot_Thresholds 06 - Thresholds for Linear and Rotary sensors
\r
209 /** Linear/Rotary Proximity state input threshold (range=0..255)
\r
210 - Enter Proximity state if delta is above
\r
212 #define TSLPRM_LINROT_PROX_IN_TH (10)
\r
214 /** Linear/Rotary Proximity state output threshold (range=0..255)
\r
215 - Exit Proximity state if delta is below
\r
217 #define TSLPRM_LINROT_PROX_OUT_TH (5)
\r
219 /** Linear/Rotary Detect state input threshold (range=0..255)
\r
220 - Enter Detect state if delta is above
\r
222 #define TSLPRM_LINROT_DETECT_IN_TH (20)
\r
224 /** Linear/Rotary Detect state output threshold (range=0..255)
\r
225 - Exit Detect state if delta is below
\r
227 #define TSLPRM_LINROT_DETECT_OUT_TH (15)
\r
229 /** Linear/Rotary re-Calibration threshold (range=0..255)
\r
230 - @warning The value is inverted in the sensor state machine
\r
231 - Enter Calibration state if delta is below
\r
232 - A low absolute value will result in a higher sensitivity and thus some spurious
\r
233 recalibration may be issued.
\r
235 #define TSLPRM_LINROT_CALIB_TH (20)
\r
237 /** Linear/Rotary Delta normalization (0=No, 1=Yes)
\r
238 - When this parameter is set, a coefficient is applied on all Delta of all sensors
\r
239 in order to normalize them and to improve the position calculation.
\r
240 - These coefficients must be defined in a constant table in the application (see Library examples).
\r
241 - The MSB is the coefficient integer part, the LSB is the coefficient real part.
\r
243 - To apply a factor 1.10:
\r
245 0x1A to the LSB (0.10 x 256 = 25.6 -> rounded to 26 = 0x1A)
\r
246 - To apply a factor 0.90:
\r
248 0xE6 to the LSB (0.90 x 256 = 230.4 -> rounded to 230 = 0xE6)
\r
249 - To apply no factor:
\r
253 #define TSLPRM_LINROT_USE_NORMDELTA (1)
\r
255 /** @} Common_Parameters_LinRot_Thresholds */
\r
257 //==============================================================================
\r
258 // Linear/Rotary sensors used
\r
259 //==============================================================================
\r
261 /** @defgroup Common_Parameters_LinRot_Used 07 - Linear/Rotary sensors used
\r
264 /** Select which Linear and Rotary sensors you use in your application.
\r
268 LIN = Linear sensor
\r
269 ROT = Rotary sensor
\r
270 M1 = Mono electrodes design with 0/255 position at extremities of the sensor
\r
271 M2 = Mono electrodes design
\r
272 H = Half-ended electrodes design
\r
273 D = Dual electrodes design
\r
275 #define TSLPRM_USE_3CH_LIN_M1 (1)
\r
276 #define TSLPRM_USE_3CH_LIN_M2 (1)
\r
277 #define TSLPRM_USE_3CH_LIN_H (1)
\r
278 #define TSLPRM_USE_3CH_ROT_M (1)
\r
280 #define TSLPRM_USE_4CH_LIN_M1 (1)
\r
281 #define TSLPRM_USE_4CH_LIN_M2 (1)
\r
282 #define TSLPRM_USE_4CH_LIN_H (1)
\r
283 #define TSLPRM_USE_4CH_ROT_M (1)
\r
285 #define TSLPRM_USE_5CH_LIN_M1 (1)
\r
286 #define TSLPRM_USE_5CH_LIN_M2 (1)
\r
287 #define TSLPRM_USE_5CH_LIN_H (1)
\r
288 #define TSLPRM_USE_5CH_ROT_M (1)
\r
289 #define TSLPRM_USE_5CH_ROT_D (1)
\r
291 #define TSLPRM_USE_6CH_LIN_M1 (1)
\r
292 #define TSLPRM_USE_6CH_LIN_M2 (1)
\r
293 #define TSLPRM_USE_6CH_LIN_H (1)
\r
294 #define TSLPRM_USE_6CH_ROT_M (1)
\r
296 /** @} Common_Parameters_LinRot_used */
\r
298 //==============================================================================
\r
299 // Linear/Rotary sensors position
\r
300 //==============================================================================
\r
302 /** @defgroup Common_Parameters_LinRot_Position 08 - Linear/Rotary sensors position
\r
305 /** Position resolution in number of bits (range=1..8)
\r
306 - A Low value will result in a low resolution and will be less subject to noise.
\r
307 - A High value will result in a high resolution and will be more subject to noise.
\r
309 #define TSLPRM_LINROT_RESOLUTION (7)
\r
311 /** Direction change threshold in position unit (range=0..255)
\r
312 - Defines the default threshold used during the change direction process.
\r
313 - A Low value will result in a faster direction change.
\r
314 - A High value will result in a slower direction change.
\r
316 #define TSLPRM_LINROT_DIR_CHG_POS (10)
\r
318 /** Direction change debounce (range=0..63)
\r
319 - Defines the default integrator counter used during the change direction process.
\r
320 - This counter is decremented when the same change in the position is detected and the direction will
\r
321 change after this counter reaches zero.
\r
322 - A Low value will result in a faster direction change.
\r
323 - A High value will result in a slower direction change.
\r
325 #define TSLPRM_LINROT_DIR_CHG_DEB (1)
\r
327 /** @} Common_Parameters_LinRot_Position */
\r
329 //==============================================================================
\r
330 // Debounce counters
\r
331 //==============================================================================
\r
333 /** @defgroup Common_Parameters_Debounce 09 - Debounce counters
\r
336 /** Proximity state debounce in samples unit (range=0..63)
\r
337 - A Low value will result in a higher sensitivity during the Proximity detection but with less noise filtering.
\r
338 - A High value will result in improving the system noise immunity but will increase the system response time.
\r
340 #define TSLPRM_DEBOUNCE_PROX (3)
\r
342 /** Detect state debounce in samples unit (range=0..63)
\r
343 - A Low value will result in a higher sensitivity during the detection but with less noise filtering.
\r
344 - A High value will result in improving the system noise immunity but will increase the system response time.
\r
346 #define TSLPRM_DEBOUNCE_DETECT (3)
\r
348 /** Release state debounce in samples unit (range=0..63)
\r
349 - A Low value will result in a higher sensitivity during the end-detection but with less noise filtering.
\r
350 - A High value will result in a lower sensitivity during the end-detection but with more noise filtering.
\r
352 #define TSLPRM_DEBOUNCE_RELEASE (3)
\r
354 /** Re-calibration state debounce in samples unit (range=0..63)
\r
355 - A Low value will result in a higher sensitivity during the recalibration but with less noise filtering.
\r
356 - A High value will result in a lower sensitivity during the recalibration but with more noise filtering.
\r
358 #define TSLPRM_DEBOUNCE_CALIB (3)
\r
360 /** Error state debounce in samples unit (range=0..63)
\r
361 - A Low value will result in a higher sensitivity to enter in error state.
\r
362 - A High value will result in a lower sensitivity to enter in error state.
\r
364 #define TSLPRM_DEBOUNCE_ERROR (3)
\r
366 /** @} Common_Parameters_Debounce */
\r
368 //==============================================================================
\r
369 // Environment Change System (ECS)
\r
370 //==============================================================================
\r
372 /** @defgroup Common_Parameters_ECS 10 - ECS
\r
375 /** Environment Change System Slow K factor (range=0..255)
\r
376 - The higher value is K, the faster is the response time.
\r
378 #define TSLPRM_ECS_K_SLOW (10)
\r
380 /** Environment Change System Fast K factor (range=0..255)
\r
381 - The higher value is K, the faster is the response time.
\r
383 #define TSLPRM_ECS_K_FAST (20)
\r
385 /** Environment Change System delay in msec (range=0..5000)
\r
386 - The ECS will be started after this delay and when all sensors are in Release state.
\r
388 #define TSLPRM_ECS_DELAY (500)
\r
390 /** @} Common_Parameters_ECS */
\r
392 //==============================================================================
\r
393 // Detection Time Out (DTO)
\r
394 //==============================================================================
\r
396 /** @defgroup Common_Parameters_DTO 11 - DTO
\r
399 /** Detection Time Out delay in seconds (range=0..63)
\r
400 - Value 0: DTO processing not compiled in the code (to gain size if not used).
\r
401 - Value 1: Default time out infinite.
\r
402 - Value between 2 and 63: Default time out between value n-1 and n.
\r
404 - With a DTO equal to 2, the time out is between 1s and 2s.
\r
405 - With a DTO equal to 63, the time out is between 62s and 63s.
\r
407 @note The DTO can be changed in run-time by the application only if the
\r
408 default value is between 1 and 63.
\r
410 #define TSLPRM_DTO (5)
\r
412 /** @} Common_Parameters_DTO */
\r
414 //==============================================================================
\r
415 // Detection Exclusion System (DXS)
\r
416 //==============================================================================
\r
418 /** @defgroup Common_Parameters_DXS 12 - DXS
\r
421 /** Detection Exclusion System (0=No, 1=Yes)
\r
423 #define TSLPRM_USE_DXS (1)
\r
425 /** @} Common_Parameters_DXS */
\r
427 //==============================================================================
\r
428 // Miscellaneous parameters
\r
429 //==============================================================================
\r
431 /** @defgroup Common_Parameters_Misc 13 - Miscellaneous
\r
434 /** Timing tick frequency in Hz (range=125, 250, 500, 1000, 2000)
\r
435 - Result to a timing interrupt respectively every 8ms, 4ms, 2ms, 1ms, 0.5ms
\r
437 #define TSLPRM_TICK_FREQ (1000)
\r
439 /** @} Common_Parameters_Misc */
\r
441 /** @} Common_Parameters */
\r
443 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
444 //++++++++++++++++++++++++++++++ MCU PARAMETERS ++++++++++++++++++++++++++++++++
\r
445 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
447 /** @defgroup STM32F0xx_Parameters STM32F0xx Parameters
\r
450 //==============================================================================
\r
451 // GPIO configuration
\r
452 //==============================================================================
\r
454 /** @defgroup STM32F0xx_Parameters_GPIO_Config 01 - TSC GPIOs Configuration
\r
457 /** TSC GPIOs Configuration selection (range=0..1)
\r
458 - 0: Manual. The TSC GPIOs configuration must be done by the application code.
\r
459 - 1: Automatic. The TSLPRM_TSC_GROUPx_IOy parameters below must be filled up.
\r
460 The TSC GPIOs configuration is automatically done by the STMTouch driver.
\r
462 #define TSLPRM_TSC_GPIO_CONFIG (1)
\r
464 //+++ DO NOT CHANGE THESE VALUES +++++++++++++++++++++++++++++++++
\r
465 // These defines must be applied to the TSLPRM_TSC_GROUPx_IOy parameters below.
\r
466 #define NU (0) // Not Used IO
\r
467 #define CHANNEL (1) // Channel IO
\r
468 #define SHIELD (2) // Shield IO (= Channel IO but not acquired)
\r
469 #define SAMPCAP (3) // Sampling Capacitor IO
\r
470 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
472 // If TSLPRM_TSC_GPIO_CONFIG=1 assign each TSLPRM_TSC_GROUPx_IOy parameters below.
\r
473 // If TSLPRM_TSC_GPIO_CONFIG=0 these parameters are ignored.
\r
475 #define TSLPRM_TSC_GROUP1_IO1 NU // PA0
\r
476 #define TSLPRM_TSC_GROUP1_IO2 NU // PA1
\r
477 #define TSLPRM_TSC_GROUP1_IO3 NU // PA2
\r
478 #define TSLPRM_TSC_GROUP1_IO4 NU // PA3
\r
480 #define TSLPRM_TSC_GROUP2_IO1 NU // PA4
\r
481 #define TSLPRM_TSC_GROUP2_IO2 NU // PA5
\r
482 #define TSLPRM_TSC_GROUP2_IO3 NU // PA6
\r
483 #define TSLPRM_TSC_GROUP2_IO4 NU // PA7
\r
485 #define TSLPRM_TSC_GROUP3_IO1 NU // PC5
\r
486 #define TSLPRM_TSC_GROUP3_IO2 NU // PB0
\r
487 #define TSLPRM_TSC_GROUP3_IO3 NU // PB1
\r
488 #define TSLPRM_TSC_GROUP3_IO4 NU // PB2
\r
490 #define TSLPRM_TSC_GROUP4_IO1 NU // PA9
\r
491 #define TSLPRM_TSC_GROUP4_IO2 NU // PA10
\r
492 #define TSLPRM_TSC_GROUP4_IO3 NU // PA11
\r
493 #define TSLPRM_TSC_GROUP4_IO4 NU // PA12
\r
495 #define TSLPRM_TSC_GROUP5_IO1 NU // PB3
\r
496 #define TSLPRM_TSC_GROUP5_IO2 NU // PB4
\r
497 #define TSLPRM_TSC_GROUP5_IO3 NU // PB6
\r
498 #define TSLPRM_TSC_GROUP5_IO4 NU // PB7
\r
500 #define TSLPRM_TSC_GROUP6_IO1 NU // PB11
\r
501 #define TSLPRM_TSC_GROUP6_IO2 NU // PB12
\r
502 #define TSLPRM_TSC_GROUP6_IO3 NU // PB13
\r
503 #define TSLPRM_TSC_GROUP6_IO4 NU // PB14
\r
505 /** @} STM32F0xx_Parameters_GPIO_Config */
\r
507 //==============================================================================
\r
508 // Charge Transfer Pulses
\r
509 //==============================================================================
\r
511 /** @defgroup STM32F0xx_Parameters_CT_Pulses 02 - Charge Transfer Pulses
\r
514 /** Charge Transfer Pulse High (range=0..15)
\r
520 #define TSLPRM_TSC_CTPH (1)
\r
522 /** Charge Transfer Pulse Low (range=0..15)
\r
528 #define TSLPRM_TSC_CTPL (1)
\r
530 /** Pulse Generator Prescaler (range=0..7)
\r
531 - 0: fPGCLK = fHCLK
\r
532 - 1: fPGCLK = fHCLK/2
\r
534 - 7: fPGCLK = fHCLK/128
\r
536 #define TSLPRM_TSC_PGPSC (5)
\r
538 /** @} STM32F0xx_Parameters_CT_Pulses */
\r
540 //==============================================================================
\r
542 //==============================================================================
\r
544 /** @defgroup STM32F0xx_Parameters_IOs 03 - I/Os
\r
547 /** TSC IOs default mode when no on-going acquisition (range=0..1)
\r
548 - 0: Output push-pull low
\r
549 - 1: Input floating
\r
551 #define TSLPRM_TSC_IODEF (0)
\r
553 /** Acquisition Mode (range=0..1)
\r
554 - 0: Normal acquisition mode
\r
555 - 1: Synchronized acquisition mode
\r
557 #define TSLPRM_TSC_AM (0)
\r
559 /** Synchronization Pin (range=0..1)
\r
563 #define TSLPRM_TSC_SYNC_PIN (0)
\r
565 /** Synchronization Polarity (range=0..1)
\r
566 - 0: Falling edge only
\r
567 - 1: Rising edge and high level
\r
569 #define TSLPRM_TSC_SYNC_POL (0)
\r
571 /** @} STM32F0xx_Parameters_Misc */
\r
573 //==============================================================================
\r
575 //==============================================================================
\r
577 /** @defgroup STM32F0xx_Parameters_SpreadSpectrum 04 - Spread Spectrum
\r
580 /** Use Spread Spectrum (0=No, 1=Yes)
\r
582 #define TSLPRM_TSC_USE_SS (0)
\r
584 /** Spread Spectrum Deviation (range=0..127)
\r
588 - 127: 128 x tSSCLK
\r
590 #define TSLPRM_TSC_SSD (0)
\r
592 /** Spread Spectrum Prescaler (range=0..1)
\r
593 - 0: fSSCLK = fHCLK
\r
594 - 1: fSSCLK = fHCLK/2
\r
596 #define TSLPRM_TSC_SSPSC (0)
\r
598 /** @} STM32F0xx_Parameters_SpreadSpectrum */
\r
600 /** @} STM32F0xx_Parameters */
\r
602 // DO NOT REMOVE !!!
\r
603 #include "tsl_check_config.h"
\r
605 #endif /* __TSL_CONF_STM32F0XX_H */
\r
607 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r