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