Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tsl_check_config_stm32l1xx.h « inc « STM32_TouchSensing_Library « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 271f6978c7bfd82608e399fb55f0162842b2dc8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
/**
  ******************************************************************************
  * @file    tsl_check_config_stm32l1xx.h
  * @author  MCD Application Team
  * @brief   This file contains the check of all parameters defined in the
  *          STM32L1XX configuration file.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __TSL_CHECK_CONFIG_STM32L1XX_H
#define __TSL_CHECK_CONFIG_STM32L1XX_H

// Check parameters common to all acquisitions
#include "tsl_check_config.h"

//------------------------------------------------------------------------------

/* 
Channel number can reach 37 on STM32L1 serie.
On Group 2 and Group 7 all pins are not availlable at the same time.
   * Groupe 2 (IO1..IO5): we can use 4 IOs instead of 5 (PG0, PG1)
   * Groupe 7 (IO1..IO7): we can use 5 IOs insteag of 7 (PG2, PG3, PG4)
This mean we can get only 37-1-2=34 channels.
On STM32 L0, L4, F0 and F3 we can have from 3 to 24 channels
*/ 
#define MAX_CHANNEL  34

/* This value is equal to int(MAX_CHANNEL/3) = 11 */
#define MAX_LINROT   11


#if ((TSLPRM_TOTAL_CHANNELS < 1) || (TSLPRM_TOTAL_CHANNELS > MAX_CHANNEL))
#error "TSLPRM_TOTAL_CHANNELS is out of range (1 .. MAX_CHANNEL)."
#endif

#if ((TSLPRM_TOTAL_BANKS < 1) || (TSLPRM_TOTAL_BANKS > MAX_LINROT))
#error "TSLPRM_TOTAL_BANKS is out of range (1 .. MAX_LINROT)."
#endif

#if ((TSLPRM_TOTAL_TOUCHKEYS < 0) || (TSLPRM_TOTAL_TOUCHKEYS > MAX_CHANNEL))
#error "TSLPRM_TOTAL_TOUCHKEYS is out of range (0 .. MAX_CHANNEL)."
#endif

#if ((TSLPRM_TOTAL_TOUCHKEYS_B < 0) || (TSLPRM_TOTAL_TOUCHKEYS_B > MAX_CHANNEL))
#error "TSLPRM_TOTAL_TOUCHKEYS_B is out of range (0 .. MAX_CHANNEL)."
#endif

#if ((TSLPRM_TOTAL_LINROTS < 0) || (TSLPRM_TOTAL_LINROTS > MAX_LINROT))
#error "TSLPRM_TOTAL_LINROTS is out of range (0 .. MAX_LINROT)."
#endif

#if ((TSLPRM_TOTAL_LINROTS_B < 0) || (TSLPRM_TOTAL_LINROTS_B > MAX_LINROT))
#error "TSLPRM_TOTAL_LINROTS_B is out of range (0 .. MAX_LINROT)."
#endif

#if ((TSLPRM_TOTAL_OBJECTS < 1) || (TSLPRM_TOTAL_OBJECTS > MAX_CHANNEL))
#error "TSLPRM_TOTAL_OBJECTS is out of range (1 .. MAX_CHANNEL)."
#endif

#if ((TSLPRM_TOTAL_TKEYS + TSLPRM_TOTAL_LNRTS) > MAX_CHANNEL)
#error "The Sum of TouchKeys and Linear/Rotary sensors exceeds MAX_CHANNEL."
#endif

//------------------------------------------------------------------------------

#ifndef TSLPRM_USE_SHIELD
#error "TSLPRM_USE_SHIELD is not defined."
#endif

#if ((TSLPRM_USE_SHIELD < 0) || (TSLPRM_USE_SHIELD > 1))
#error "TSLPRM_USE_SHIELD is out of range (0 .. 1)."
#endif

//------------------------------------------------------------------------------

#ifndef TSLPRM_IODEF
#error "TSLPRM_IODEF is not defined."
#endif

#if ((TSLPRM_IODEF < 0) || (TSLPRM_IODEF > 1))
#error "TSLPRM_IODEF is out of range (0 .. 1)."
#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_DELAY_TRANSFER
#error "TSLPRM_DELAY_TRANSFER is not defined."
#endif

#if ((TSLPRM_DELAY_TRANSFER < 0) || (TSLPRM_DELAY_TRANSFER > 65535))
#error "TSLPRM_DELAY_TRANSFER is out of range (0 .. 65535)."
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_USE_SPREAD_SPECTRUM
#error "TSLPRM_USE_SPREAD_SPECTRUM is not defined."
#endif

#if ((TSLPRM_USE_SPREAD_SPECTRUM < 0) || (TSLPRM_USE_SPREAD_SPECTRUM > 1))
#error "TSLPRM_USE_SPREAD_SPECTRUM is out of range (0 .. 1)."
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_SPREAD_MIN
#error "TSLPRM_SPREAD_MIN is not defined."
#endif

#if (TSLPRM_USE_SPREAD_SPECTRUM == 1)
#if ((TSLPRM_SPREAD_MIN < 1) || (TSLPRM_SPREAD_MIN >= TSLPRM_SPREAD_MAX))
#error "TSLPRM_SPREAD_MIN is out of range (1 .. TSLPRM_SPREAD_MAX-1)."
#endif
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MD) || defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_SPREAD_MAX
#error "TSLPRM_SPREAD_MAX is not defined."
#endif

