Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / PowerManagement_1-1 / module.c @ ddf34c3d

History | View | Annotate | Download (46.878 KB)

1
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

    
19
/**
20
 * @file
21
 * @brief   Structures and constant for the PowerManagement module.
22
 *
23
 * @addtogroup powermanagement_module
24
 * @{
25
 */
26

    
27
#include "module.h"
28

    
29
/*===========================================================================*/
30
/**
31
 * @name Module specific functions
32
 * @{
33
 */
34
/*===========================================================================*/
35

    
36
/** @} */
37

    
38
/*===========================================================================*/
39
/**
40
 * @name ChibiOS/HAL configuration
41
 * @{
42
 */
43
/*===========================================================================*/
44

    
45
ADCConversionGroup moduleHalAdcVsysConversionGroup = {
46
  /* buffer type        */ true,
47
  /* number of channels */ 1,
48
  /* callback function  */ NULL,
49
  /* error callback     */ NULL,
50
  /* CR1                */ ADC_CR1_AWDEN | ADC_CR1_AWDIE,
51
  /* CR2                */ ADC_CR2_SWSTART | ADC_CR2_CONT,
52
  /* SMPR1              */ 0,
53
  /* SMPR2              */ ADC_SMPR2_SMP_AN9(ADC_SAMPLE_480),
54
  /* HTR                */ ADC_HTR_HT,
55
  /* LTR                */ 0,
56
  /* SQR1               */ ADC_SQR1_NUM_CH(1),
57
  /* SQR2               */ 0,
58
  /* SQR3               */ ADC_SQR3_SQ1_N(ADC_CHANNEL_IN9),
59
};
60

    
61
CANConfig moduleHalCanConfig = {
62
  /* mcr  */ CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
63
  /* btr  */ CAN_BTR_SJW(1) | CAN_BTR_TS2(3) | CAN_BTR_TS1(15) | CAN_BTR_BRP(1),
64
};
65

    
66
I2CConfig moduleHalI2cSrPm18Pm33GaugeRearConfig = {
67
  /* I²C mode   */ OPMODE_I2C,
68
  /* frequency  */ 400000, // TODO: replace with some macro (-> ChibiOS/HAL)
69
  /* duty cycle */ FAST_DUTY_CYCLE_2,
70
};
71

    
72
I2CConfig moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig = {
73
  /* I²C mode   */ OPMODE_I2C,
74
  /* frequency  */ 400000, // TODO: replace with some macro (-> ChibiOS/HAL)
75
  /* duty cycle */ FAST_DUTY_CYCLE_2,
76
};
77

    
78
PWMConfig moduleHalPwmBuzzerConfig = {
79
  /* frequency              */ 1000000,
80
  /* period                 */ 0,
81
  /* callback               */ NULL,
82
  /* channel configurations */ {
83
    /* channel 0              */ {
84
      /* mode                   */ PWM_OUTPUT_DISABLED,
85
      /* callback               */ NULL
86
    },
87
    /* channel 1              */ {
88
      /* mode                   */ PWM_OUTPUT_ACTIVE_HIGH,
89
      /* callback               */ NULL
90
    },
91
    /* channel 2              */ {
92
      /* mode                   */ PWM_OUTPUT_DISABLED,
93
      /* callback               */ NULL
94
    },
95
    /* channel 3              */ {
96
      /* mode                   */ PWM_OUTPUT_DISABLED,
97
      /* callback               */ NULL
98
    },
99
  },
100
  /* TIM CR2 register       */ 0,
101
#if STM32_PWM_USE_ADVANCED
102
  /* TIM BDTR register      */ 0,
103
#endif
104
  /* TIM DIER register      */ 0,
105
};
106

    
107
SerialConfig moduleHalProgIfConfig = {
108
  /* bit rate */ 115200,
109
  /* CR1      */ 0,
110
  /* CR1      */ 0,
111
  /* CR1      */ 0,
112
};
113

    
114
/** @} */
115

    
116
/*===========================================================================*/
117
/**
118
 * @name GPIO definitions
119
 * @{
120
 */
121
/*===========================================================================*/
122

    
123
/**
124
 * @brief   SYS_REG_EN output signal GPIO.
125
 */
126
static apalGpio_t _gpioSysRegEn = {
127
  /* port */ GPIOA,
128
  /* pad  */ GPIOA_SYS_REG_EN,
129
};
130
ROMCONST apalControlGpio_t moduleSysRegEn = {
131
  /* GPIO */ &_gpioSysRegEn,
132
  /* meta */ {
133
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
134
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
135
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
136
  },
137
};
138

    
139
/**
140
 * @brief   IR_INT1 input signal GPIO.
141
 */
142
static apalGpio_t _gpioIrInt1 = {
143
  /* port */ GPIOB,
144
  /* pad  */ GPIOB_IR_INT1_N,
145
};
146
ROMCONST apalControlGpio_t moduleGpioIrInt1 = {
147
  /* GPIO */ &_gpioIrInt1,
148
  /* meta */ {
149
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
150
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR)
151
    /* active state   */ (VCNL4020_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
152
    /* interrupt edge */ VCNL4020_LLD_INT_EDGE,
153
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X)
154
    /* active state   */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
155
    /* interrupt edge */ PCAL6524_LLD_INT_EDGE,
156
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X)
157
    /* active state   */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
158
    /* interrupt edge */ PCAL6524_LLD_INT_EDGE,
159
#else
160
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
161
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
162
#endif
163
  },
164
};
165

    
166
/**
167
 * @brief   POWER_EN output signal GPIO.
168
 */
169
static apalGpio_t _gpioPowerEn = {
170
  /* port */ GPIOB,
171
  /* pad  */ GPIOB_POWER_EN,
172
};
173
ROMCONST apalControlGpio_t moduleGpioPowerEn = {
174
  /* GPIO */ &_gpioPowerEn,
175
  /* meta */ {
176
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
177
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
178
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
179
  },
180
};
181

    
182
/**
183
 * @brief   SYS_UART_DN bidirectional signal GPIO.
184
 */
185
static apalGpio_t _gpioSysUartDn = {
186
  /* port */ GPIOB,
187
  /* pad  */ GPIOB_SYS_UART_DN,
188
};
189
ROMCONST apalControlGpio_t moduleGpioSysUartDn = {
190
  /* GPIO */ &_gpioSysUartDn,
191
  /* meta */ {
192
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
193
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
194
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
195
  },
196
};
197

    
198
/**
199
 * @brief   CHARGE_STAT2A input signal GPIO.
200
 */
201
static apalGpio_t _gpioChargeStat2A = {
202
  /* port */ GPIOB,
203
  /* pad  */ GPIOB_CHARGE_STAT2A,
204
};
205
ROMCONST apalControlGpio_t moduleGpioChargeStat2A = {
206
  /* GPIO */ &_gpioChargeStat2A,
207
  /* meta */ {
208
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
209
    /* active state   */ BQ241xx_LLD_CHARGE_STATUS_GPIO_ACTIVE_STATE,
210
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
211
  },
212
};
213

    
214
/**
215
 * @brief   GAUGE_BATLOW2 input signal GPIO.
216
 */
