2 ******************************************************************************
\r
3 * @file tsl_conf_stm8tl5x.h
\r
4 * @author MCD Application Team
\r
6 * @date 22-January-2013
\r
7 * @brief Acquisition parameters for STM8TL5x 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_STM8TL5X_H
\r
32 #define __TSL_CONF_STM8TL5X_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 acquisition is managed in the main routine using polling mode.
\r
109 - If Yes the acquisition is managed in the interrupt routines.
\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 (50)
\r
128 /** Maximum acquisition measurement (range=0..65535)
\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 (4000)
\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 (15)
\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 (50)
\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 (40)
\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 (15)
\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 (50)
\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 (30)
\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 (5)
\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 (40)
\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 // DO NOT MODIFY THE LINES BELOW!!!
\r
448 #define STM8TL53C4 (0)
\r
449 #define STM8TL53G4 (1)
\r
450 #define STM8TL53F4 (2)
\r
451 #define STM8TL52G4 (3)
\r
452 #define STM8TL52F4 (4)
\r
454 /** @defgroup STM8TL5x_Parameters STM8TL5x Parameters
\r
457 //==============================================================================
\r
458 // Device selection
\r
459 //==============================================================================
\r
461 /** @defgroup STM8TL5x_Parameters_Device_Selection 01 - Device Selection
\r
464 /** STM8TL5x device selection (range=0..4)
\r
465 - Select a MCU in the above list
\r
467 #define TSLPRM_MCU STM8TL53C4
\r
469 /** @} STM8TL5x_Parameters_Device_Selection */
\r
471 //==============================================================================
\r
472 // Reference adjustment
\r
473 //==============================================================================
\r
475 /** @defgroup STM8TL5x_Parameters_Reference_Adjustment 02 - Reference adjustment
\r
478 /** Used to calibrate the EPCC to get the Reference closed to this value (range=100..2000)
\r
479 - The range values are recommended values.
\r
480 - The higher the Reference, the higher the sensitivity
\r
482 #define TSLPRM_KEY_TARGET_REFERENCE (500)
\r
484 /** Used to calibrate the EPCC (range=1..TSLPRM_KEY_TARGET_REFERENCE)
\r
486 #define TSLPRM_KEY_TARGET_REFERENCE_ERROR (25)
\r
488 /** Number of iteration after the dichotomy to fine tune the EPCC value (range=3..5)
\r
490 #define TSLPRM_PXS_EPCC_FINE_TUNING_ITERATION (3)
\r
492 /** Used to calibrate the CS (range=1,2,4,8)
\r
494 #define TSLPRM_KEY_TARGET_ATTENUATION (4)
\r
496 /** Below (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_TOUCHKEY_REFERENCE_RANGE) the EPCC is updated for the TKeys (range=1..TSLPRM_KEY_TARGET_REFERENCE)
\r
498 #define TSLPRM_TOUCHKEY_REFERENCE_RANGE (75)
\r
500 /** Below (TSLPRM_KEY_TARGET_REFERENCE - TSLPRM_LINROT_REFERENCE_RANGE) the EPCC is updated for the Linear/Rotary (range=1..TSLPRM_KEY_TARGET_REFERENCE)
\r
502 #define TSLPRM_LINROT_REFERENCE_RANGE (75)
\r
504 /** @} STM8TL5x_Parameters_Reference_Adjustment */
\r
506 //==============================================================================
\r
508 //==============================================================================
\r
510 /** @defgroup STM8TL5x_Parameters_PXS_Clock 03 - PXS Clock
\r
511 - These parameters define the acquisition clock settings.
\r
514 /** Acquisition frequency (values are 16000, 8000, 4000, 2000, 1000, 500, 250 or 125)
\r
516 #define TSLPRM_PXS_HSI (16000)
\r
518 /** Up phase length (range=1..7)
\r
520 #define TSLPRM_PXS_UP_LENGTH (1)
\r
522 /** Pass phase length (range=1..7)
\r
524 #define TSLPRM_PXS_PASS_LENGTH (1)
\r
526 /** @} STM8TL5x_Parameters_PXS_Clock */
\r
528 //==============================================================================
\r
530 //==============================================================================
\r
532 /** @defgroup STM8TL5x_Parameters_PXS_Synchro 04 - PXS Synchro
\r
535 /** Acquisition synchronized with SYNCHRO pin (0=No, 1=Yes)
\r
537 #define TSLPRM_PXS_SYNCHRONIZE (1)
\r
539 /** Synchronization edge (0=Fall, 1=Rise)
\r
541 #define TSLPRM_PXS_SYNCHRO_EDGE (1)
\r
543 /** @} STM8TL5x_Parameters_PXS_Synchro */
\r
545 //==============================================================================
\r
546 // PXS Miscellaneous
\r
547 //==============================================================================
\r
549 /** @defgroup STM8TL5x_Parameters_PXS_Miscellaneous 05 - PXS Miscellaneous
\r
552 /** Low power mode between acquisition (0=No, 1=Yes)
\r
554 #define TSLPRM_PXS_LOW_POWER_MODE (1)
\r
556 /** RF detection (0=No, 1=Yes)
\r
558 #define TSLPRM_PXS_RF_DETECTION (1)
\r
560 /** Transmitter inactive state (0=Grounded, 1=Floating)
\r
562 #define TSLPRM_PXS_INACTIVE_TX (1)
\r
564 /** Receiver inactive state (0=Grounded, 1=Floating)
\r
566 #define TSLPRM_PXS_INACTIVE_RX (1)
\r
568 /** Charge/Discharge cycle behaviour after VTHR is reached (0=stop, 1=continue)
\r
570 #define TSLPRM_PXS_RX_COUPLING (1)
\r
572 /** Stabilization time (values are LONG_STAB, MEDIUM_STAB, SHORT_STAB)
\r
574 #define TSLPRM_PXS_STAB LONG_STAB
\r
576 /** Bias (values are HIGH_BIAS, MEDIUM_BIAS, LOW_BIAS, VERY_LOW_BIAS)
\r
578 #define TSLPRM_PXS_BIAS HIGH_BIAS
\r
580 /** Index maximum of Rx channels ("N" of RxN)
\r
581 - This value must not exceed 9 with STM8TL53C4 and 7 with STM8TL53G4
\r
583 #define TSLPRM_HIGH_CHANNEL_NB (9)
\r
585 /** @} STM8TL5x_Parameters_PXS_Miscellaneous */
\r
587 /** @} STM8TL5x_Parameters */
\r
589 // DO NOT REMOVE !!!
\r
590 #include "tsl_check_config.h"
\r
592 #endif /* __TSL_CONF_STM8TL5X_H */
\r
594 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r