#if (TSLPRM_USE_SPREAD_SPECTRUM == 1)
#if ((TSLPRM_SPREAD_MAX > 255) || (TSLPRM_SPREAD_MAX <= TSLPRM_SPREAD_MIN))
#error "TSLPRM_SPREAD_MAX is out of range (TSLPRM_SPREAD_MIN+1 .. 255)."
#endif
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_CT_PERIOD
#error "TSLPRM_CT_PERIOD is not defined."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_TIMER_FREQ
#error "TSLPRM_TIMER_FREQ is not defined."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)

#define TMP_RELOAD ((TSLPRM_CT_PERIOD * TSLPRM_TIMER_FREQ)/2)

#if ((TMP_RELOAD < 4) || (TMP_RELOAD > 16534))
#error "The calculated Timer RELOAD value is out of range (4 .. 65534)."
#endif

#if ((TMP_RELOAD % 2) != (0))
#error "The calculated Timer RELOAD value is odd and must be even."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_PROTECT_IO_ACCESS
#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
#endif

#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_USE_GPIOA
#error "TSLPRM_USE_GPIOA is not defined."
#endif

#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))
#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOB
#error "TSLPRM_USE_GPIOB is not defined."
#endif

#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))
#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOC
#error "TSLPRM_USE_GPIOC is not defined."
#endif

#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))
#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOF
#error "TSLPRM_USE_GPIOA is not defined."
#endif

#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))
#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOG
#error "TSLPRM_USE_GPIOG is not defined."
#endif

#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))
#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MD)

#ifndef TSLPRM_PROTECT_IO_ACCESS
#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
#endif

#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MD)

#ifndef TSLPRM_USE_GPIOA
#error "TSLPRM_USE_GPIOA is not defined."
#endif

#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))
#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOB
#error "TSLPRM_USE_GPIOB is not defined."
#endif

#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))
#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOC
#error "TSLPRM_USE_GPIOC is not defined."
#endif

#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))
#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOF
#error "TSLPRM_USE_GPIOA is not defined."
#endif

#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))
#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOG
#error "TSLPRM_USE_GPIOG is not defined."
#endif

#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))
#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_CT_PERIOD
#error "TSLPRM_CT_PERIOD is not defined."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_TIMER_FREQ
#error "TSLPRM_TIMER_FREQ is not defined."
#endif

#endif

//------------------------------------------------------------------------------

#if (defined(STM32L1XX_HD) || defined(STM32L1XX_XL)) && !defined(TSLPRM_STM32L1XX_SW_ACQ)

#define TMP_RELOAD ((TSLPRM_CT_PERIOD * TSLPRM_TIMER_FREQ)/2)

#if ((TMP_RELOAD < 4) || (TMP_RELOAD > 16534))
#error "The calculated Timer RELOAD value is out of range (4 .. 65534)."
#endif

#if ((TMP_RELOAD % 2) != (0))
#error "The calculated Timer RELOAD value is odd and must be even."
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MDP) && defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_PROTECT_IO_ACCESS
#error "TSLPRM_PROTECT_IO_ACCESS is not defined."
#endif

#if ((TSLPRM_PROTECT_IO_ACCESS < 0) || (TSLPRM_PROTECT_IO_ACCESS > 1))
#error "TSLPRM_PROTECT_IO_ACCESS is out of range (0 .. 1)."
#endif

#endif

//------------------------------------------------------------------------------

#if defined(STM32L1XX_MDP) && defined(TSLPRM_STM32L1XX_SW_ACQ)

#ifndef TSLPRM_USE_GPIOA
#error "TSLPRM_USE_GPIOA is not defined."
#endif

#if ((TSLPRM_USE_GPIOA < 0) || (TSLPRM_USE_GPIOA > 1))
#error "TSLPRM_USE_GPIOA is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOB
#error "TSLPRM_USE_GPIOB is not defined."
#endif

#if ((TSLPRM_USE_GPIOB < 0) || (TSLPRM_USE_GPIOB > 1))
#error "TSLPRM_USE_GPIOB is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOC
#error "TSLPRM_USE_GPIOC is not defined."
#endif

#if ((TSLPRM_USE_GPIOC < 0) || (TSLPRM_USE_GPIOC > 1))
#error "TSLPRM_USE_GPIOC is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOF
#error "TSLPRM_USE_GPIOA is not defined."
#endif

#if ((TSLPRM_USE_GPIOF < 0) || (TSLPRM_USE_GPIOF > 1))
#error "TSLPRM_USE_GPIOF is out of range (0 .. 1)."
#endif

#ifndef TSLPRM_USE_GPIOG
#error "TSLPRM_USE_GPIOG is not defined."
#endif

#if ((TSLPRM_USE_GPIOG < 0) || (TSLPRM_USE_GPIOG > 1))
#error "TSLPRM_USE_GPIOG is out of range (0 .. 1)."
#endif

#endif

#endif /* __TSL_CHECK_CONFIG_STM32L1XX_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/