12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include "led.h"
- void LED_GPIO_Config(void)
- {
- /*定义一个GPIO_InitTypeDef类型的结构体*/
- GPIO_InitTypeDef GPIO_InitStructure;
- /*开启LED相关的GPIO外设时钟*/
- RCC_AHB1PeriphClockCmd ( LED_GPIO_CLK, ENABLE);
- /*选择要控制的GPIO引脚*/
- GPIO_InitStructure.GPIO_Pin = LED_PIN;
- /*设置引脚模式为输出模式*/
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
-
- /*设置引脚的输出类型为推挽输出*/
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
-
- /*设置引脚为上拉模式*/
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
- /*设置引脚速率为2MHz */
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- /*调用库函数,使用上面配置的GPIO_InitStructure初始化GPIO*/
- GPIO_Init(LED_GPIO_PORT, &GPIO_InitStructure);
- }
- void NET_STATUS_LED_Config(void)
- {
- /*定义一个GPIO_InitTypeDef类型的结构体*/
- GPIO_InitTypeDef GPIO_InitStructure;
- /*开启NET_STATUS_LED相关的GPIO外设时钟*/
- RCC_AHB1PeriphClockCmd ( NET_STATUS_LED_GPIO_CLK, ENABLE);
- /*选择要控制的GPIO引脚*/
- GPIO_InitStructure.GPIO_Pin = NET_STATUS_LED_PIN;
- /*设置引脚模式为输出模式*/
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
-
- /*设置引脚的输出类型为推挽输出*/
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
-
- /*设置引脚为上拉模式*/
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
- /*设置引脚速率为2MHz */
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- /*调用库函数,使用上面配置的GPIO_InitStructure初始化GPIO*/
- GPIO_Init(NET_STATUS_LED_GPIO_PORT, &GPIO_InitStructure);
- }
- void STATUS_LED_Config(void)
- {
- /*定义一个GPIO_InitTypeDef类型的结构体*/
- GPIO_InitTypeDef GPIO_InitStructure;
- /*开启STATUS_LED相关的GPIO外设时钟*/
- RCC_AHB1PeriphClockCmd ( STATUS_LED_GPIO_CLK, ENABLE);
- /*选择要控制的GPIO引脚*/
- GPIO_InitStructure.GPIO_Pin = STATUS_LED_PIN;
- /*设置引脚模式为输出模式*/
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
-
- /*设置引脚的输出类型为推挽输出*/
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
-
- /*设置引脚为上拉模式*/
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
- /*设置引脚速率为2MHz */
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- /*调用库函数,使用上面配置的GPIO_InitStructure初始化GPIO*/
- GPIO_Init(STATUS_LED_GPIO_PORT, &GPIO_InitStructure);
- }
|