Revision 4c72a54c modules/PowerManagement_1-1/module.h
modules/PowerManagement_1-1/module.h | ||
---|---|---|
429 | 429 |
} |
430 | 430 |
|
431 | 431 |
/** |
432 |
* @brief Unit test initialization hook.
|
|
432 |
* @brief Test initialization hook.
|
|
433 | 433 |
*/ |
434 | 434 |
#define MODULE_INIT_TESTS() { \ |
435 | 435 |
/* add unit-test shell commands */ \ |
436 |
aosShellAddCommand(&aos.shell, &moduleUtAdcVsys.shellcmd); \
|
|
437 |
aosShellAddCommand(&aos.shell, &moduleUtAlldAt24c01b.shellcmd); \
|
|
438 |
aosShellAddCommand(&aos.shell, &moduleUtAlldBq24103a.shellcmd); \
|
|
439 |
aosShellAddCommand(&aos.shell, &moduleUtAlldBq27500.shellcmd); \
|
|
440 |
aosShellAddCommand(&aos.shell, &moduleUtAlldBq27500Bq24103a.shellcmd); \
|
|
441 |
aosShellAddCommand(&aos.shell, &moduleUtAlldIna219.shellcmd); \
|
|
442 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPklcs1212e4001.shellcmd); \
|
|
443 |
aosShellAddCommand(&aos.shell, &moduleUtAlldLed.shellcmd); \
|
|
444 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTps62113.shellcmd); \
|
|
445 |
aosShellAddCommand(&aos.shell, &moduleUtAlldTps62113Ina219.shellcmd); \
|
|
436 |
aosShellAddCommand(&aos.shell, &moduleTestAdcShellCmd); \
|
|
437 |
aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \
|
|
438 |
aosShellAddCommand(&aos.shell, &moduleTestBq241xxShellCmd); \
|
|
439 |
aosShellAddCommand(&aos.shell, &moduleTestBq27500ShellCmd); \
|
|
440 |
aosShellAddCommand(&aos.shell, &moduleTestBq27500Bq241xxShellCmd); \
|
|
441 |
aosShellAddCommand(&aos.shell, &moduleTestIna219ShellCmd); \
|
|
442 |
aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd); \
|
|
443 |
aosShellAddCommand(&aos.shell, &moduleTestPkxxxexxxShellCmd); \
|
|
444 |
aosShellAddCommand(&aos.shell, &moduleTestTps6211xShellCmd); \
|
|
445 |
aosShellAddCommand(&aos.shell, &moduleTestTps6211xIna219ShellCmd); \
|
|
446 | 446 |
MODULE_INIT_TEST_SENSORRING(); \ |
447 |
aosShellAddCommand(&aos.shell, &moduleTestAllShellCmd); \ |
|
447 | 448 |
} |
448 | 449 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
449 | 450 |
#define MODULE_INIT_TEST_SENSORRING() { \ |
450 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPca9544a.shellcmd); \
|
|
451 |
aosShellAddCommand(&aos.shell, &moduleUtAlldMpr121.shellcmd); \
|
|
452 |
aosShellAddCommand(&aos.shell, &moduleUtAlldVcnl4020.shellcmd); \
|
|
451 |
aosShellAddCommand(&aos.shell, &moduleTestPca9544aShellCmd); \
|
|
452 |
aosShellAddCommand(&aos.shell, &moduleTestMpr121ShellCmd); \
|
|
453 |
aosShellAddCommand(&aos.shell, &moduleTestVcnl4020ShellCmd); \
|
|
453 | 454 |
} |
454 | 455 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
455 | 456 |
#define MODULE_INIT_TEST_SENSORRING() { \ |
456 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPcal6524.shellcmd); \
|
|
457 |
aosShellAddCommand(&aos.shell, &moduleUtAlldAt42qt1050.shellcmd); \
|
|
457 |
aosShellAddCommand(&aos.shell, &moduleTestPcal6524ShellCmd); \
|
|
458 |
aosShellAddCommand(&aos.shell, &moduleTestAt42qt1050ShellCmd); \
|
|
458 | 459 |
} |
459 | 460 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
460 | 461 |
#define MODULE_INIT_TEST_SENSORRING() { \ |
461 |
aosShellAddCommand(&aos.shell, &moduleUtAlldPcal6524.shellcmd); \
|
|
462 |
aosShellAddCommand(&aos.shell, &moduleUtAlldAt42qt1050.shellcmd); \
|
|
462 |
aosShellAddCommand(&aos.shell, &moduleTestPcal6524ShellCmd); \
|
|
463 |
aosShellAddCommand(&aos.shell, &moduleTestAt42qt1050ShellCmd); \
|
|
463 | 464 |
} |
464 | 465 |
#else /* (BOARD_SENSORRING == ?) */ |
465 | 466 |
#define MODULE_INIT_TEST_SENSORRING() {} |
... | ... | |
468 | 469 |
/** |
469 | 470 |
* @brief Periphery communication interfaces initialization hook. |
470 | 471 |
*/ |
471 |
#define MODULE_INIT_PERIPHERY_COMM() { \
|
|
472 |
MODULE_INIT_PERIPHERY_COMM_SENSORRING(); \
|
|
472 |
#define MODULE_INIT_PERIPHERY_IF() { \
|
|
473 |
MODULE_INIT_PERIPHERY_IF_SENSORRING(); \
|
|
473 | 474 |
/* serial driver */ \ |
474 | 475 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
475 | 476 |
/* I2C */ \ |
... | ... | |
492 | 493 |
pwmStart(&MODULE_HAL_PWM_BUZZER, &moduleHalPwmBuzzerConfig); \ |
493 | 494 |
} |
494 | 495 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
495 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() { \
|
|
496 |
#define MODULE_INIT_PERIPHERY_IF_SENSORRING() { \
|
|
496 | 497 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
497 | 498 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (VCNL4020_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? VCNL4020_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
498 | 499 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCA9544A_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCA9544A_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
... | ... | |
500 | 501 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (MPR121_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? MPR121_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
501 | 502 |
} |
502 | 503 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
503 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() { \
|
|
504 |
#define MODULE_INIT_PERIPHERY_IF_SENSORRING() { \
|
|
504 | 505 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
505 | 506 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
506 | 507 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (AT42QT1050_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? AT42QT1050_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
507 | 508 |
} |
508 | 509 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
509 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() { \
|
|
510 |
#define MODULE_INIT_PERIPHERY_IF_SENSORRING() { \
|
|
510 | 511 |
moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm18Pm33GaugeRearConfig.clock_speed; \ |
511 | 512 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (PCAL6524_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? PCAL6524_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
512 | 513 |
moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed = (AT42QT1050_LLD_I2C_MAXFREQUENCY < moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed) ? AT42QT1050_LLD_I2C_MAXFREQUENCY : moduleHalI2cSrPm42Pm50PmVddEepromGaugeFrontConfig.clock_speed; \ |
513 | 514 |
} |
514 | 515 |
#else /* (BOARD_SENSORRING == ?) */ |
515 |
#define MODULE_INIT_PERIPHERY_COMM_SENSORRING() {}
|
|
516 |
#define MODULE_INIT_PERIPHERY_IF_SENSORRING() {}
|
|
516 | 517 |
#endif /* (BOARD_SENSORRING == ?) */ |
517 | 518 |
|
518 | 519 |
/** |
519 | 520 |
* @brief Periphery communication interface deinitialization hook. |
520 | 521 |
*/ |
521 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
|
522 |
#define MODULE_SHUTDOWN_PERIPHERY_IF() { \
|
|
522 | 523 |
/* PWM */ \ |
523 | 524 |
pwmStop(&MODULE_HAL_PWM_BUZZER); \ |
524 | 525 |
/* ADC */ \ |
... | ... | |
736 | 737 |
|
737 | 738 |
/*===========================================================================*/ |
738 | 739 |
/** |
739 |
* @name Unit tests (UT)
|
|
740 |
* @name Tests
|
|
740 | 741 |
* @{ |
741 | 742 |
*/ |
742 | 743 |
/*===========================================================================*/ |
743 | 744 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
744 |
#include <ut_lld_adc.h> |
|
745 |
#include <ut_alld_AT24C01B_v1.h> |
|
746 |
#include <ut_alld_bq241xx_v1.h> |
|
747 |
#include <ut_alld_bq27500_v1.h> |
|
748 |
#include <ut_alld_bq27500_v1_bq241xx_v1.h> |
|
749 |
#include <ut_alld_INA219_v1.h> |
|
750 |
#include <ut_alld_LED_v1.h> |
|
751 |
#include <ut_alld_PKxxxExxx_v1.h> |
|
752 |
#include <ut_alld_TPS6211x_v1.h> |
|
753 |
#include <ut_alld_TPS6211x_v1_INA219_v1.h> |
|
754 | 745 |
|
755 | 746 |
/** |
756 |
* @brief ADC unit test object.
|
|
747 |
* @brief ADC test command.
|
|
757 | 748 |
*/ |
758 |
extern aos_unittest_t moduleUtAdcVsys;
|
|
749 |
extern aos_shellcommand_t moduleTestAdcShellCmd;
|
|
759 | 750 |
|
760 | 751 |
/** |
761 |
* @brief AT24C01BN-SH-B (EEPROM) unit test object.
|
|
752 |
* @brief AT24C01BN-SH-B (EEPROM) test command.
|
|
762 | 753 |
*/ |
763 |
extern aos_unittest_t moduleUtAlldAt24c01b;
|
|
754 |
extern aos_shellcommand_t moduleTestAt24c01bShellCmd;
|
|
764 | 755 |
|
765 | 756 |
/** |
766 |
* @brief BQ24103A (battery charger) unit test object.
|
|
757 |
* @brief bq24103a (battery charger) test command.
|
|
767 | 758 |
*/ |
768 |
extern aos_unittest_t moduleUtAlldBq24103a;
|
|
759 |
extern aos_shellcommand_t moduleTestBq241xxShellCmd;
|
|
769 | 760 |
|
770 | 761 |
/** |
771 |
* @brief BQ27500 (fuel gauge) unit test object.
|
|
762 |
* @brief bq27500 (fuel gauge) test command.
|
|
772 | 763 |
*/ |
773 |
extern aos_unittest_t moduleUtAlldBq27500;
|
|
764 |
extern aos_shellcommand_t moduleTestBq27500ShellCmd;
|
|
774 | 765 |
|
775 | 766 |
/** |
776 |
* @brief BQ27500 (fuela gauge) in combination with BQ24103A (battery charger) unit test object.
|
|
767 |
* @brief bq27500 (fuel gauge) in combination with bq24103a (battery charger) test command.
|
|
777 | 768 |
*/ |
778 |
extern aos_unittest_t moduleUtAlldBq27500Bq24103a;
|
|
769 |
extern aos_shellcommand_t moduleTestBq27500Bq241xxShellCmd;
|
|
779 | 770 |
|
780 | 771 |
/** |
781 |
* @brief INA219 (power monitor) unit test object.
|
|
772 |
* @brief INA219 (power monitor) test command.
|
|
782 | 773 |
*/ |
783 |
extern aos_unittest_t moduleUtAlldIna219;
|
|
774 |
extern aos_shellcommand_t moduleTestIna219ShellCmd;
|
|
784 | 775 |
|
785 | 776 |
/** |
786 |
* @brief Status LED unit test object.
|
|
777 |
* @brief Status LED test command.
|
|
787 | 778 |
*/ |
788 |
extern aos_unittest_t moduleUtAlldLed;
|
|
779 |
extern aos_shellcommand_t moduleTestLedShellCmd;
|
|
789 | 780 |
|
790 | 781 |
/** |
791 |
* @brief PKLCS1212E4001 (buzzer) unit test object.
|
|
782 |
* @brief PKLCS1212E4001 (buzzer) test command.
|
|
792 | 783 |
*/ |
793 |
extern aos_unittest_t moduleUtAlldPklcs1212e4001;
|
|
784 |
extern aos_shellcommand_t moduleTestPkxxxexxxShellCmd;
|
|
794 | 785 |
|
795 | 786 |
/** |
796 |
* @brief TPS62113 (step-down converter) unit test object.
|
|
787 |
* @brief TPS62113 (step-down converter) test command.
|
|
797 | 788 |
*/ |
798 |
extern aos_unittest_t moduleUtAlldTps62113;
|
|
789 |
extern aos_shellcommand_t moduleTestTps6211xShellCmd;
|
|
799 | 790 |
|
800 | 791 |
/** |
801 |
* @brief TPS62113 (step-sown converter) in combination with INA219 (power monitor) unit test object.
|
|
792 |
* @brief TPS62113 (step-sown converter) in combination with INA219 (power monitor) test command.
|
|
802 | 793 |
*/ |
803 |
extern aos_unittest_t moduleUtAlldTps62113Ina219;
|
|
794 |
extern aos_shellcommand_t moduleTestTps6211xIna219ShellCmd;
|
|
804 | 795 |
|
805 | 796 |
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__) |
806 | 797 |
|
807 |
#include <ut_alld_MPR121_v1.h> |
|
808 |
#include <ut_alld_PCA9544A_v1.h> |
|
809 |
#include <ut_alld_VCNL4020_v1.h> |
|
810 |
|
|
811 | 798 |
/** |
812 |
* @brief MPR121 (touch sensor) unit test object.
|
|
799 |
* @brief MPR121 (touch sensor) test command.
|
|
813 | 800 |
*/ |
814 |
extern aos_unittest_t moduleUtAlldMpr121;
|
|
801 |
extern aos_shellcommand_t moduleTestMpr121ShellCmd;
|
|
815 | 802 |
|
816 | 803 |
/** |
817 |
* @brief PCA9544A (I2C multiplexer) unit test object.
|
|
804 |
* @brief PCA9544A (I2C multiplexer) test command.
|
|
818 | 805 |
*/ |
819 |
extern aos_unittest_t moduleUtAlldPca9544a;
|
|
806 |
extern aos_shellcommand_t moduleTestPca9544aShellCmd;
|
|
820 | 807 |
|
821 | 808 |
/** |
822 |
* @brief VCNL4020 (proximity sensor) unit test object.
|
|
809 |
* @brief VCNL4020 (proximity sensor) test command.
|
|
823 | 810 |
*/ |
824 |
extern aos_unittest_t moduleUtAlldVcnl4020;
|
|
811 |
extern aos_shellcommand_t moduleTestVcnl4020ShellCmd;
|
|
825 | 812 |
|
826 | 813 |
#endif /* (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) */ |
827 | 814 |
|
828 | 815 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
829 | 816 |
|
830 |
#include <ut_alld_PCAL6524_v1.h> |
|
831 |
#include <ut_alld_AT42QT1050_v1.h> |
|
832 |
|
|
833 | 817 |
/** |
834 |
* @brief PCAL6524 (GPIO extender) unit test object.
|
|
818 |
* @brief PCAL6524 (GPIO extender) test command.
|
|
835 | 819 |
*/ |
836 |
extern aos_unittest_t moduleUtAlldPcal6524;
|
|
820 |
extern aos_shellcommand_t moduleTestPcal6524ShellCmd;
|
|
837 | 821 |
|
838 | 822 |
/** |
839 |
* @brief AT42QT1050 (touch sensor) unit test object.
|
|
823 |
* @brief AT42QT1050 (touch sensor) test command.
|
|
840 | 824 |
*/ |
841 |
extern aos_unittest_t moduleUtAlldAt42qt1050;
|
|
825 |
extern aos_shellcommand_t moduleTestAt42qt1050ShellCmd;
|
|
842 | 826 |
|
843 | 827 |
#endif /* (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) */ |
844 | 828 |
|
845 | 829 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
846 | 830 |
|
847 |
#include <ut_alld_PCAL6524_v1.h> |
|
848 |
#include <ut_alld_AT42QT1050_v1.h> |
|
849 |
|
|
850 | 831 |
/** |
851 |
* @brief PCAL6524 (GPIO extender) unit test object.
|
|
832 |
* @brief PCAL6524 (GPIO extender) test command.
|
|
852 | 833 |
*/ |
853 |
extern aos_unittest_t moduleUtAlldPcal6524;
|
|
834 |
extern aos_shellcommand_t moduleTestPcal6524ShellCmd;
|
|
854 | 835 |
|
855 | 836 |
/** |
856 |
* @brief AT42QT1050 (touch sensor) unit test object.
|
|
837 |
* @brief AT42QT1050 (touch sensor) test command.
|
|
857 | 838 |
*/ |
858 |
extern aos_unittest_t moduleUtAlldAt42qt1050;
|
|
839 |
extern aos_shellcommand_t moduleTestAt42qt1050ShellCmd;
|
|
859 | 840 |
|
860 | 841 |
#endif /* (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) */ |
861 | 842 |
|
843 |
/** |
|
844 |
* @brief Entire module test command. |
|
845 |
*/ |
|
846 |
extern aos_shellcommand_t moduleTestAllShellCmd; |
|
847 |
|
|
862 | 848 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
863 | 849 |
|
864 | 850 |
/** @} */ |
Also available in: Unified diff