123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- /********************************************************************************
- * File Name: PowerCtrl.c
- * Function Describe:
- * Relate Module:
- * Explain:
- * Writer:
- * Date: 2015.12.10
- *******************************************************************************/
- #define THIS_FILE_ID 17
-
- #include "includes.h"
- /*
- 电源控制初始化
- */
- void PowerInit(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB| RCC_APB2Periph_GPIOC,ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = SYS_POWER_EN_PIN; //
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; //GPIO_Mode_Out_PP
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- SYS_POWER_EN; //默认
- GPIO_Init(SYS_POWER_EN_PORT, &GPIO_InitStructure);//初始化GPIO
- SYS_POWER_EN; //默认
-
- GPIO_InitStructure.GPIO_Pin = TEST_POWER_EN_PIN; //测试板电源
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(TEST_POWER_EN_PORT, &GPIO_InitStructure);//初始化GPIO
- TEST_POWER_DIS; //默认
-
- GPIO_InitStructure.GPIO_Pin = GPS_POWER_EN_PIN; //
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GPS_POWER_EN_PORT, &GPIO_InitStructure);//初始化GPIO
- GPS_POWER_EN; //默认
-
- GPIO_InitStructure.GPIO_Pin = GSM_POWER_EN_PIN; //
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GSM_POWER_EN_PORT, &GPIO_InitStructure);//初始化GPIO
- GSM_POWER_DIS; //默认
-
- GPIO_InitStructure.GPIO_Pin = GSM_ONOFF_PIN; //
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GSM_ONOFF_PORT, &GPIO_InitStructure);//初始化GPIO
- GSM_POWER_DIS; //默认
-
- }
- /*
- 测试板电源重启,当发现测试版相关传感器死机或工作不正常时,可以重启电源
- */
- void TestBoardPowerRestart(void)
- {
- TEST_POWER_DIS;
- os_dly_wait(100);
- TEST_POWER_EN;
- }
- /*
- MCU和运动传感器电源重启
- */
- void SysPowerRestart(void)
- {
- SYS_POWER_DIS;
- os_dly_wait(50);
- SYS_POWER_EN;
- }
- /*
- GPS电源重启
- */
- void GpsPowerRestart(void)
- {
- GPS_POWER_DIS;
- os_dly_wait(100);
- GPS_POWER_EN;
-
- }
- /*******************************************************************************/
|