217
static apalGpio_t _gpioGaugeBatLow2 = {
218
  /* port */ GPIOB,
219
  /* pad  */ GPIOB_GAUGE_BATLOW2,
220
};
221
ROMCONST apalControlGpio_t moduleGpioGaugeBatLow2 = {
222
  /* GPIO */ &_gpioGaugeBatLow2,
223
  /* meta */ {
224
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
225
    /* active state   */ BQ27500_LLD_BATLOW_ACTIVE_STATE,
226
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
227
  },
228
};
229

    
230
/**
231
 * @brief   GAUGE_BATGD2 input signal GPIO.
232
 */
233
static apalGpio_t _gpioGaugeBatGd2 = {
234
  /* port */ GPIOB,
235
  /* pad  */ GPIOB_GAUGE_BATGD2_N,
236
};
237
ROMCONST apalControlGpio_t moduleGpioGaugeBatGd2 = {
238
  /* GPIO */ &_gpioGaugeBatGd2,
239
  /* meta */ {
240
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
241
    /* active state   */ BQ27500_LLD_BATGOOD_ACTIVE_STATE,
242
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
243
  },
244
};
245

    
246
/**
247
 * @brief   LED output signal GPIO.
248
 */
249
static apalGpio_t _gpioLed = {
250
  /* port */ GPIOB,
251
  /* pad  */ GPIOB_LED,
252
};
253
ROMCONST apalControlGpio_t moduleGpioLed = {
254
  /* GPIO */ &_gpioLed,
255
  /* meta */ {
256
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
257
    /* active state   */ LED_LLD_GPIO_ACTIVE_STATE,
258
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
259
  },
260
};
261

    
262
/**
263
 * @brief   SYS_UART_UP bidirectional signal GPIO.
264
 */
265
static apalGpio_t _gpioSysUartUp = {
266
  /* port */ GPIOB,
267
  /* pad  */ GPIOB_SYS_UART_UP,
268
};
269
ROMCONST apalControlGpio_t moduleGpioSysUartUp = {
270
  /* GPIO */ &_gpioSysUartUp,
271
  /* meta */ {
272
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
273
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
274
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
275
  },
276
};
277

    
278
/**
279
 * @brief   CHARGE_STAT1A input signal GPIO.
280
 */
281
static apalGpio_t _gpioChargeStat1A = {
282
  /* port */ GPIOC,
283
  /* pad  */ GPIOC_CHARGE_STAT1A,
284
};
285
ROMCONST apalControlGpio_t moduleGpioChargeStat1A = {
286
  /* GPIO */ &_gpioChargeStat1A,
287
  /* meta */ {
288
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
289
    /* active state   */ BQ241xx_LLD_CHARGE_STATUS_GPIO_ACTIVE_STATE,
290
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
291
  },
292
};
293

    
294
/**
295
 * @brief   GAUGE_BATLOW1 input signal GPIO.
296
 */
297
static apalGpio_t _gpioGaugeBatLow1 = {
298
  /* port */ GPIOC,
299
  /* pad  */ GPIOC_GAUGE_BATLOW1,
300
};
301
ROMCONST apalControlGpio_t moduleGpioGaugeBatLow1 = {
302
  /* GPIO */ &_gpioGaugeBatLow1,
303
  /* meta */ {
304
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
305
    /* active state   */ BQ27500_LLD_BATLOW_ACTIVE_STATE,
306
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
307
  },
308
};
309

    
310
/**
311
 * @brief   GAUGE_BATGD1 input signal GPIO.
312
 */
313
static apalGpio_t _gpioGaugeBatGd1 = {
314
  /* port */ GPIOC,
315
  /* pad  */ GPIOC_GAUGE_BATGD1_N,
316
};
317
ROMCONST apalControlGpio_t moduleGpioGaugeBatGd1 = {
318
  /* GPIO */ &_gpioGaugeBatGd1,
319
  /* meta */ {
320
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
321
    /* active state   */ BQ27500_LLD_BATGOOD_ACTIVE_STATE,
322
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
323
  },
324
};
325

    
326
/**
327
 * @brief   CHARG_EN1 output signal GPIO.
328
 */
329
static apalGpio_t _gpioChargeEn1 = {
330
  /* port */ GPIOC,
331
  /* pad  */ GPIOC_CHARGE_EN1_N,
332
};
333
ROMCONST apalControlGpio_t moduleGpioChargeEn1 = {
334
  /* GPIO */ &_gpioChargeEn1,
335
  /* meta */ {
336
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
337
    /* active state   */ BQ241xx_LLD_ENABLED_GPIO_ACTIVE_STATE,
338
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
339
  },
340
};
341

    
342
/**
343
 * @brief   IR_INT2 input signal GPIO.
344
 */
345
static apalGpio_t _gpioIrInt2 = {
346
  /* port */ GPIOC,
347
  /* pad  */ GPIOC_IR_INT2_N,
348
};
349
ROMCONST apalControlGpio_t moduleGpioIrInt2 = {
350
  /* GPIO */ &_gpioIrInt2,
351
  /* meta */ {
352
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
353
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR)
354
    /* active state   */ (VCNL4020_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
355
    /* interrupt edge */ VCNL4020_LLD_INT_EDGE,
356
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X)
357
    /* active state   */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
358
    /* interrupt edge */ PCAL6524_LLD_INT_EDGE,
359
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X)
360
    /* active state   */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
361
    /* interrupt edge */ PCAL6524_LLD_INT_EDGE,
362
#else
363
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
364
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
365
#endif
366
  },
367
};
368

    
369
/**
370
 * @brief   TOUCH_INT input signal GPIO.
371
 */
372
static apalGpio_t _gpioTouchInt = {
373
  /* port */ GPIOC,
374
  /* pad  */ GPIOC_TOUCH_INT_N,
375
};
376
ROMCONST apalControlGpio_t moduleGpioTouchInt = {
377
  /* GPIO */ &_gpioTouchInt,
378
  /* meta */ {
379
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
380
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR)
381
    /* active state   */ (MPR121_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
382
    /* interrupt edge */ MPR121_LLD_INT_EDGE,
383
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X)
384
    /* active state   */ (AT42QT1050_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
385
    /* interrupt edge */ AT42QT1050_LLD_INT_EDGE,
386
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X)
387
    /* active state   */ (AT42QT1050_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
388
    /* interrupt edge */ AT42QT1050_LLD_INT_EDGE,
389
#else
390
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
391
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
392
#endif
393
  },
394
};
395

    
396
/**
397
 * @brief   SYS_DONE input signal GPIO.
398
 */
399
static apalGpio_t _gpioSysDone = {
400
  /* port */ GPIOC,
401
  /* pad  */ GPIOC_SYS_DONE,
402
};
403
ROMCONST apalControlGpio_t moduleGpioSysDone = {
404
  /* GPIO */ &_gpioSysDone,
405
  /* meta */ {
406
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
407
    /* active state   */ APAL_GPIO_ACTIVE_HIGH,
408
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
409
  },
410
};
411

    
412
/**
413
 * @brief   SYS_PROG output signal GPIO.
414
 */
415
static apalGpio_t _gpioSysProg = {
416
  /* port */ GPIOC,
417
  /* pad  */ GPIOC_SYS_PROG_N,
418
};
419
ROMCONST apalControlGpio_t moduleGpioSysProg = {
420
  /* GPIO */ &_gpioSysProg,
421
  /* meta */ {
422
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
423
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
424
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
425
  },
426
};
427

    
428
/**
429
 * @brief   PATH_DC input signal GPIO.
430
 */
