123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #include "GPIO_SYS.h"
- #include "app_def.h"
- extern unsigned int LocalTime;
- int GPIO_SYS_init(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- //ANDROID_POWER_RccOpen();
- // ANDROID_RESET_RccOpen();
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC |RCC_APB2Periph_GPIOD,ENABLE); //时钟
- //ANDROID_V0L_RccOpen();
- //================================================
- // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- // GPIO_InitStructure.GPIO_Pin = ANDROID_POWER_LINE;
- // GPIO_Init(ANDROID_POWER_Port,&GPIO_InitStructure);
- // GPIO_SetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- //================================================
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_InitStructure.GPIO_Pin = ANDROID_RESET_LINE;
- GPIO_Init(ANDROID_RESET_Port,&GPIO_InitStructure);
- GPIO_SetBits(ANDROID_RESET_Port,ANDROID_RESET_LINE);
- SYS_Reset();
- //================================================
- // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- // GPIO_InitStructure.GPIO_Pin = ANDROID_V0L_LINE;
- // GPIO_Init(ANDROID_V0L_Port,&GPIO_InitStructure);
- // GPIO_SetBits(ANDROID_V0L_Port,ANDROID_V0L_LINE);
- // //================================================
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
- GPIO_Init(GPIOC,&GPIO_InitStructure);
- // Mcu_Reset(RESET) ;
- return 1;
- }
- int SYS_Reset(void) //复位高电平有效
- {
- unsigned int i=0;
-
- GPIO_ResetBits(ANDROID_RESET_Port,ANDROID_RESET_LINE);
- for(i=0;i<500000;i++)
- {
- WDG_Feed();
- }
- GPIO_SetBits(ANDROID_RESET_Port,ANDROID_RESET_LINE);
- return 1;
- }
- void Mcu_Reset(U08 flag)
- {
- if (flag) {
- GPIO_SetBits(GPIOC,GPIO_Pin_1);
- } else {
- GPIO_ResetBits(GPIOC,GPIO_Pin_1);
- }
- }
- //int SYS_SetUpdate(void)
- //{
- // unsigned int i=0;
- // unsigned int TempTimes=0;
- // //===========================================
- // GPIO_ResetBits(ANDROID_V0L_Port,ANDROID_V0L_LINE); //按下“音量+”键
- //
- // GPIO_ResetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE); //长按“Power”键
- // TempTimes=LocalTime+12000;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_SetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE); //松开“Power”键
- // //===========================================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_ResetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_SetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_ResetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_SetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_ResetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_SetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_ResetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- // GPIO_SetBits(ANDROID_POWER_Port,ANDROID_POWER_LINE);
- // //=============================
- // TempTimes=LocalTime+500;
- // while(TempTimes>LocalTime)
- // {
- // WDG_Feed();
- // }
- //
- // GPIO_SetBits(ANDROID_V0L_Port,ANDROID_V0L_LINE);
- // return 1;
- //}
|