Files
HBshuiwuConcentrator/shuangjia/poweroffon.c
2025-12-15 16:07:49 +08:00

138 lines
3.0 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//#include "stdafx.h"
#include "poweroffon.h"
#include "include.h"
void gprs_device_poweroff();
void gprs_device_poweron();
//pc7 ---> pa1
void gprs_device_init()
{
// return;
GPIO_InitTypeDef GPIO_InitStructure;
// RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | SPI_FLASH_GPIO_CLK | FRAM_SPI_SCK_GPIO_CLK | FRAM_SPI_MISO_GPIO_CLK | FRAM_SPI_MOSI_GPIO_CLK , ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |RCC_APB2Periph_GPIOB||RCC_APB2Periph_GPIOC , ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
// GPIO_SetBits(GPIOA, GPIO_Pin_1);
// GPIO_ReetBits(GPIOA, GPIO_Pin_1);
// GPIO_ResetBits(GPIOA, GPIO_Pin_1);
gprs_device_poweron();
}
void gprs_device_poweroff()
{
#if 0
printf("gprs 윗됴왠齡신 700봐취\r\n");
//GPIO_SetBits(GPIOA, GPIO_Pin_1);
GPIO_SetBits(GPIOC, GPIO_Pin_7);
vTaskDelay(700/portTICK_RATE_MS);
printf("gprs 윗멕왠齡신 50봐취\r\n");
//GPIO_ResetBits(GPIOA, GPIO_Pin_1);
GPIO_ResetBits(GPIOC, GPIO_Pin_7);
vTaskDelay(50/portTICK_RATE_MS);
#endif
printf("gprs 윗됴든都신뙤든1000봐취\r\n");
//든都신
GPIO_SetBits(GPIOB, GPIO_Pin_0);
vTaskDelay(1000/portTICK_RATE_MS);
}
void gprs_device_ctl_h()
{
//printf("윗멕왠齡신PWRKEY = 1\r\n\r\n");
//GPIO_SetBits(GPIOC, GPIO_Pin_7);
//vTaskDelay(10/portTICK_RATE_MS);
}
void gprs_device_poweron()
{
#if 0
printf("gprs 윗멕든都신,묩든\r\n");
//든都신
GPIO_ResetBits(GPIOB, GPIO_Pin_0);
vTaskDelay(1000/portTICK_RATE_MS);
printf("gprs 왠齡신윗멕 1000봐취\r\n");
//GPIO_SetBits(GPIOA, GPIO_Pin_1);
GPIO_SetBits(GPIOC, GPIO_Pin_7);
vTaskDelay(1000/portTICK_RATE_MS);
printf("gprs 윗됴왠齡신\r\n");
//왠齡신
//GPIO_ResetBits(GPIOA, GPIO_Pin_1);
GPIO_ResetBits(GPIOC, GPIO_Pin_7);
vTaskDelay(1000/portTICK_RATE_MS);
printf("gprs 된덤5취 랙箇AT츱즈\r\n");
vTaskDelay(5000/portTICK_RATE_MS);
#endif
printf("gprs 윗멕든都신,묩든\r\n");
//든都신
GPIO_ResetBits(GPIOB, GPIO_Pin_0);
vTaskDelay(1000/portTICK_RATE_MS);
printf("gprs 왠齡신윗됴 200봐취\r\n");
GPIO_ResetBits(GPIOC, GPIO_Pin_7);
vTaskDelay(200/portTICK_RATE_MS);
printf("gprs 왠齡신윗멕 100봐취\r\n");
GPIO_SetBits(GPIOC, GPIO_Pin_7);
vTaskDelay(100/portTICK_RATE_MS);
// STM_GPRS_PCTRL_ON();
// OSTimeDlyHMSM(0,0,0,200,OS_OPT_TIME_HMSM_NON_STRICT,&err);
// STM_GPRS_ONOFF_L();
// OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_HMSM_NON_STRICT,&err);
// STM_GPRS_ONOFF_H();
// OSTimeDlyHMSM(0,0,10,0,OS_OPT_TIME_HMSM_NON_STRICT,&err);
// dbug_printf(MSG_GPRS_INFO,"gprs_power_on finish\r\n");
}