431
static apalGpio_t _gpioPathDc = {
432
  /* port */ GPIOC,
433
  /* pad  */ GPIOC_PATH_DC,
434
};
435
ROMCONST apalControlGpio_t moduleGpioPathDc = {
436
  /* GPIO */ &_gpioPathDc,
437
  /* meta */ {
438
    /* direction      */ APAL_GPIO_DIRECTION_INPUT,
439
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
440
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
441
  },
442
};
443

    
444
/**
445
 * @brief   SYS_SPI_DIR bidirectional signal GPIO.
446
 */
447
static apalGpio_t _gpioSysSpiDir = {
448
  /* port */ GPIOC,
449
  /* pad  */ GPIOC_SYS_SPI_DIR,
450
};
451
ROMCONST apalControlGpio_t moduleGpioSysSpiDir = {
452
  /* GPIO */ &_gpioSysSpiDir,
453
  /* meta */ {
454
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
455
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
456
    /* interrupt edge */ APAL_GPIO_EDGE_FALLING,
457
  },
458
};
459

    
460
/**
461
 * @brief   SYS_SYNC bidirectional signal GPIO.
462
 */
463
static apalGpio_t _gpioSysSync = {
464
  /* port */ GPIOC,
465
  /* pad  */ GPIOC_SYS_INT_N,
466
};
467
ROMCONST apalControlGpio_t moduleGpioSysSync = {
468
  /* GPIO */ &_gpioSysSync,
469
  /* meta */ {
470
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
471
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
472
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
473
  },
474
};
475

    
476
/**
477
 * @brief   SYS_PD bidirectional signal GPIO.
478
 */
479
static apalGpio_t _gpioSysPd = {
480
  /* port */ GPIOC,
481
  /* pad  */ GPIOC_SYS_PD_N,
482
};
483
ROMCONST apalControlGpio_t moduleGpioSysPd = {
484
  /* GPIO */ &_gpioSysPd,
485
  /* meta */ {
486
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
487
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
488
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
489
  },
490
};
491

    
492
/**
493
 * @brief   SYS_WARMRST bidirectional signal GPIO.
494
 */
495
static apalGpio_t _gpioSysWarmrst = {
496
  /* port */ GPIOC,
497
  /* pad  */ GPIOC_SYS_WARMRST_N,
498
};
499
ROMCONST apalControlGpio_t moduleGpioSysWarmrst = {
500
  /* GPIO */ &_gpioSysWarmrst,
501
  /* meta */ {
502
    /* direction      */ APAL_GPIO_DIRECTION_BIDIRECTIONAL,
503
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
504
    /* interrupt edge */ APAL_GPIO_EDGE_BOTH,
505
  },
506
};
507

    
508
/**
509
 * @brief   BT_RST output signal GPIO.
510
 */
511
static apalGpio_t _gpioBtRst = {
512
  /* port */ GPIOC,
513
  /* pad  */ GPIOC_BT_RST,
514
};
515
ROMCONST apalControlGpio_t moduleGpioBtRst = {
516
  /* GPIO */ &_gpioBtRst,
517
  /* meta */ {
518
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
519
    /* active state   */ APAL_GPIO_ACTIVE_LOW,
520
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
521
  },
522
};
523

    
524
/**
525
 * @brief   CHARGE_EN2 output signal GPIO.
526
 */
527
static apalGpio_t _gpioChargeEn2 = {
528
  /* port */ GPIOD,
529
  /* pad  */ GPIOD_CHARGE_EN2_N,
530
};
531
ROMCONST apalControlGpio_t moduleGpioChargeEn2 = {
532
  /* GPIO */ &_gpioChargeEn2,
533
  /* meta */ {
534
    /* direction      */ APAL_GPIO_DIRECTION_OUTPUT,
535
    /* active state   */ BQ241xx_LLD_ENABLED_GPIO_ACTIVE_STATE,
536
    /* interrupt edge */ APAL_GPIO_EDGE_NONE,
537
  },
538
};
539

    
540
/** @} */
541

    
542
/*===========================================================================*/
543
/**
544
 * @name AMiRo-OS core configurations
545
 * @{
546
 */
547
/*===========================================================================*/
548

    
549
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
550
ROMCONST char* moduleShellPrompt = "PowerManagement";
551
#endif
552

    
553
/** @} */
554

    
555
/*===========================================================================*/
556
/**
557
 * @name Startup Shutdown Synchronization Protocol (SSSP)
558
 * @{
559
 */
560
/*===========================================================================*/
561

    
562
/** @} */
563

    
564
/*===========================================================================*/
565
/**
566
 * @name Low-level drivers
567
 * @{
568
 */
569
/*===========================================================================*/
570

    
571
AT24C01BDriver moduleLldEeprom = {
572
  /* I2C driver   */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
573
  /* I2C address  */ AT24C01B_LLD_I2C_ADDR_FIXED,
574
};
575

    
576
BQ241xxDriver moduleLldBatteryChargerFront = {
577
  /* charge enable GPIO */ &moduleGpioChargeEn1,
578
  /* charge status GPIO */ &moduleGpioChargeStat1A,
579
};
580

    
581
BQ241xxDriver moduleLldBatteryChargerRear = {
582
  /* charge enable GPIO */ &moduleGpioChargeEn2,
583
  /* charge status GPIO */ &moduleGpioChargeStat2A,
584
};
585

    
586
BQ27500Driver moduleLldFuelGaugeFront = {
587
  /* I2C driver         */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
588
  /* battery low GPIO   */ &moduleGpioGaugeBatLow1,
589
  /* battery good GPIO  */ &moduleGpioGaugeBatGd1,
590
};
591

    
592
BQ27500Driver moduleLldFuelGaugeRear = {
593
  /* I2C driver         */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
594
  /* battery low GPIO   */ &moduleGpioGaugeBatLow2,
595
  /* battery good GPIO  */ &moduleGpioGaugeBatGd2,
596
};
597

    
598
INA219Driver moduleLldPowerMonitorVdd = {
599
  /* I2C Driver       */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
600
  /* I²C address      */ INA219_LLD_I2C_ADDR_A0 | INA219_LLD_I2C_ADDR_A1,
601
  /* current LSB (uA) */ 0x00u,
602
  /* configuration    */ NULL,
603
};
604

    
605
INA219Driver moduleLldPowerMonitorVio18 = {
606
  /* I2C Driver       */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
607
  /* I²C address      */ INA219_LLD_I2C_ADDR_A1,
608
  /* current LSB (uA) */ 0x00u,
609
  /* configuration    */ NULL,
610
};
611

    
612
INA219Driver moduleLldPowerMonitorVio33 = {
613
  /* I2C Driver       */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
614
  /* I²C address      */ INA219_LLD_I2C_ADDR_FIXED,
615
  /* current LSB (uA) */ 0x00u,
616
  /* configuration    */ NULL,
617
};
618

    
619
INA219Driver moduleLldPowerMonitorVsys42 = {
620
  /* I2C Driver       */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
621
  /* I²C address      */ INA219_LLD_I2C_ADDR_FIXED,
622
  /* current LSB (uA) */ 0x00u,
623
  /* configuration    */ NULL,
624
};
625

    
626
INA219Driver moduleLldPowerMonitorVio50 = {
627
  /* I2C Driver       */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
628
  /* I²C address      */ INA219_LLD_I2C_ADDR_A1,
629
  /* current LSB (uA) */ 0x00u,
630
  /* configuration    */ NULL,
631
};
632

    
633
LEDDriver moduleLldStatusLed = {
634
  /* LED GPIO */ &moduleGpioLed,
635
};
636

    
637
TPS6211xDriver moduleLldStepDownConverter = {
638
  /* Power enable GPIO */ &moduleGpioPowerEn,
639
};
640

    
641
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
642

    
643
MPR121Driver moduleLldTouch = {
644
  /* I²C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
645
};
646

    
647
PCA9544ADriver moduleLldI2cMultiplexer1 = {
648
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
649
  /* I²C address  */ PCA9544A_LLD_I2C_ADDR_A0 | PCA9544A_LLD_I2C_ADDR_A1 | PCA9544A_LLD_I2C_ADDR_A2,
650
};
651

    
652
PCA9544ADriver moduleLldI2cMultiplexer2 = {
653
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
654
  /* I²C address  */ PCA9544A_LLD_I2C_ADDR_A0 | PCA9544A_LLD_I2C_ADDR_A1 | PCA9544A_LLD_I2C_ADDR_A2,
655
};
656

    
657
VCNL4020Driver moduleLldProximity1 = {
658
  /* I²C Driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
659
};
660

    
661
VCNL4020Driver moduleLldProximity2 = {
662
  /* I²C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
663
};
664

    
665
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */
666

    
667
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__)
668

    
669
PCAL6524Driver moduleLldGpioExtender1 = {
670
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
671
  /* I²C address  */ PCAL6524_LLD_I2C_ADDR_VDD,
672
};
673

    
674
PCAL6524Driver moduleLldGpioExtender2 = {
675
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
676
  /* I²C address  */ PCAL6524_LLD_I2C_ADDR_VDD,
677
};
678

    
679
AT42QT1050Driver moduleLldTouch = {
680
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
681
  /* I²C address  */ AT42QT1050_LLD_I2C_ADDRSEL_LOW,
682
};
683

    
684
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */
685

    
686
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__)
687

    
688
PCAL6524Driver moduleLldGpioExtender1 = {
689
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
690
  /* I²C address  */ PCAL6524_LLD_I2C_ADDR_VDD,
691
};
692

    
693
PCAL6524Driver moduleLldGpioExtender2 = {
694
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
695
  /* I²C address  */ PCAL6524_LLD_I2C_ADDR_VDD,
696
};
697

    
698
AT42QT1050Driver moduleLldTouch = {
699
  /* I²C driver   */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
700
  /* I²C address  */ AT42QT1050_LLD_I2C_ADDRSEL_LOW,
701
};
702

    
703
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */
704

    
705
/** @} */
706

    
707
/*===========================================================================*/
708
/**
709
 * @name Unit tests (UT)
710
 * @{
711
 */
