1234567891011121314151617181920212223242526272829 |
- #include "led.h"
- //////////////////////////////////////////////////////////////////////////////////
- //本程序只供内部使用,未经作者许可,不得用于其它任何用途
- // STM32F103开发板
- //LED驱动代码
- //创建日期:2017/5/25
- //版本:V1.0
- //版权所有,盗版必究。
- //Copyright(C) 济南鲁泰电气有限公司 2014-2024
- //All rights reserved
- //////////////////////////////////////////////////////////////////////////////////
- //初始化PB1为输出.并使能时钟
- //LED IO初始化
- void LED_Init(void)
- {
- GPIO_InitTypeDef GPIO_Initure;
- __HAL_RCC_GPIOC_CLK_ENABLE(); //开启GPIOC时钟
-
- GPIO_Initure.Pin=GPIO_PIN_0; //PC0
- GPIO_Initure.Mode=GPIO_MODE_OUTPUT_PP; //推挽输出
- GPIO_Initure.Pull=GPIO_PULLUP; //上拉
- GPIO_Initure.Speed=GPIO_SPEED_FREQ_HIGH; //高速
- HAL_GPIO_Init(GPIOC,&GPIO_Initure);
-
- HAL_GPIO_WritePin(GPIOC,GPIO_PIN_0,GPIO_PIN_SET); //PC0置1,默认初始化后灯灭
- }
|