55 lines
2.4 KiB
C
55 lines
2.4 KiB
C
#include "led.h"
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//This program is for educational purposes only, without the author's permission, may not be used for any other purpose
|
|
//ALIENTEK STM32F407 Development Board
|
|
//LED driver code
|
|
//Hot Atomic @ALIENTEK
|
|
//Forum: www.openedv.com
|
|
//Date created: 2014/6/10
|
|
//Version: V1.0
|
|
//All rights reserved pirated reserved.
|
|
//Copyright(C) Guangzhou wing electronic technology limited company 2014-2024
|
|
//All rights reserved
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//Initialize the PF9 and PF10 outlet. and to enable these two clocks
|
|
//LED class IO
|
|
void LED_Init(void)
|
|
{
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
|
|
// Board Run LED
|
|
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE); // GPIOE clock
|
|
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; // Board Run LED
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // Output
|
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // Push-pull output
|
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // Pull the output
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; // High-speed GPIO
|
|
GPIO_Init(GPIOE, &GPIO_InitStructure);
|
|
|
|
// RUN, ALM, SOC 0 ~ 3 LED
|
|
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE); // GPIOE clock
|
|
|
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 // ALM LED
|
|
| GPIO_Pin_8 // RUN LED
|
|
| GPIO_Pin_9 // SOC 3 LED
|
|
| GPIO_Pin_10 // SOC 2 LED
|
|
| GPIO_Pin_11 // SOC 1 LED
|
|
| GPIO_Pin_12 // SOC 0 LED
|
|
; // Board Run LED
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // Output
|
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // Push-pull output
|
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // Pull the output
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; // High-speed GPIO
|
|
GPIO_Init(GPIOE, &GPIO_InitStructure);
|
|
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_1); // BOARD RUN LED ON
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_7); // ALM LED ON
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_8); // RUN LED ON
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_9); // SOC 3 LED ON
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_10); // SOC 2 LED ON
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_11); // SOC 1 LED ON
|
|
GPIO_SetBits(GPIOE, GPIO_Pin_12); // SOC 0 LED ON
|
|
}
|