712
/*===========================================================================*/
713
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
714
#include <string.h>
715

    
716
/*
717
 * ADC
718
 */
719
static int _utShellCmdCb_Adc(BaseSequentialStream* stream, int argc, char* argv[])
720
{
721
  (void)argc;
722
  (void)argv;
723
  aosUtRun(stream, &moduleUtAdcVsys, NULL);
724
  return AOS_OK;
725
}
726
static ut_adcdata_t _utAdcVsysData = {
727
  /* driver               */ &MODULE_HAL_ADC_VSYS,
728
  /* ADC conversion group */ &moduleHalAdcVsysConversionGroup,
729
};
730
aos_unittest_t moduleUtAdcVsys = {
731
  /* name           */ "ADC",
732
  /* info           */ "VSYS",
733
  /* test function  */ utAdcFunc,
734
  /* shell command  */ {
735
    /* name     */ "unittest:ADC",
736
    /* callback */ _utShellCmdCb_Adc,
737
    /* next     */ NULL,
738
  },
739
  /* data           */ &_utAdcVsysData,
740
};
741

    
742
/*
743
 * AT24C01B (EEPROM)
744
 */
745
static int _utShellCmdCb_AlldAt24c01b(BaseSequentialStream* stream, int argc, char* argv[])
746
{
747
  (void)argc;
748
  (void)argv;
749
  aosUtRun(stream, &moduleUtAlldAt24c01b, NULL);
750
  return AOS_OK;
751
}
752
static ut_at24c01bdata_t _utAlldAt24c01bData = {
753
  /* driver   */ &moduleLldEeprom,
754
  /* timeout  */ MICROSECONDS_PER_SECOND,
755
};
756
aos_unittest_t moduleUtAlldAt24c01b = {
757
  /* name           */ "AT24C01B",
758
  /* info           */ "1kbit EEPROM",
759
  /* test function  */ utAlldAt24c01bFunc,
760
  /* shell command  */ {
761
    /* name     */ "unittest:EEPROM",
762
    /* callback */ _utShellCmdCb_AlldAt24c01b,
763
    /* next     */ NULL,
764
  },
765
  /* data           */ &_utAlldAt24c01bData,
766
};
767

    
768
/*
769
 * bq24103a (battery charger)
770
 */
771
static int _utShellCmdCb_AlldBq24103a(BaseSequentialStream* stream, int argc, char* argv[])
772
{
773
  // local variables
774
  bool print_help = false;
775

    
776
  // evaluate argument
777
  if (argc == 2) {
778
    if (strcmp(argv[1], "-f") == 0 || strcmp(argv[1], "--front") == 0) {
779
      moduleUtAlldBq24103a.data = &moduleLldBatteryChargerFront;
780
      aosUtRun(stream, &moduleUtAlldBq24103a, "front battery");
781
      moduleUtAlldBq24103a.data = NULL;
782
    }
783
    else if (strcmp(argv[1], "-r") == 0 || strcmp(argv[1], "--rear") == 0) {
784
      moduleUtAlldBq24103a.data = &moduleLldBatteryChargerRear;
785
      aosUtRun(stream, &moduleUtAlldBq24103a, "rear battery");
786
      moduleUtAlldBq24103a.data = NULL;
787
    }
788
    else {
789
      print_help = true;
790
    }
791
  } else {
792
    print_help = true;
793
  }
794

    
795
  // print help or just return
796
  if (print_help) {
797
    chprintf(stream, "Usage: %s OPTION\n", argv[0]);
798
    chprintf(stream, "Options:\n");
799
    chprintf(stream, "  --front, -f\n");
800
    chprintf(stream, "    Test the front battery charger.\n");
801
    chprintf(stream, "  --rear, -r\n");
802
    chprintf(stream, "    Test the rear battery charger.\n");
803
    return AOS_INVALID_ARGUMENTS;
804
  } else {
805
    return AOS_OK;
806
  }
807
}
808
aos_unittest_t moduleUtAlldBq24103a = {
809
  /* name           */ "bq24103a",
810
  /* info           */ "battery charger",
811
  /* test function  */ utAlldBq241xxFunc,
812
  /* shell command  */ {
813
    /* name     */ "unittest:BatteryCharger",
814
    /* callback */ _utShellCmdCb_AlldBq24103a,
815
    /* next     */ NULL,
816
  },
817
  /* data           */ NULL,
818
};
819

    
820
/*
821
 * bq27500 (fuel gauge)
822
 */
