Files
SM-1000M/RTX5_20220316/Driver/pwr_ctrl/pwr_ctrl.c
2026-04-23 10:50:18 +08:00

58 lines
2.3 KiB
C

/*
*************************************************************
头文件
*************************************************************
*/
#include "pwr_ctrl.h" //包含需要的头文件
#include "delay.h" //包含需要的头文件
#include "pbdata.h"
/*
*********************************************************************************************************
* 函 数 名: PWR_CTRL_Init()
* 功能说明: 控制引脚初始化
* 输 入 :无
* 输 出 :无
*********************************************************************************************************
*/
void PWR_CTRL_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA|RCC_AHBPeriph_GPIOB|RCC_AHBPeriph_GPIOC, ENABLE); //使能PB端口时钟
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_5|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //推挽输出
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推免
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz; //IO口速度为400KHz
GPIO_Init(GPIOB, &GPIO_InitStructure); //根据设定参数初始化GPIOB.8,GPIOB.1
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_8|GPIO_Pin_11|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //推挽输出
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推免
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz; //IO口速度为400KHz
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //推挽输出
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推免
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz; //IO口速度为400KHz
GPIO_Init(GPIOC, &GPIO_InitStructure);
PWR_CTRLADC_L; //关闭ADC电源
PWR_CTRLL76C_L;//关闭L76C电源
PWR_CTRLBC25_L;//关闭BC25电源
PWR_CTRLTFWF_L;//关闭WIFI与TF卡电源
PWR_CTRL3V3_L;
PWR_CTRL5V_L;
PWR_CTRL485_L;
//到此,系统外设模块的电源均关断!
GPIO_ResetBits(GPIOB,GPIO_Pin_5);//SDI串口收发切换引脚
delay_ms(800);
}
/***************************** END OF FILE *********************************/