Revision 8be006e0
modules/DiWheelDrive_1-1/module.c | ||
---|---|---|
438 | 438 |
#include <string.h> |
439 | 439 |
#include <chprintf.h> |
440 | 440 |
|
441 |
/* A3906 (motor driver) */ |
|
441 |
/* |
|
442 |
* A3906 (motor driver) |
|
443 |
*/ |
|
442 | 444 |
static int _utShellCmdCb_AlldA3906(BaseSequentialStream* stream, int argc, char* argv[]) |
443 | 445 |
{ |
444 | 446 |
(void)argc; |
... | ... | |
480 | 482 |
/* data */ &_utA3906Data, |
481 | 483 |
}; |
482 | 484 |
|
483 |
/* AT24C01BN (EEPROM) */ |
|
485 |
/* |
|
486 |
* AT24C01BN (EEPROM) |
|
487 |
*/ |
|
484 | 488 |
static int _utShellCmdCb_AlldAt24c01bn(BaseSequentialStream* stream, int argc, char* argv[]) |
485 | 489 |
{ |
486 | 490 |
(void)argc; |
... | ... | |
504 | 508 |
/* data */ &_utAt24c01bnData, |
505 | 509 |
}; |
506 | 510 |
|
507 |
/* HMC5883L (compass) */ |
|
511 |
/* |
|
512 |
* HMC5883L (compass) |
|
513 |
*/ |
|
508 | 514 |
static int _utShellCmdCb_AlldHmc5883l(BaseSequentialStream* stream, int argc, char* argv[]) |
509 | 515 |
{ |
510 | 516 |
(void)argc; |
... | ... | |
530 | 536 |
/* data */ &_utHmc5883lData, |
531 | 537 |
}; |
532 | 538 |
|
533 |
/* INA219 (power monitor) */ |
|
539 |
/* |
|
540 |
* INA219 (power monitor) |
|
541 |
*/ |
|
534 | 542 |
static int _utShellCmdCb_AlldIna219(BaseSequentialStream* stream, int argc, char* argv[]) |
535 | 543 |
{ |
536 | 544 |
(void)argc; |
... | ... | |
556 | 564 |
/* data */ &_utIna219Data, |
557 | 565 |
}; |
558 | 566 |
|
559 |
/* L3G4200D (gyroscope) */ |
|
567 |
/* |
|
568 |
* L3G4200D (gyroscope) |
|
569 |
*/ |
|
560 | 570 |
static int _utShellCmdCb_AlldL3g4200d(BaseSequentialStream* stream, int argc, char* argv[]) |
561 | 571 |
{ |
562 | 572 |
(void)argc; |
... | ... | |
584 | 594 |
/* data */ &_utL3g4200dData, |
585 | 595 |
}; |
586 | 596 |
|
587 |
/* Status LED */ |
|
597 |
/* |
|
598 |
* Status LED |
|
599 |
*/ |
|
588 | 600 |
static int _utShellCmdCb_AlldLed(BaseSequentialStream* stream, int argc, char* argv[]) |
589 | 601 |
{ |
590 | 602 |
(void)argc; |
... | ... | |
604 | 616 |
/* data */ &moduleLldStatusLed, |
605 | 617 |
}; |
606 | 618 |
|
607 |
/* LIS331DLH (accelerometer) */ |
|
619 |
/* |
|
620 |
* LIS331DLH (accelerometer) |
|
621 |
*/ |
|
608 | 622 |
static int _utShellCmdCb_AlldLis331dlh(BaseSequentialStream* stream, int argc, char* argv[]) |
609 | 623 |
{ |
610 | 624 |
(void)argc; |
... | ... | |
632 | 646 |
/* data */ &_utLis331dlhData, |
633 | 647 |
}; |
634 | 648 |
|
635 |
/* LTC4412 (power path controller) */ |
|
649 |
/* |
|
650 |
* LTC4412 (power path controller) |
|
651 |
*/ |
|
636 | 652 |
static int _utShellCmdCb_AlldLtc4412(BaseSequentialStream* stream, int argc, char* argv[]) |
637 | 653 |
{ |
638 | 654 |
(void)argc; |
... | ... | |
652 | 668 |
/* data */ &moduleLldPowerPathController, |
653 | 669 |
}; |
654 | 670 |
|
655 |
/* PCA9544A (I2C multiplexer) */ |
|
671 |
/* |
|
672 |
* PCA9544A (I2C multiplexer) |
|
673 |
*/ |
|
656 | 674 |
static int _utShellCmdCb_AlldPca9544a(BaseSequentialStream* stream, int argc, char* argv[]) |
657 | 675 |
{ |
658 | 676 |
(void)argc; |
... | ... | |
676 | 694 |
/* data */ &_utPca9544aData, |
677 | 695 |
}; |
678 | 696 |
|
679 |
/* TPS62113 (step-down converter) */ |
|
697 |
/* |
|
698 |
* TPS62113 (step-down converter) |
|
699 |
*/ |
|
680 | 700 |
static int _utShellCmdCb_AlldTps62113(BaseSequentialStream* stream, int argc, char* argv[]) |
681 | 701 |
{ |
682 | 702 |
(void)argc; |
... | ... | |
696 | 716 |
/* data */ &moduleLldStepDownConverterVdrive, |
697 | 717 |
}; |
698 | 718 |
|
699 |
/* VCNL4020 (proximity sensor) */ |
|
719 |
/* |
|
720 |
* VCNL4020 (proximity sensor) |
|
721 |
*/ |
|
700 | 722 |
static void _utAlldVcnl4020_disableInterrupt(VCNL4020Driver* vcnl) |
701 | 723 |
{ |
702 | 724 |
uint8_t intstatus; |
modules/LightRing_1-0/module.c | ||
---|---|---|
280 | 280 |
/*===========================================================================*/ |
281 | 281 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
282 | 282 |
|
283 |
/* EEPROM (AT24C01BN) */ |
|
283 |
/* |
|
284 |
* EEPROM (AT24C01BN) |
|
285 |
*/ |
|
284 | 286 |
static int _utShellCmdCb_AlldAt24c01bn(BaseSequentialStream* stream, int argc, char* argv[]) |
285 | 287 |
{ |
286 | 288 |
(void)argc; |
... | ... | |
304 | 306 |
/* data */ &_utAt24c01bnData, |
305 | 307 |
}; |
306 | 308 |
|
307 |
/* LED PWM driver (TLD5947) */ |
|
309 |
/* |
|
310 |
* LED PWM driver (TLD5947) |
|
311 |
*/ |
|
308 | 312 |
static int _utShellCmdCb_Tlc5947(BaseSequentialStream* stream, int argc, char* argv[]) |
309 | 313 |
{ |
310 | 314 |
(void)argc; |
... | ... | |
324 | 328 |
/* data */ &moduleLldLedPwm, |
325 | 329 |
}; |
326 | 330 |
|
327 |
/* power switch (Laser) */ |
|
331 |
/* |
|
332 |
* power switch (Laser) |
|
333 |
*/ |
|
328 | 334 |
static int _utShellCmdCb_Tps2051bdbv(BaseSequentialStream* stream, int argc, char* argv[]) |
329 | 335 |
{ |
330 | 336 |
(void)argc; |
modules/PowerManagement_1-1/alldconf.h | ||
---|---|---|
43 | 43 |
*/ |
44 | 44 |
#define AMIROLLD_CFG_TIME_SIZE 32 |
45 | 45 |
|
46 |
// required to differentiate between various sensor rings |
|
47 |
#include <board.h> |
|
48 |
|
|
46 | 49 |
/** |
47 | 50 |
* @brief Enable flag for the AT24C01BN-SH-B EEPROM. |
48 | 51 |
*/ |
... | ... | |
69 | 72 |
#define AMIROLLD_CFG_USE_LED |
70 | 73 |
|
71 | 74 |
/** |
72 |
* @brief Enable flag for the MPR121 touch sensor. |
|
73 |
*/ |
|
74 |
#define AMIROLLD_CFG_USE_MPR121 |
|
75 |
|
|
76 |
/** |
|
77 |
* @brief Enable flag for the PCA9544A I2C multiplexer. |
|
78 |
*/ |
|
79 |
#define AMIROLLD_CFG_USE_PCA9544A |
|
80 |
|
|
81 |
/** |
|
82 | 75 |
* @brief Enable flag for the PKLCS1212E4001 buzzer. |
83 | 76 |
*/ |
84 | 77 |
#define AMIROLLD_CFG_USE_PKLCS1212E4001 |
... | ... | |
93 | 86 |
*/ |
94 | 87 |
#define AMIROLLD_CFG_USE_TPS62113 |
95 | 88 |
|
89 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
90 |
|
|
91 |
/** |
|
92 |
* @brief Enable flag for the MPR121 touch sensor. |
|
93 |
*/ |
|
94 |
#define AMIROLLD_CFG_USE_MPR121 |
|
95 |
|
|
96 |
/** |
|
97 |
* @brief Enable flag for the PCA9544A I2C multiplexer. |
|
98 |
*/ |
|
99 |
#define AMIROLLD_CFG_USE_PCA9544A |
|
100 |
|
|
96 | 101 |
/** |
97 | 102 |
* @brief Enable flag for the VCNL4020 proximity sensor. |
98 | 103 |
*/ |
99 | 104 |
#define AMIROLLD_CFG_USE_VCNL4020 |
100 | 105 |
|
106 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
|
107 |
|
|
108 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
109 |
// TODO |
|
110 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
|
111 |
|
|
112 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
113 |
// TODO |
|
114 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
|
115 |
|
|
101 | 116 |
#endif /* _ALLDCONF_H_ */ |
102 | 117 |
|
103 | 118 |
/** @} */ |
modules/PowerManagement_1-1/board.h | ||
---|---|---|
81 | 81 |
#define STM32F4xx_AF_EVENTOUT 15U |
82 | 82 |
|
83 | 83 |
/* |
84 |
* Identifiers for the several sensor rings, which can be attached to the PowerManagement v1.1 module. |
|
85 |
*/ |
|
86 |
#define BOARD_NOSENSORRING 0 |
|
87 |
#define BOARD_PROXIMITYSENSOR 1 |
|
88 |
#define BOARD_DISTANCESENSOR_VL53L0X 2 |
|
89 |
#define BOARD_DISTANCESENSOR_VL53L1X 3 |
|
90 |
|
|
91 |
/* |
|
92 |
* Configuration macro to define which type of sensor ring is attached. |
|
93 |
*/ |
|
94 |
#define BOARD_SENSORRING BOARD_PROXIMITYSENSOR |
|
95 |
|
|
96 |
/* |
|
84 | 97 |
* IO pins assignments. |
85 | 98 |
*/ |
86 | 99 |
#define GPIOA_WKUP 0U |
modules/PowerManagement_1-1/module.c | ||
---|---|---|
65 | 65 |
/* btr */ CAN_BTR_SJW(1) | CAN_BTR_TS2(3) | CAN_BTR_TS1(15) | CAN_BTR_BRP(1), |
66 | 66 |
}; |
67 | 67 |
|
68 |
I2CConfig moduleHalI2cProxPm18Pm33GaugeRearConfig = {
|
|
68 |
I2CConfig moduleHalI2cSrPm18Pm33GaugeRearConfig = {
|
|
69 | 69 |
/* I²C mode */ OPMODE_I2C, |
70 | 70 |
/* frequency */ 400000, // TODO: replace with some macro (-> ChibiOS/HAL) |
71 | 71 |
/* duty cycle */ FAST_DUTY_CYCLE_2, |
72 | 72 |
}; |
73 | 73 |
|
74 |
I2CConfig moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig = {
|
|
74 |
I2CConfig moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig = {
|
|
75 | 75 |
/* I²C mode */ OPMODE_I2C, |
76 | 76 |
/* frequency */ 400000, // TODO: replace with some macro (-> ChibiOS/HAL) |
77 | 77 |
/* duty cycle */ FAST_DUTY_CYCLE_2, |
... | ... | |
149 | 149 |
/* GPIO */ &_gpioIrInt1, |
150 | 150 |
/* meta */ { |
151 | 151 |
/* direction */ APAL_GPIO_DIRECTION_INPUT, |
152 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) |
|
152 | 153 |
/* active state */ (VCNL4020_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW, |
153 | 154 |
/* interrupt edge */ VCNL4020_LLD_INT_EDGE, |
155 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) |
|
156 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
157 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
158 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) |
|
159 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
160 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
161 |
#else |
|
162 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
163 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
164 |
#endif |
|
154 | 165 |
}, |
155 | 166 |
}; |
156 | 167 |
|
... | ... | |
341 | 352 |
/* GPIO */ &_gpioIrInt2, |
342 | 353 |
/* meta */ { |
343 | 354 |
/* direction */ APAL_GPIO_DIRECTION_INPUT, |
355 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) |
|
344 | 356 |
/* active state */ (VCNL4020_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW, |
345 | 357 |
/* interrupt edge */ VCNL4020_LLD_INT_EDGE, |
358 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) |
|
359 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
360 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
361 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) |
|
362 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
363 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
364 |
#else |
|
365 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
366 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
367 |
#endif |
|
346 | 368 |
}, |
347 | 369 |
}; |
348 | 370 |
|
... | ... | |
357 | 379 |
/* GPIO */ &_gpioTouchInt, |
358 | 380 |
/* meta */ { |
359 | 381 |
/* direction */ APAL_GPIO_DIRECTION_INPUT, |
382 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) |
|
360 | 383 |
/* active state */ (MPR121_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW, |
361 | 384 |
/* interrupt edge */ MPR121_LLD_INT_EDGE, |
385 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) |
|
386 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
387 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
388 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) |
|
389 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
390 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
391 |
#else |
|
392 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
393 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
|
394 |
#endif |
|
362 | 395 |
}, |
363 | 396 |
}; |
364 | 397 |
|
... | ... | |
538 | 571 |
/*===========================================================================*/ |
539 | 572 |
|
540 | 573 |
AT24C01BNDriver moduleLldEeprom = { |
541 |
/* I2C driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
574 |
/* I2C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
542 | 575 |
/* I2C address */ AT24C01BN_LLD_I2C_ADDR_FIXED, |
543 | 576 |
}; |
544 | 577 |
|
... | ... | |
553 | 586 |
}; |
554 | 587 |
|
555 | 588 |
BQ27500Driver moduleLldFuelGaugeFront = { |
556 |
/* I2C driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
589 |
/* I2C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
557 | 590 |
/* battery low GPIO */ &moduleGpioGaugeBatLow1, |
558 | 591 |
/* battery good GPIO */ &moduleGpioGaugeBatGd1, |
559 | 592 |
}; |
560 | 593 |
|
561 | 594 |
BQ27500Driver moduleLldFuelGaugeRear = { |
562 |
/* I2C driver */ &MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR,
|
|
595 |
/* I2C driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
|
|
563 | 596 |
/* battery low GPIO */ &moduleGpioGaugeBatLow2, |
564 | 597 |
/* battery good GPIO */ &moduleGpioGaugeBatGd2, |
565 | 598 |
}; |
566 | 599 |
|
567 | 600 |
INA219Driver moduleLldPowerMonitorVdd = { |
568 |
/* I2C Driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
601 |
/* I2C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
569 | 602 |
/* I²C address */ INA219_LLD_I2C_ADDR_A0 | INA219_LLD_I2C_ADDR_A1, |
570 | 603 |
/* current LSB (uA) */ 0x00u, |
571 | 604 |
/* configuration */ NULL, |
572 | 605 |
}; |
573 | 606 |
|
574 | 607 |
INA219Driver moduleLldPowerMonitorVio18 = { |
575 |
/* I2C Driver */ &MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR,
|
|
608 |
/* I2C Driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
|
|
576 | 609 |
/* I²C address */ INA219_LLD_I2C_ADDR_A1, |
577 | 610 |
/* current LSB (uA) */ 0x00u, |
578 | 611 |
/* configuration */ NULL, |
579 | 612 |
}; |
580 | 613 |
|
581 | 614 |
INA219Driver moduleLldPowerMonitorVio33 = { |
582 |
/* I2C Driver */ &MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR,
|
|
615 |
/* I2C Driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
|
|
583 | 616 |
/* I²C address */ INA219_LLD_I2C_ADDR_FIXED, |
584 | 617 |
/* current LSB (uA) */ 0x00u, |
585 | 618 |
/* configuration */ NULL, |
586 | 619 |
}; |
587 | 620 |
|
588 | 621 |
INA219Driver moduleLldPowerMonitorVsys42 = { |
589 |
/* I2C Driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
622 |
/* I2C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
590 | 623 |
/* I²C address */ INA219_LLD_I2C_ADDR_FIXED, |
591 | 624 |
/* current LSB (uA) */ 0x00u, |
592 | 625 |
/* configuration */ NULL, |
593 | 626 |
}; |
594 | 627 |
|
595 | 628 |
INA219Driver moduleLldPowerMonitorVio50 = { |
596 |
/* I2C Driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
629 |
/* I2C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
597 | 630 |
/* I²C address */ INA219_LLD_I2C_ADDR_A1, |
598 | 631 |
/* current LSB (uA) */ 0x00u, |
599 | 632 |
/* configuration */ NULL, |
... | ... | |
603 | 636 |
/* LED GPIO */ &moduleGpioLed, |
604 | 637 |
}; |
605 | 638 |
|
639 |
TPS62113Driver moduleLldStepDownConverter = { |
|
640 |
/* Power enable GPIO */ &moduleGpioPowerEn, |
|
641 |
}; |
|
642 |
|
|
643 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
644 |
|
|
606 | 645 |
MPR121Driver moduleLldTouch = { |
607 |
/* I²C Driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
646 |
/* I²C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
608 | 647 |
}; |
609 | 648 |
|
610 | 649 |
PCA9544ADriver moduleLldI2cMultiplexer1 = { |
611 |
/* I²C driver */ &MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR,
|
|
650 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
|
|
612 | 651 |
/* I²C address */ PCA9544A_LLD_I2C_ADDR_A0 | PCA9544A_LLD_I2C_ADDR_A1 | PCA9544A_LLD_I2C_ADDR_A2, |
613 | 652 |
}; |
614 | 653 |
|
615 | 654 |
PCA9544ADriver moduleLldI2cMultiplexer2 = { |
616 |
/* I²C driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
655 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
617 | 656 |
/* I²C address */ PCA9544A_LLD_I2C_ADDR_A0 | PCA9544A_LLD_I2C_ADDR_A1 | PCA9544A_LLD_I2C_ADDR_A2, |
618 | 657 |
}; |
619 | 658 |
|
620 |
TPS62113Driver moduleLldStepDownConverter = { |
|
621 |
/* Power enable GPIO */ &moduleGpioPowerEn, |
|
622 |
}; |
|
623 |
|
|
624 | 659 |
VCNL4020Driver moduleLldProximity1 = { |
625 |
/* I²C Driver */ &MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR,
|
|
660 |
/* I²C Driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR,
|
|
626 | 661 |
}; |
627 | 662 |
|
628 | 663 |
VCNL4020Driver moduleLldProximity2 = { |
629 |
/* I²C Driver */ &MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT,
|
|
664 |
/* I²C Driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT,
|
|
630 | 665 |
}; |
631 | 666 |
|
667 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
|
668 |
|
|
669 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
670 |
// TODO |
|
671 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
|
672 |
|
|
673 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
674 |
// TODO |
|
675 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
|
676 |
|
|
632 | 677 |
/** @} */ |
633 | 678 |
|
634 | 679 |
/*===========================================================================*/ |
... | ... | |
640 | 685 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
641 | 686 |
#include <string.h> |
642 | 687 |
|
643 |
/* ADC */ |
|
688 |
/* |
|
689 |
* ADC |
|
690 |
*/ |
|
644 | 691 |
static int _utShellCmdCb_Adc(BaseSequentialStream* stream, int argc, char* argv[]) |
645 | 692 |
{ |
646 | 693 |
(void)argc; |
... | ... | |
664 | 711 |
/* data */ &_utAdcVsysData, |
665 | 712 |
}; |
666 | 713 |
|
667 |
/* AT24C01BN-SH-B (EEPROM) */ |
|
714 |
/* |
|
715 |
* AT24C01BN-SH-B (EEPROM) |
|
716 |
*/ |
|
668 | 717 |
static int _utShellCmdCb_AlldAt24c01bn(BaseSequentialStream* stream, int argc, char* argv[]) |
669 | 718 |
{ |
670 | 719 |
(void)argc; |
... | ... | |
688 | 737 |
/* data */ &_utAlldAt24c01bnData, |
689 | 738 |
}; |
690 | 739 |
|
691 |
/* BQ24103A (battery charger) */ |
|
740 |
/* |
|
741 |
* BQ24103A (battery charger) |
|
742 |
*/ |
|
692 | 743 |
static int _utShellCmdCb_AlldBq24103a(BaseSequentialStream* stream, int argc, char* argv[]) |
693 | 744 |
{ |
694 | 745 |
// local variables |
... | ... | |
738 | 789 |
/* data */ NULL, |
739 | 790 |
}; |
740 | 791 |
|
741 |
/* BQ27500 (fuel gauge) */ |
|
792 |
/* |
|
793 |
* BQ27500 (fuel gauge) |
|
794 |
*/ |
|
742 | 795 |
static int _utShellCmdCb_AlldBq27500(BaseSequentialStream* stream, int argc, char* argv[]) |
743 | 796 |
{ |
744 | 797 |
// evaluate arguments |
... | ... | |
781 | 834 |
/* data */ &_utAlldBq27500Data, |
782 | 835 |
}; |
783 | 836 |
|
784 |
/* BQ27500 (fuel gauge) in combination with BQ24103A (battery charger) */ |
|
837 |
/* |
|
838 |
* BQ27500 (fuel gauge) in combination with BQ24103A (battery charger) |
|
839 |
*/ |
|
785 | 840 |
static int _utShellCmdCb_AlldBq27500Bq24103a(BaseSequentialStream* stream, int argc, char* argv[]) |
786 | 841 |
{ |
787 | 842 |
// evaluate arguments |
... | ... | |
829 | 884 |
/* data */ &_utAlldBq27500Bq24103aData, |
830 | 885 |
}; |
831 | 886 |
|
832 |
/* INA219 (power monitor) */ |
|
887 |
/* |
|
888 |
* INA219 (power monitor) |
|
889 |
*/ |
|
833 | 890 |
static int _utShellCmdCb_AlldIna219(BaseSequentialStream* stream, int argc, char* argv[]) |
834 | 891 |
{ |
835 | 892 |
// evaluate arguments |
... | ... | |
908 | 965 |
/* data */ &_utAlldIna219Data, |
909 | 966 |
}; |
910 | 967 |
|
911 |
/* Status LED */ |
|
968 |
/* |
|
969 |
* Status LED |
|
970 |
*/ |
|
912 | 971 |
static int _utShellCmdCb_AlldLed(BaseSequentialStream* stream, int argc, char* argv[]) |
913 | 972 |
{ |
914 | 973 |
(void)argc; |
... | ... | |
928 | 987 |
/* data */ &moduleLldStatusLed, |
929 | 988 |
}; |
930 | 989 |
|
931 |
/* MPR121 (touch sensor) */ |
|
932 |
static int _utShellCmdCb_AlldMpr121(BaseSequentialStream* stream, int argc, char* argv[]) |
|
933 |
{ |
|
934 |
(void)argc; |
|
935 |
(void)argv; |
|
936 |
aosUtRun(stream, &moduleUtAlldMpr121, NULL); |
|
937 |
return AOS_OK; |
|
938 |
} |
|
939 |
static ut_mpr121data_t _utAlldMpr121Data= { |
|
940 |
/* MPR121 driver */ &moduleLldTouch, |
|
941 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
942 |
/* event source */ &aos.events.io, |
|
943 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_TOUCHINT, |
|
944 |
}; |
|
945 |
aos_unittest_t moduleUtAlldMpr121 = { |
|
946 |
/* name */ "MPR121", |
|
947 |
/* info */ "touch sensor", |
|
948 |
/* test function */ utAlldMpr121Func, |
|
949 |
/* shell command */ { |
|
950 |
/* name */ "unittest:Touch", |
|
951 |
/* callback */ _utShellCmdCb_AlldMpr121, |
|
952 |
/* next */ NULL, |
|
953 |
}, |
|
954 |
/* data */ &_utAlldMpr121Data, |
|
955 |
}; |
|
956 |
|
|
957 |
/* PCA9544A (I2C multiplexer) */ |
|
958 |
static int _utShellCmdCb_AlldPca5944a(BaseSequentialStream* stream, int argc, char* argv[]) |
|
959 |
{ |
|
960 |
// evaluate arguments |
|
961 |
if (argc == 2) { |
|
962 |
if (strcmp(argv[1], "#1") == 0) { |
|
963 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = &moduleLldI2cMultiplexer1; |
|
964 |
aosUtRun(stream, &moduleUtAlldPca9544a, "I2C bus #1"); |
|
965 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = NULL; |
|
966 |
return AOS_OK; |
|
967 |
} |
|
968 |
else if (strcmp(argv[1], "#2") == 0) { |
|
969 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = &moduleLldI2cMultiplexer2; |
|
970 |
aosUtRun(stream, &moduleUtAlldPca9544a, "I2C bus #2"); |
|
971 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = NULL; |
|
972 |
return AOS_OK; |
|
973 |
} |
|
974 |
} |
|
975 |
// print help |
|
976 |
chprintf(stream, "Usage: %s OPTION\n", argv[0]); |
|
977 |
chprintf(stream, "Options:\n"); |
|
978 |
chprintf(stream, " #1\n"); |
|
979 |
chprintf(stream, " Test the multiplexer on the I2C bus #1.\n"); |
|
980 |
chprintf(stream, " #2\n"); |
|
981 |
chprintf(stream, " Test the multiplexer on the I2C bus #2.\n"); |
|
982 |
return AOS_INVALID_ARGUMENTS; |
|
983 |
} |
|
984 |
static ut_pca9544adata_t _utAlldPca9544aData = { |
|
985 |
/* driver */ NULL, |
|
986 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
987 |
}; |
|
988 |
aos_unittest_t moduleUtAlldPca9544a = { |
|
989 |
/* name */ "PCA9544A", |
|
990 |
/* info */ "I2C multiplexer", |
|
991 |
/* test function */ utAlldPca9544aFunc, |
|
992 |
/* shell command */ { |
|
993 |
/* name */ "unittest:I2CMultiplexer", |
|
994 |
/* callback */ _utShellCmdCb_AlldPca5944a, |
|
995 |
/* next */ NULL, |
|
996 |
}, |
|
997 |
/* data */ &_utAlldPca9544aData, |
|
998 |
}; |
|
999 |
|
|
1000 |
/* PKLCS1212E4001 (buzzer) */ |
|
990 |
/* |
|
991 |
* PKLCS1212E4001 (buzzer) |
|
992 |
*/ |
|
1001 | 993 |
static int _utShellCmdCb_AlldPklcs1212e4001(BaseSequentialStream* stream, int argc, char* argv[]) |
1002 | 994 |
{ |
1003 | 995 |
(void)argc; |
... | ... | |
1021 | 1013 |
/* data */ &_utAlldPklcs1212e4001Data, |
1022 | 1014 |
}; |
1023 | 1015 |
|
1024 |
/* TPS62113 (stop-down converter) */ |
|
1016 |
/* |
|
1017 |
* TPS62113 (stop-down converter) |
|
1018 |
*/ |
|
1025 | 1019 |
static int _utShellCmdCb_AlldTps62113(BaseSequentialStream* stream, int argc, char* argv[]) |
1026 | 1020 |
{ |
1027 | 1021 |
// Although there are four TPS62113 on the PCB, they all share the same input signal. |
... | ... | |
1043 | 1037 |
/* data */ &moduleLldStepDownConverter, |
1044 | 1038 |
}; |
1045 | 1039 |
|
1046 |
/* TPS62113 (step-donw converter) in combination with INA219 (power monitor) */ |
|
1040 |
/* |
|
1041 |
* TPS62113 (step-donw converter) in combination with INA219 (power monitor) |
|
1042 |
*/ |
|
1047 | 1043 |
static int _utShellCmdCb_AlldTps62113Ina219(BaseSequentialStream* stream, int argc, char* argv[]) |
1048 | 1044 |
{ |
1049 | 1045 |
(void)argc; |
... | ... | |
1068 | 1064 |
/* data */ &_utAlldTps62113Ina219Data, |
1069 | 1065 |
}; |
1070 | 1066 |
|
1071 |
/* VCNL4020 (proximity sensor) */ |
|
1067 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
1068 |
|
|
1069 |
/* |
|
1070 |
* MPR121 (touch sensor) |
|
1071 |
*/ |
|
1072 |
static int _utShellCmdCb_AlldMpr121(BaseSequentialStream* stream, int argc, char* argv[]) |
|
1073 |
{ |
|
1074 |
(void)argc; |
|
1075 |
(void)argv; |
|
1076 |
aosUtRun(stream, &moduleUtAlldMpr121, NULL); |
|
1077 |
return AOS_OK; |
|
1078 |
} |
|
1079 |
static ut_mpr121data_t _utAlldMpr121Data= { |
|
1080 |
/* MPR121 driver */ &moduleLldTouch, |
|
1081 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
1082 |
/* event source */ &aos.events.io, |
|
1083 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_TOUCHINT, |
|
1084 |
}; |
|
1085 |
aos_unittest_t moduleUtAlldMpr121 = { |
|
1086 |
/* name */ "MPR121", |
|
1087 |
/* info */ "touch sensor", |
|
1088 |
/* test function */ utAlldMpr121Func, |
|
1089 |
/* shell command */ { |
|
1090 |
/* name */ "unittest:Touch", |
|
1091 |
/* callback */ _utShellCmdCb_AlldMpr121, |
|
1092 |
/* next */ NULL, |
|
1093 |
}, |
|
1094 |
/* data */ &_utAlldMpr121Data, |
|
1095 |
}; |
|
1096 |
|
|
1097 |
/* |
|
1098 |
* PCA9544A (I2C multiplexer) |
|
1099 |
*/ |
|
1100 |
static int _utShellCmdCb_AlldPca5944a(BaseSequentialStream* stream, int argc, char* argv[]) |
|
1101 |
{ |
|
1102 |
// evaluate arguments |
|
1103 |
if (argc == 2) { |
|
1104 |
if (strcmp(argv[1], "#1") == 0) { |
|
1105 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = &moduleLldI2cMultiplexer1; |
|
1106 |
aosUtRun(stream, &moduleUtAlldPca9544a, "I2C bus #1"); |
|
1107 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = NULL; |
|
1108 |
return AOS_OK; |
|
1109 |
} |
|
1110 |
else if (strcmp(argv[1], "#2") == 0) { |
|
1111 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = &moduleLldI2cMultiplexer2; |
|
1112 |
aosUtRun(stream, &moduleUtAlldPca9544a, "I2C bus #2"); |
|
1113 |
((ut_pca9544adata_t*)moduleUtAlldPca9544a.data)->driver = NULL; |
|
1114 |
return AOS_OK; |
|
1115 |
} |
|
1116 |
} |
|
1117 |
// print help |
|
1118 |
chprintf(stream, "Usage: %s OPTION\n", argv[0]); |
|
1119 |
chprintf(stream, "Options:\n"); |
|
1120 |
chprintf(stream, " #1\n"); |
|
1121 |
chprintf(stream, " Test the multiplexer on the I2C bus #1.\n"); |
|
1122 |
chprintf(stream, " #2\n"); |
|
1123 |
chprintf(stream, " Test the multiplexer on the I2C bus #2.\n"); |
|
1124 |
return AOS_INVALID_ARGUMENTS; |
|
1125 |
} |
|
1126 |
static ut_pca9544adata_t _utAlldPca9544aData = { |
|
1127 |
/* driver */ NULL, |
|
1128 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
1129 |
}; |
|
1130 |
aos_unittest_t moduleUtAlldPca9544a = { |
|
1131 |
/* name */ "PCA9544A", |
|
1132 |
/* info */ "I2C multiplexer", |
|
1133 |
/* test function */ utAlldPca9544aFunc, |
|
1134 |
/* shell command */ { |
|
1135 |
/* name */ "unittest:I2CMultiplexer", |
|
1136 |
/* callback */ _utShellCmdCb_AlldPca5944a, |
|
1137 |
/* next */ NULL, |
|
1138 |
}, |
|
1139 |
/* data */ &_utAlldPca9544aData, |
|
1140 |
}; |
|
1141 |
|
|
1142 |
/* |
|
1143 |
* VCNL4020 (proximity sensor) |
|
1144 |
*/ |
|
1072 | 1145 |
static void _utAlldVcnl4020_disableInterrupt(VCNL4020Driver* vcnl) |
1073 | 1146 |
{ |
1074 | 1147 |
uint8_t intstatus; |
... | ... | |
1214 | 1287 |
/* data */ &_utAlldVcnl4020Data, |
1215 | 1288 |
}; |
1216 | 1289 |
|
1290 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
|
1291 |
|
|
1292 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
1293 |
// TODO |
|
1294 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
|
1295 |
|
|
1296 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
1297 |
// TODO |
|
1298 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
|
1299 |
|
|
1217 | 1300 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
1218 | 1301 |
|
1219 | 1302 |
/** @} */ |
modules/PowerManagement_1-1/module.h | ||
---|---|---|
92 | 92 |
extern CANConfig moduleHalCanConfig; |
93 | 93 |
|
94 | 94 |
/** |
95 |
* @brief I2C driver to access multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery). |
|
96 |
*/ |
|
97 |
#define MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR I2CD1 |
|
98 |
|
|
99 |
/** |
|
100 |
* @brief Configuration for the multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery) I2C driver. |
|
101 |
*/ |
|
102 |
extern I2CConfig moduleHalI2cProxPm18Pm33GaugeRearConfig; |
|
103 |
|
|
104 |
/** |
|
105 |
* @brief I2C driver to access multiplexer, proximity sensors 5 to 8, power monitors for VSYS4.2, VIO 5.0 and VDD, EEPROM, touch sensor, and fuel gauge (front battery). |
|
106 |
*/ |
|
107 |
#define MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT I2CD2 |
|
108 |
|
|
109 |
/** |
|
110 |
* @brief Configuration for the multiplexer, proximity sensors 1 to 4, power monitors for VIO1.8 and VIO 3.3, and fuel gauge (rear battery) I2C driver. |
|
111 |
*/ |
|
112 |
extern I2CConfig moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig; |
|
95 |
* @brief I2C driver to access the sensor ring, power monitors for VIO1.8 and VIO3.3, and fuel gauge (rear battery). |
|
96 |
* @details Depending on the attached sensor ring, the devices connected to this bus vary: |
|
97 |
* ProximitySensor: |
|
98 |
* - I2C multiplexer (PCA9544A) |
|
99 |
* - proximity sensors (VCNL4020) #1 - #4 |
|
100 |
* DistanceSensor (VL53L0X): |
|
101 |
* TODO |
|
102 |
* DistanceSensor (VL53L1X): |
|
103 |
* TODO |
|
104 |
*/ |
|
105 |
#define MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR I2CD1 |
|
106 |
|
|
107 |
/** |
|
108 |
* @brief Configuration for the sensor ring, power monitors for VIO1.8 and VIO3.3, and fuel gauge (rear battery) I2C driver. |
|
109 |
* @details Depending on the attached sensor ring, the devices connected to this bus vary: |
|
110 |
* ProximitySensor: |
|
111 |
* - I2C multiplexer (PCA9544A) |
|
112 |
* - proximity sensors (VCNL4020) #1 - #4 |
|
113 |
* DistanceSensor (VL53L0X): |
|
114 |
* TODO |
|
115 |
* DistanceSensor (VL53L1X): |
|
116 |
* TODO |
|
117 |
*/ |
|
118 |
extern I2CConfig moduleHalI2cSrPm18Pm33GaugeRearConfig; |
|
119 |
|
|
120 |
/** |
|
121 |
* @brief I2C driver to access the sensor ring, power monitors for VSYS4.2, VIO5.0 and VDD, EEPROM, and fuel gauge (front battery). |
|
122 |
* @details Depending on the attached sensor ring, the devices connected to this bus vary: |
|
123 |
* ProximitySensor: |
|
124 |
* - I2C multiplexer (PCA9544A) |
|
125 |
* - proximity sensors (VCNL4020) #1 - #4 |
|
126 |
* - touch sensor (MPR121) |
|
127 |
* DistanceSensor (VL53L0X): |
|
128 |
* TODO |
|
129 |
* DistanceSensor (VL53L1X): |
|
130 |
* TODO |
|
131 |
*/ |
|
132 |
#define MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT I2CD2 |
|
133 |
|
|
134 |
/** |
|
135 |
* @brief Configuration for the sensor ring, power monitors for VSYS4.2, VIO5.0 and VDD, EEPROM, and fuel gauge (front battery) I2C driver. |
|
136 |
* @details Depending on the attached sensor ring, the devices connected to this bus vary: |
|
137 |
* ProximitySensor: |
|
138 |
* - I2C multiplexer (PCA9544A) |
|
139 |
* - proximity sensors (VCNL4020) #1 - #4 |
|
140 |
* - touch sensor (MPR121) |
|
141 |
* DistanceSensor (VL53L0X): |
|
142 |
* TODO |
|
143 |
* DistanceSensor (VL53L1X): |
|
144 |
* TODO |
|
145 |
*/ |
|
146 |
extern I2CConfig moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig; |
|
113 | 147 |
|
114 | 148 |
/** |
115 | 149 |
* @brief PWM driver for the buzzer. |
... | ... | |
149 | 183 |
* @{ |
150 | 184 |
*/ |
151 | 185 |
/*===========================================================================*/ |
152 |
#include <amiro-lld.h>
|
|
186 |
#include <periphALtypes.h>
|
|
153 | 187 |
|
154 | 188 |
/** |
155 | 189 |
* @brief SYS_REG_EN output signal GPIO. |
... | ... | |
405 | 439 |
aosShellAddCommand(&aos.shell, &moduleUtAlldBq27500.shellcmd); \ |
406 | 440 |
aosShellAddCommand(&aos.shell, &moduleUtAlldBq27500Bq24103a.shellcmd); \ |
407 | 441 |
aosShellAddCommand(&aos.shell, &moduleUtAlldIna219.shellcmd); \ |
408 |
aosShellAddCommand(&aos.shell, &moduleUtAlldMpr121.shellcmd); \ |
|
409 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPca9544a.shellcmd); \ |
|
410 | 442 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPklcs1212e4001.shellcmd); \ |
411 | 443 |
aosShellAddCommand(&aos.shell, &moduleUtAlldLed.shellcmd); \ |
412 | 444 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTps62113.shellcmd); \ |
413 | 445 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTps62113Ina219.shellcmd); \ |
414 |
aosShellAddCommand(&aos.shell, &moduleUtAlldVcnl4020.shellcmd); \
|
|
446 |
MODULE_INIT_TEST_SENSORRING(); \
|
|
415 | 447 |
} |
448 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
449 |
#define MODULE_INIT_TEST_SENSORRING() { \ |
|
450 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPca9544a.shellcmd); \ |
|
451 |
aosShellAddCommand(&aos.shell, &moduleUtAlldMpr121.shellcmd); \ |
|
452 |
aosShellAddCommand(&aos.shell, &moduleUtAlldVcnl4020.shellcmd); \ |
|
453 |
} |
|
454 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
455 |
#define MODULE_INIT_TEST_SENSORRING() { \ |
|
456 |
/* TODO */ \ |
|
457 |
} |
|
458 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
459 |
#define MODULE_INIT_TEST_SENSORRING() { \ |
|
460 |
/* TODO */ \ |
|
461 |
} |
|
462 |
#else |
|
463 |
#define MODULE_INIT_TEST_SENSORRING() {} |
|
464 |
#endif |
|
416 | 465 |
|
417 | 466 |
/** |
418 | 467 |
* @brief Periphery communication interfaces initialization hook. |
419 | 468 |
*/ |
420 | 469 |
#define MODULE_INIT_PERIPHERY_COMM() { \ |
470 |
MODULE_INIT_PERIPHERY_COMM_SENSORRING(); \ |
|
421 | 471 |
/* serial driver */ \ |
422 | 472 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
423 | 473 |
/* I2C */ \ |
424 |
moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed; \ |
|
425 |
moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed; \ |
|
426 |
moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed; \ |
|
427 |
moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed = (BQ27500_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed) ? BQ27500_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed; \ |
|
428 |
moduleHalI2cProxPm18Pm33GaugeRearConfig.duty_cycle = (moduleHalI2cProxPm18Pm33GaugeRearConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \ |
|
429 |
i2cStart(&MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR, &moduleHalI2cProxPm18Pm33GaugeRearConfig); \ |
|
430 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed; \ |
|
431 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed; \ |
|
432 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed; \ |
|
433 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed = (AT24C01BN_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed) ? AT24C01BN_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed; \ |
|
434 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed = (MPR121_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed) ? MPR121_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed; \ |
|
435 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed = (BQ27500_LLD_I2C_MAXFREQUENCY < moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed) ? BQ27500_LLD_I2C_MAXFREQUENCY : moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed; \ |
|
436 |
moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.duty_cycle = (moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \ |
|
437 |
i2cStart(&MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT, &moduleHalI2cProxPm42Pm50PmVddEepromTouchGaugeFrontConfig); \ |
|
474 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
|
475 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (BQ27500_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? BQ27500_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
|
476 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.duty_cycle = (moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \ |
|
477 |
i2cStart(&MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR, &moduleHalI2cSrPm18Pm33GaugeRearConfig); \ |
|
478 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (INA219_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? INA219_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
|
479 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (AT24C01BN_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? AT24C01BN_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
|
480 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (BQ27500_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? BQ27500_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
|
481 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.duty_cycle = (moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed <= 100000) ? STD_DUTY_CYCLE : FAST_DUTY_CYCLE_2; \ |
|
482 |
i2cStart(&MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT, &moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig); \ |
|
438 | 483 |
/* ADC */ \ |
439 | 484 |
adcStart(&MODULE_HAL_ADC_VSYS, NULL); \ |
440 | 485 |
/* PWM */ \ |
... | ... | |
444 | 489 |
moduleHalPwmBuzzerConfig.period = moduleHalPwmBuzzerConfig.frequency / PKLCS1212E4001_LLD_FREQUENCY_SPEC; \ |
445 | 490 |
pwmStart(&MODULE_HAL_PWM_BUZZER, &moduleHalPwmBuzzerConfig); \ |
446 | 491 |
} |
492 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
493 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() { \ |
|
494 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
|
495 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
|
496 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
|
497 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
|
498 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (MPR121_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? MPR121_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
|
499 |
} |
|
500 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
501 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() { \ |
|
502 |
/* TODO */ \ |
|
503 |
} |
|
504 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
505 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() { \ |
|
506 |
/* TODO */ \ |
|
507 |
} |
|
508 |
#else |
|
509 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() {} |
|
510 |
#endif |
|
447 | 511 |
|
448 | 512 |
/** |
449 | 513 |
* @brief Periphery communication interface deinitialization hook. |
... | ... | |
454 | 518 |
/* ADC */ \ |
455 | 519 |
adcStop(&MODULE_HAL_ADC_VSYS); \ |
456 | 520 |
/* I2C */ \ |
457 |
i2cStop(&MODULE_HAL_I2C_PROX_PM18_PM33_GAUGEREAR); \
|
|
458 |
i2cStop(&MODULE_HAL_I2C_PROX_PM42_PM50_PMVDD_EEPROM_TOUCH_GAUGEFRONT); \
|
|
521 |
i2cStop(&MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR); \
|
|
522 |
i2cStop(&MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT); \
|
|
459 | 523 |
/* don't stop the serial driver so messages can still be printed */ \ |
460 | 524 |
} |
461 | 525 |
|
... | ... | |
521 | 585 |
#include <alld_bq27500.h> |
522 | 586 |
#include <alld_ina219.h> |
523 | 587 |
#include <alld_led.h> |
524 |
#include <alld_mpr121.h> |
|
525 |
#include <alld_pca9544a.h> |
|
526 | 588 |
#include <alld_pklcs1212e4001.h> |
527 | 589 |
#include <alld_tps62113.h> |
528 |
#include <alld_vcnl4020.h> |
|
529 | 590 |
|
530 | 591 |
/** |
531 | 592 |
* @brief EEPROM driver. |
... | ... | |
583 | 644 |
extern LEDDriver moduleLldStatusLed; |
584 | 645 |
|
585 | 646 |
/** |
647 |
* @brief Step down converter driver. |
|
648 |
* @note Although there multiple TPS62113, those are completely identical from driver few (share the same signals). |
|
649 |
*/ |
|
650 |
extern TPS62113Driver moduleLldStepDownConverter; |
|
651 |
|
|
652 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
653 |
|
|
654 |
#include <alld_mpr121.h> |
|
655 |
#include <alld_pca9544a.h> |
|
656 |
#include <alld_vcnl4020.h> |
|
657 |
|
|
658 |
/** |
|
586 | 659 |
* @brief Touch sensor driver. |
587 | 660 |
*/ |
588 | 661 |
extern MPR121Driver moduleLldTouch; |
589 | 662 |
|
590 | 663 |
/** |
591 |
* @brief I2C multiplexer (I2C 1) driver. |
|
664 |
* @brief I2C multiplexer (I2C #1) driver.
|
|
592 | 665 |
*/ |
593 | 666 |
extern PCA9544ADriver moduleLldI2cMultiplexer1; |
594 | 667 |
|
595 | 668 |
/** |
596 |
* @brief I2C multiplexer (I2C 2) driver. |
|
669 |
* @brief I2C multiplexer (I2C #2) driver.
|
|
597 | 670 |
*/ |
598 | 671 |
extern PCA9544ADriver moduleLldI2cMultiplexer2; |
599 | 672 |
|
600 | 673 |
/** |
601 |
* @brief Step down converter driver. |
|
602 |
* @note Although there multiple TPS62113, those are completely identical from driver few (share the same signals). |
|
603 |
*/ |
|
604 |
extern TPS62113Driver moduleLldStepDownConverter; |
|
605 |
|
|
606 |
/** |
|
607 |
* @brief Proximity sensor (I2C 1) driver. |
|
674 |
* @brief Proximity sensor (I2C #1) driver. |
|
608 | 675 |
*/ |
609 | 676 |
extern VCNL4020Driver moduleLldProximity1; |
610 | 677 |
|
611 | 678 |
/** |
612 |
* @brief Proximity sensor (I2C 2) driver. |
|
679 |
* @brief Proximity sensor (I2C #2) driver.
|
|
613 | 680 |
*/ |
614 | 681 |
extern VCNL4020Driver moduleLldProximity2; |
615 | 682 |
|
683 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
|
684 |
|
|
685 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
686 |
// TODO |
|
687 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
|
688 |
|
|
689 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
690 |
// TODO |
|
691 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
|
692 |
|
|
616 | 693 |
/** @} */ |
617 | 694 |
|
618 | 695 |
/*===========================================================================*/ |
... | ... | |
629 | 706 |
#include <ut_alld_bq27500_bq24103a.h> |
630 | 707 |
#include <ut_alld_ina219.h> |
631 | 708 |
#include <ut_alld_led.h> |
632 |
#include <ut_alld_mpr121.h> |
|
633 |
#include <ut_alld_pca9544a.h> |
|
634 | 709 |
#include <ut_alld_pklcs1212e4001.h> |
635 | 710 |
#include <ut_alld_tps62113.h> |
636 | 711 |
#include <ut_alld_tps62113_ina219.h> |
637 |
#include <ut_alld_vcnl4020.h> |
|
638 | 712 |
|
639 | 713 |
/** |
640 | 714 |
* @brief ADC unit test object. |
... | ... | |
672 | 746 |
extern aos_unittest_t moduleUtAlldLed; |
673 | 747 |
|
674 | 748 |
/** |
675 |
* @brief MPR121 (touch sensor) unit test object. |
|
676 |
*/ |
|
677 |
extern aos_unittest_t moduleUtAlldMpr121; |
|
678 |
|
|
679 |
/** |
|
680 |
* @brief PCA9544A (I2C multiplexer) unit test object. |
|
681 |
*/ |
|
682 |
extern aos_unittest_t moduleUtAlldPca9544a; |
|
683 |
|
|
684 |
/** |
|
685 | 749 |
* @brief PKLCS1212E4001 (buzzer) unit test object. |
686 | 750 |
*/ |
687 | 751 |
extern aos_unittest_t moduleUtAlldPklcs1212e4001; |
... | ... | |
696 | 760 |
*/ |
697 | 761 |
extern aos_unittest_t moduleUtAlldTps62113Ina219; |
698 | 762 |
|
763 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
|
764 |
|
|
765 |
#include <ut_alld_mpr121.h> |
|
766 |
#include <ut_alld_pca9544a.h> |
|
767 |
#include <ut_alld_vcnl4020.h> |
|
768 |
|
|
769 |
/** |
|
770 |
* @brief MPR121 (touch sensor) unit test object. |
|
771 |
*/ |
|
772 |
extern aos_unittest_t moduleUtAlldMpr121; |
|
773 |
|
|
774 |
/** |
|
775 |
* @brief PCA9544A (I2C multiplexer) unit test object. |
|
776 |
*/ |
|
777 |
extern aos_unittest_t moduleUtAlldPca9544a; |
|
778 |
|
|
699 | 779 |
/** |
700 | 780 |
* @brief VCNL4020 (proximity sensor) unit test object. |
701 | 781 |
*/ |
702 | 782 |
extern aos_unittest_t moduleUtAlldVcnl4020; |
703 | 783 |
|
784 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
|
785 |
|
|
786 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
|
787 |
// TODO |
|
788 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
|
789 |
|
|
790 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
|
791 |
// TODO |
|
792 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
|
793 |
|
|
704 | 794 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
705 | 795 |
|
706 | 796 |
/** @} */ |
Also available in: Unified diff