823
static int _utShellCmdCb_AlldBq27500(BaseSequentialStream* stream, int argc, char* argv[])
824
{
825
  // evaluate arguments
826
  if (argc == 2) {
827
    if (strcmp(argv[1], "-f") == 0 || strcmp(argv[1], "--front") == 0) {
828
      ((ut_bq27500data_t*)moduleUtAlldBq27500.data)->driver = &moduleLldFuelGaugeFront;
829
      aosUtRun(stream, &moduleUtAlldBq27500, "front battery");
830
      ((ut_bq27500data_t*)moduleUtAlldBq27500.data)->driver = NULL;
831
      return AOS_OK;
832
    }
833
    else if (strcmp(argv[1], "-r") == 0 || strcmp(argv[1], "--rear") == 0) {
834
      ((ut_bq27500data_t*)moduleUtAlldBq27500.data)->driver = &moduleLldFuelGaugeRear;
835
      aosUtRun(stream, &moduleUtAlldBq27500, "rear battery");
836
      ((ut_bq27500data_t*)moduleUtAlldBq27500.data)->driver = NULL;
837
      return AOS_OK;
838
    }
839
  }
840
  // print help
841
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
842
  chprintf(stream, "Options:\n");
843
  chprintf(stream, "  --front, -f\n");
844
  chprintf(stream, "    Test the front battery fuel gauge.\n");
845
  chprintf(stream, "  --rear, -r\n");
846
  chprintf(stream, "    Test the rear battery fuel gauge.\n");
847
  return AOS_INVALID_ARGUMENTS;
848
}
849
static ut_bq27500data_t _utAlldBq27500Data = {
850
  /* driver   */ NULL,
851
  /* timeout  */ MICROSECONDS_PER_SECOND,
852
};
853
aos_unittest_t moduleUtAlldBq27500 = {
854
  /* name           */ "bq27500",
855
  /* info           */ "fuel gauge",
856
  /* test function  */ utAlldBq27500Func,
857
  /* shell command  */ {
858
    /* name     */ "unittest:FuelGauge",
859
    /* callback */ _utShellCmdCb_AlldBq27500,
860
    /* next     */ NULL,
861
  },
862
  /* data           */ &_utAlldBq27500Data,
863
};
864

    
865
/*
866
 * bq27500 (fuel gauge) in combination with bq24103a (battery charger)
867
 */
868
static int _utShellCmdCb_AlldBq27500Bq24103a(BaseSequentialStream* stream, int argc, char* argv[])
869
{
870
  // evaluate arguments
871
  if (argc == 2) {
872
    if (strcmp(argv[1], "-f") == 0 || strcmp(argv[1], "--front") == 0) {
873
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq27500 = &moduleLldFuelGaugeFront;
874
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq241xx = &moduleLldBatteryChargerFront;
875
      aosUtRun(stream, &moduleUtAlldBq27500Bq24103a, "front battery");
876
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq27500 = NULL;
877
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq241xx = NULL;
878
      return AOS_OK;
879
    }
880
    else if (strcmp(argv[1], "-r") == 0 || strcmp(argv[1], "--rear") == 0) {
881
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq27500 = &moduleLldFuelGaugeRear;
882
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq241xx = &moduleLldBatteryChargerRear;
883
      aosUtRun(stream, &moduleUtAlldBq27500Bq24103a, "rear battery");
884
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq27500 = NULL;
885
      ((ut_bq27500bq241xxdata_t*)moduleUtAlldBq27500Bq24103a.data)->bq241xx = NULL;
886
      return AOS_OK;
887
    }
888
  }
889
  // print help
890
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
891
  chprintf(stream, "Options:\n");
892
  chprintf(stream, "  --front, -f\n");
893
  chprintf(stream, "    Test the front battery fuel gauge and charger.\n");
894
  chprintf(stream, "  --rear, -r\n");
895
  chprintf(stream, "    Test the rear battery fuel gauge and charger.\n");
896
  return AOS_INVALID_ARGUMENTS;
897
}
898
static ut_bq27500bq241xxdata_t _utAlldBq27500Bq24103aData= {
899
  /* bq27500 driver   */ NULL,
900
  /* bq24103a driver  */ NULL,
901
  /* timeout          */ MICROSECONDS_PER_SECOND,
902
};
903
aos_unittest_t moduleUtAlldBq27500Bq24103a = {
904
  /* name           */ "BQ27500 & BQ24103A",
905
  /* info           */ "fuel gauge & battery charger",
906
  /* test function  */ utAlldBq27500Bq241xxFunc,
907
  /* shell command  */ {
908
    /* name     */ "unittest:FuelGauge&BatteryCharger",
909
    /* callback */ _utShellCmdCb_AlldBq27500Bq24103a,
910
    /* next     */ NULL,
911
  },
912
  /* data           */ &_utAlldBq27500Bq24103aData,
913
};
914

    
915
/*
916
 * INA219 (power monitor)
917
 */
918
static int _utShellCmdCb_AlldIna219(BaseSequentialStream* stream, int argc, char* argv[])
919
{
920
  // evaluate arguments
921
  if (argc == 2) {
922
    if (strcmp(argv[1], "VDD") == 0) {
923
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = &moduleLldPowerMonitorVdd;
924
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 3.3f;
925
      aosUtRun(stream, &moduleUtAlldIna219, "VDD (3.3V)");
926
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = NULL;
927
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 0.0f;
928
      return AOS_OK;
929
    }
930
    else if (strcmp(argv[1], "VIO1.8") == 0) {
931
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = &moduleLldPowerMonitorVio18;
932
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 1.8f;
933
      aosUtRun(stream, &moduleUtAlldIna219, "VIO (1.8V)");
934
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = NULL;
935
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 0.0f;
936
      return AOS_OK;
937
    }
938
    else if (strcmp(argv[1], "VIO3.3") == 0) {
939
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = &moduleLldPowerMonitorVio33;
940
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 3.3f;
941
      aosUtRun(stream, &moduleUtAlldIna219, "VIO (3.3V)");
942
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = NULL;
943
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 0.0f;
944
      return AOS_OK;
945
    }
946
    else if (strcmp(argv[1], "VSYS4.2") == 0) {
947
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = &moduleLldPowerMonitorVsys42;
948
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 4.2f;
949
      aosUtRun(stream, &moduleUtAlldIna219, "VSYS (4.2V)");
950
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = NULL;
951
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 0.0f;
952
      return AOS_OK;
953
    }
954
    else if (strcmp(argv[1], "VIO5.0") == 0) {
955
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = &moduleLldPowerMonitorVio50;
956
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 5.0f;
957
      aosUtRun(stream, &moduleUtAlldIna219, "VIO (5.0V)");
958
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->inad = NULL;
959
      ((ut_ina219data_t*)moduleUtAlldIna219.data)->v_expected = 0.0f;
960
      return AOS_OK;
961
    }
962
  }
963
  // print help
964
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
965
  chprintf(stream, "Options:\n");
966
  chprintf(stream, "  VDD\n");
967
  chprintf(stream, "    Test VDD (3.3V) power monitor.\n");
968
  chprintf(stream, "  VIO1.8\n");
969
  chprintf(stream, "    Test VIO 1.8V power monitor.\n");
970
  chprintf(stream, "  VIO3.3\n");
971
  chprintf(stream, "    Test VIO 3.3V power monitor.\n");
972
  chprintf(stream, "  VSYS4.2\n");
973
  chprintf(stream, "    Test VSYS 4.2V power monitor.\n");
974
  chprintf(stream, "  VIO5.0\n");
975
  chprintf(stream, "    Test VIO 5.0V power monitor.\n");
976
  return AOS_INVALID_ARGUMENTS;
977
}
978
static ut_ina219data_t _utAlldIna219Data = {
979
  /* driver           */ NULL,
980
  /* expected voltage */ 0.0f,
981
  /* tolerance        */ 0.05f,
982
  /* timeout          */ MICROSECONDS_PER_SECOND,
983
};
984
aos_unittest_t moduleUtAlldIna219 = {
985
  /* name           */ "INA219",
986
  /* info           */ "power monitor",
987
  /* test function  */ utAlldIna219Func,
988
  /* shell command  */ {
989
    /* name     */ "unittest:PowerMonitor",
990
    /* callback */ _utShellCmdCb_AlldIna219,
991
    /* next     */ NULL,
992
  },
993
  /* data           */ &_utAlldIna219Data,
994
};
995

    
996
/*
997
 * Status LED
998
 */
999
static int _utShellCmdCb_AlldLed(BaseSequentialStream* stream, int argc, char* argv[])
1000
{
1001
  (void)argc;
1002
  (void)argv;
1003
  aosUtRun(stream, &moduleUtAlldLed, NULL);
1004
  return AOS_OK;
1005
}
1006
aos_unittest_t moduleUtAlldLed = {
1007
  /* name           */ "LED",
1008
  /* info           */ NULL,
1009
  /* test function  */ utAlldLedFunc,
1010
  /* shell command  */ {
1011
    /* name     */ "unittest:StatusLED",
1012
    /* callback */ _utShellCmdCb_AlldLed,
1013
    /* next     */ NULL,
1014
  },
1015
  /* data           */ &moduleLldStatusLed,
1016
};
1017

    
1018
/*
1019
 * PKLCS1212E4001 (buzzer)
1020
 */
1021
static int _utShellCmdCb_AlldPklcs1212e4001(BaseSequentialStream* stream, int argc, char* argv[])
1022
{
1023
  (void)argc;
1024
  (void)argv;
1025
  aosUtRun(stream, &moduleUtAlldPklcs1212e4001, NULL);
1026
  return AOS_OK;
1027
}
1028
static ut_pkxxxexxx_t _utAlldPklcs1212e4001Data = {
1029
  /* PWM driver   */ &MODULE_HAL_PWM_BUZZER,
1030
  /* PWM channel  */ MODULE_HAL_PWM_BUZZER_CHANNEL
1031
};
1032
aos_unittest_t moduleUtAlldPklcs1212e4001 = {
1033
  /* name           */ "PKLCS1212E4001",
1034
  /* info           */ "buzzer",
1035
  /* test function  */ utAlldPkxxxexxxFunc,
1036
  /* shell command  */ {
1037
    /* name     */ "unittest:Buzzer",
1038
    /* callback */ _utShellCmdCb_AlldPklcs1212e4001,
1039
    /* next     */ NULL,
1040
  },
1041
  /* data           */ &_utAlldPklcs1212e4001Data,
1042
};
1043

    
1044
/*
1045
 * TPS62113 (step-down converter)
1046
 */
1047
static int _utShellCmdCb_AlldTps62113(BaseSequentialStream* stream, int argc, char* argv[])
1048
{
1049
  // Although there are four TPS62113 on the PCB, they all share the same input signal.
1050
  // A sa result, no additional shell arguments need to be evaluated.
1051
  (void)argc;
1052
  (void)argv;
1053
  aosUtRun(stream, &moduleUtAlldTps62113, NULL);
1054
  return AOS_OK;
1055
}
1056
aos_unittest_t moduleUtAlldTps62113 = {
1057
  /* name           */ "TPS62113",
1058
  /* info           */ "step-down converter",
1059
  /* test function  */ utAlldTps6211xFunc,
1060
  /* shell command  */ {
1061
    /* name     */ "unittest:StepDownConverter",
1062
    /* callback */ _utShellCmdCb_AlldTps62113,
1063
    /* next     */ NULL,
1064
  },
1065
  /* data           */ &moduleLldStepDownConverter,
1066
};
1067

    
1068
/*
1069
 * TPS62113 (step-donw converter) in combination with INA219 (power monitor)
1070
 */
1071
static int _utShellCmdCb_AlldTps62113Ina219(BaseSequentialStream* stream, int argc, char* argv[])
1072
{
1073
  (void)argc;
1074
  (void)argv;
1075
  aosUtRun(stream, &moduleUtAlldTps62113Ina219, "VSYS (4.2V)");
1076
  return AOS_OK;
1077
}
1078
static ut_tps6211xina219data_t _utAlldTps62113Ina219Data = {
1079
  /* TPS62113 */ &moduleLldStepDownConverter,
1080
  /* INA219   */ &moduleLldPowerMonitorVsys42,
1081
  /* timeout  */ MICROSECONDS_PER_SECOND,
1082
};
1083
aos_unittest_t moduleUtAlldTps62113Ina219 = {
1084
  /* name           */ "TPS62113 & INA219",
1085
  /* info           */ "step-down converter & power monitor",
1086
  /* test function  */ utAlldTps6211xIna219Func,
1087
  /* shell command  */ {
1088
    /* name     */ "unittest:StepDownConverter&PowerMonitor",
1089
    /* callback */ _utShellCmdCb_AlldTps62113Ina219,
1090
    /* next     */ NULL,
1091
  },
1092
  /* data           */ &_utAlldTps62113Ina219Data,
1093
};
1094

    
1095
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
1096

    
1097
/*
1098
 * MPR121 (touch sensor)
1099
 */
1100
static int _utShellCmdCb_AlldMpr121(BaseSequentialStream* stream, int argc, char* argv[])
1101
{
1102
  (void)argc;
1103
  (void)argv;
1104
  aosUtRun(stream, &moduleUtAlldMpr121, NULL);
1105
  return AOS_OK;
1106
}
1107
static ut_mpr121data_t _utAlldMpr121Data= {
1108
  /* MPR121 driver  */ &moduleLldTouch,
1109
  /* timeout        */ MICROSECONDS_PER_SECOND,
1110
  /* event source   */ &aos.events.io,
1111
  /* event flags    */ MODULE_OS_IOEVENTFLAGS_TOUCHINT,
1112
};
1113
aos_unittest_t moduleUtAlldMpr121 = {
1114
  /* name           */ "MPR121",
1115
  /* info           */ "touch sensor",
1116
  /* test function  */ utAlldMpr121Func,
1117
  /* shell command  */ {
1118
    /* name     */ "unittest:Touch",
1119
    /* callback */ _utShellCmdCb_AlldMpr121,
1120
    /* next     */ NULL,
1121
  },
1122
  /* data           */ &_utAlldMpr121Data,
1123
};
1124

    
1125
/*
1126
 * PCA9544A (I2C multiplexer)
1127
 */
1128
static int _utShellCmdCb_AlldPca5944a(BaseSequentialStream* stream, int argc, char* argv[])
1129
{
1130
  // evaluate arguments
1131
  if (argc == 2) {
1132
    if (strcmp(argv[1], "#1") == 0) {
1133
      ((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = &moduleLldI2cMultiplexer1;
1134
      aosUtRun(stream, &moduleUtAlldPca9544a, "I2C bus #1");
1135
      ((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = NULL;
1136
      return AOS_OK;
1137
    }
1138
    else if (strcmp(argv[1], "#2") == 0) {
1139
      ((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = &moduleLldI2cMultiplexer2;
1140
      aosUtRun(stream, &moduleUtAlldPca9544a, "I2C bus #2");
1141
      ((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = NULL;
1142
      return AOS_OK;
1143
    }
1144
  }
1145
  // print help
1146
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
1147
  chprintf(stream, "Options:\n");
1148
  chprintf(stream, "  #1\n");
1149
  chprintf(stream, "    Test the multiplexer on the I2C bus #1.\n");
1150
  chprintf(stream, "  #2\n");
1151
  chprintf(stream, "    Test the multiplexer on the I2C bus #2.\n");
1152
  return AOS_INVALID_ARGUMENTS;
1153
}
1154
static ut_pca9544adata_t _utAlldPca9544aData = {
1155
  /* driver   */ NULL,
1156
  /* timeout  */ MICROSECONDS_PER_SECOND,
1157
};
1158
aos_unittest_t moduleUtAlldPca9544a = {
1159
  /* name           */ "PCA9544A",
1160
  /* info           */ "I2C multiplexer",
1161
  /* test function  */ utAlldPca9544aFunc,
1162
  /* shell command  */ {
1163
    /* name     */ "unittest:I2CMultiplexer",
1164
    /* callback */ _utShellCmdCb_AlldPca5944a,
1165
    /* next     */ NULL,
1166
  },
1167
  /* data           */ &_utAlldPca9544aData,
1168
};
1169

    
1170
/*
1171
 * VCNL4020 (proximity sensor)
1172
 */
1173
static void _utAlldVcnl4020_disableInterrupt(VCNL4020Driver* vcnl)
1174
{
1175
  uint8_t intstatus;
1176
  vcnl4020_lld_writereg(vcnl, VCNL4020_LLD_REGADDR_INTCTRL, 0, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1177
  vcnl4020_lld_readreg(vcnl, VCNL4020_LLD_REGADDR_INTSTATUS, &intstatus, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1178
  if (intstatus) {
1179
    vcnl4020_lld_writereg(vcnl, VCNL4020_LLD_REGADDR_INTSTATUS, intstatus, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1180
  }
1181
  return;
1182
}
1183
static int _utShellCmdCb_AlldVcnl4020(BaseSequentialStream* stream, int argc, char* argv[])
1184
{
1185
  enum {
1186
    UNKNOWN,
1187
    NNE, ENE, ESE, SSE, SSW,WSW,WNW, NNW,
1188
  } sensor = UNKNOWN;
1189
  // evaluate arguments
1190
  if (argc == 2) {
1191
    if (strcmp(argv[1], "-nne") == 0) {
1192
      sensor = NNE;
1193
    } else if (strcmp(argv[1], "-ene") == 0) {
1194
      sensor = ENE;
1195
    } else if (strcmp(argv[1], "-ese") == 0) {
1196
      sensor = ESE;
1197
    } else if (strcmp(argv[1], "-sse") == 0) {
1198
      sensor = SSE;
1199
    } else if (strcmp(argv[1], "-ssw") == 0) {
1200
      sensor = SSW;
1201
    } else if (strcmp(argv[1], "-wsw") == 0) {
1202
      sensor = WSW;
1203
    } else if (strcmp(argv[1], "-wnw") == 0) {
1204
      sensor = WNW;
1205
    } else if (strcmp(argv[1], "-nnw") == 0) {
1206
      sensor = NNW;
1207
    }
1208
  }
1209
  if (sensor != UNKNOWN) {
1210
    PCA9544ADriver* mux = NULL;
1211
    switch (sensor) {
1212
      case SSE:
1213
      case SSW:
1214
      case WSW:
1215
      case WNW:
1216
        mux = &moduleLldI2cMultiplexer1;
1217
        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld = &moduleLldProximity1;
1218
        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = MODULE_OS_IOEVENTFLAGS_IRINT2;
1219
        break;
1220
      case NNW:
1221
      case NNE:
1222
      case ENE:
1223
      case ESE:
1224
        mux = &moduleLldI2cMultiplexer2;
1225
        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld = &moduleLldProximity2;
1226
        ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = MODULE_OS_IOEVENTFLAGS_IRINT1;
1227
        break;
1228
      default:
1229
        break;
1230
    }
1231
    pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH0, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1232
    _utAlldVcnl4020_disableInterrupt(((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld);
1233
    pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH1, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1234
    _utAlldVcnl4020_disableInterrupt(((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld);
1235
    pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH2, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1236
    _utAlldVcnl4020_disableInterrupt(((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld);
1237
    pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1238
    _utAlldVcnl4020_disableInterrupt(((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld);
1239
    switch (sensor) {
1240
      case NNE:
1241
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH1, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1242
        aosUtRun(stream, &moduleUtAlldVcnl4020, "north-northeast sensor");
1243
        break;
1244
      case ENE:
1245
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1246
        aosUtRun(stream, &moduleUtAlldVcnl4020, "east-northeast sensor");
1247
        break;
1248
      case ESE:
1249
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH2, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1250
        aosUtRun(stream, &moduleUtAlldVcnl4020, "north-southeast sensor");
1251
        break;
1252
      case SSE:
1253
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH0, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1254
        aosUtRun(stream, &moduleUtAlldVcnl4020, "south-southeast sensor");
1255
        break;
1256
      case SSW:
1257
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH1, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1258
        aosUtRun(stream, &moduleUtAlldVcnl4020, "south-southwest sensor");
1259
        break;
1260
      case WSW:
1261
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH3, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1262
        aosUtRun(stream, &moduleUtAlldVcnl4020, "west-southwest sensor");
1263
        break;
1264
      case WNW:
1265
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH2, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1266
        aosUtRun(stream, &moduleUtAlldVcnl4020, "west-northwest sensor");
1267
        break;
1268
      case NNW:
1269
        pca9544a_lld_setchannel(mux, PCA9544A_LLD_CH0, ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->timeout);
1270
        aosUtRun(stream, &moduleUtAlldVcnl4020, "north-northwest sensor");
1271
        break;
1272
      default:
1273
        break;
1274
    }
1275
    ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->vcnld = NULL;
1276
    ((ut_vcnl4020data_t*)moduleUtAlldVcnl4020.data)->evtflags = 0;
1277
    return AOS_OK;
1278
  }
1279
  // print help
1280
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
1281
  chprintf(stream, "Options:\n");
1282
  chprintf(stream, "  -nne\n");
1283
  chprintf(stream, "    Test north-northeast sensor.\n");
1284
  chprintf(stream, "  -ene\n");
1285
  chprintf(stream, "    Test east-northeast sensor.\n");
1286
  chprintf(stream, "  -ese\n");
1287
  chprintf(stream, "    Test east-southeast sensor.\n");
1288
  chprintf(stream, "  -sse\n");
1289
  chprintf(stream, "    Test south-southeast sensor.\n");
1290
  chprintf(stream, "  -ssw\n");
1291
  chprintf(stream, "    Test south-southwest sensor.\n");
1292
  chprintf(stream, "  -wsw\n");
1293
  chprintf(stream, "    Test west-southwest sensor.\n");
1294
  chprintf(stream, "  -wnw\n");
1295
  chprintf(stream, "    Test west-northwest sensor.\n");
1296
  chprintf(stream, "  -nnw\n");
1297
  chprintf(stream, "    Test north-northwest sensor.\n");
1298
  return AOS_INVALID_ARGUMENTS;
1299
}
1300
static ut_vcnl4020data_t _utAlldVcnl4020Data = {
1301
  /* driver       */ NULL,
1302
  /* timeout      */ MICROSECONDS_PER_SECOND,
1303
  /* event source */ &aos.events.io,
1304
  /* event flags  */ 0,
1305
};
1306
aos_unittest_t moduleUtAlldVcnl4020 = {
1307
  /* name           */ "VCNL4020",
1308
  /* info           */ "proximity sensor",
1309
  /* test function  */ utAlldVcnl4020Func,
1310
  /* shell command  */ {
1311
    /* name     */ "unittest:Proximity",
1312
    /* callback */ _utShellCmdCb_AlldVcnl4020,
1313
    /* next     */ NULL,
1314
  },
1315
  /* data           */ &_utAlldVcnl4020Data,
1316
};
1317

    
1318
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */
1319

    
1320
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__)
1321

    
1322
/*
1323
 * PCAL6524 (GPIO extender)
1324
 */
1325
static int _utShellCmdCb_AlldPcal6524(BaseSequentialStream* stream, int argc, char* argv[])
1326
{
1327
  // evaluate arguments
1328
  if (argc == 2) {
1329
    if (strcmp(argv[1], "#1") == 0) {
1330
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender1;
1331
      aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #1");
1332
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL;
1333
      return AOS_OK;
1334
    }
1335
    else if (strcmp(argv[1], "#2") == 0) {
1336
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender2;
1337
      aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #2");
1338
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL;
1339
      return AOS_OK;
1340
    }
1341
  }
1342
  // print help
1343
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
1344
  chprintf(stream, "Options:\n");
1345
  chprintf(stream, "  #1\n");
1346
  chprintf(stream, "    Test the GPIO extender on the I2C bus #1.\n");
1347
  chprintf(stream, "  #2\n");
1348
  chprintf(stream, "    Test the GPIO extender on the I2C bus #2.\n");
1349
  return AOS_INVALID_ARGUMENTS;
1350
}
1351
static ut_pcal6524data_t _utAlldPcal6524Data = {
1352
  /* driver   */ NULL,
1353
  /* timeout  */ MICROSECONDS_PER_SECOND,
1354
};
1355
aos_unittest_t moduleUtAlldPcal6524 = {
1356
  /* name           */ "PCAL6524",
1357
  /* info           */ "GPIO extender",
1358
  /* test function  */ utAlldPcal6524Func,
1359
  /* shell command  */ {
1360
    /* name     */ "unittest:GPIOExtender",
1361
    /* callback */ _utShellCmdCb_AlldPcal6524,
1362
    /* next     */ NULL,
1363
  },
1364
  /* data           */ &_utAlldPcal6524Data,
1365
};
1366

    
1367
/*
1368
 * AT42QT1050 (touch sensor)
1369
 */
1370
static int _utShellCmdCb_AlldAt42qt1050(BaseSequentialStream* stream, int argc, char* argv[])
1371
{
1372
  (void)argc;
1373
  (void)argv;
1374
  aosUtRun(stream, &moduleUtAlldAt42qt1050, NULL);
1375
  return AOS_OK;
1376
}
1377
static ut_at42qt1050data_t _utAlldMpr121Data= {
1378
  /* AT42QT1050 driver  */ &moduleLldTouch,
1379
  /* timeout            */ MICROSECONDS_PER_SECOND,
1380
  /* event source       */ &aos.events.io,
1381
  /* event flags        */ MODULE_OS_IOEVENTFLAGS_TOUCHINT,
1382
};
1383
aos_unittest_t moduleUtAlldAt42qt1050 = {
1384
  /* name           */ "AT42QT1050",
1385
  /* info           */ "touch sensor",
1386
  /* test function  */ utAlldAt42qt1050Func,
1387
  /* shell command  */ {
1388
    /* name     */ "unittest:Touch",
1389
    /* callback */ _utShellCmdCb_AlldAt42qt1050,
1390
    /* next     */ NULL,
1391
  },
1392
  /* data           */ &_utAlldMpr121Data,
1393
};
1394

    
1395
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */
1396

    
1397
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__)
1398

    
1399
/*
1400
 * PCAL6524 (GPIO extender)
1401
 */
1402
static int _utShellCmdCb_AlldPcal6524(BaseSequentialStream* stream, int argc, char* argv[])
1403
{
1404
  // evaluate arguments
1405
  if (argc == 2) {
1406
    if (strcmp(argv[1], "#1") == 0) {
1407
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender1;
1408
      aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #1");
1409
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL;
1410
      return AOS_OK;
1411
    }
1412
    else if (strcmp(argv[1], "#2") == 0) {
1413
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender2;
1414
      aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #2");
1415
      ((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL;
1416
      return AOS_OK;
1417
    }
1418
  }
1419
  // print help
1420
  chprintf(stream, "Usage: %s OPTION\n", argv[0]);
1421
  chprintf(stream, "Options:\n");
1422
  chprintf(stream, "  #1\n");
1423
  chprintf(stream, "    Test the GPIO extender on the I2C bus #1.\n");
1424
  chprintf(stream, "  #2\n");
1425
  chprintf(stream, "    Test the GPIO extender on the I2C bus #2.\n");
1426
  return AOS_INVALID_ARGUMENTS;
1427
}
1428
static ut_pcal6524data_t _utAlldPcal6524Data = {
1429
  /* driver   */ NULL,
1430
  /* timeout  */ MICROSECONDS_PER_SECOND,
1431
};
1432
aos_unittest_t moduleUtAlldPcal6524 = {
1433
  /* name           */ "PCAL6524",
1434
  /* info           */ "GPIO extender",
1435
  /* test function  */ utAlldPcal6524Func,
1436
  /* shell command  */ {
1437
    /* name     */ "unittest:GPIOExtender",
1438
    /* callback */ _utShellCmdCb_AlldPcal6524,
1439
    /* next     */ NULL,
1440
  },
1441
  /* data           */ &_utAlldPcal6524Data,
1442
};
1443

    
1444
/*
1445
 * AT42QT1050 (touch sensor)
1446
 */
1447
static int _utShellCmdCb_AlldAt42qt1050(BaseSequentialStream* stream, int argc, char* argv[])
1448
{
1449
  (void)argc;
1450
  (void)argv;
1451
  aosUtRun(stream, &moduleUtAlldAt42qt1050, NULL);
1452
  return AOS_OK;
1453
}
1454
static ut_at42qt1050data_t _utAlldMpr121Data= {
1455
  /* AT42QT1050 driver  */ &moduleLldTouch,
1456
  /* timeout            */ MICROSECONDS_PER_SECOND,
1457
  /* event source       */ &aos.events.io,
1458
  /* event flags        */ MODULE_OS_IOEVENTFLAGS_TOUCHINT,
1459
};
1460
aos_unittest_t moduleUtAlldAt42qt1050 = {
1461
  /* name           */ "AT42QT1050",
1462
  /* info           */ "touch sensor",
1463
  /* test function  */ utAlldAt42qt1050Func,
1464
  /* shell command  */ {
1465
    /* name     */ "unittest:Touch",
1466
    /* callback */ _utShellCmdCb_AlldAt42qt1050,
1467
    /* next     */ NULL,
1468
  },
1469
  /* data           */ &_utAlldMpr121Data,
1470
};
1471

    
1472
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */
1473

    
1474
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
1475

    
1476
/** @} */
1477
/** @} */