rt-thread/bsp/stm32f0x/drivers/led.c

39 lines
901 B
C
Raw Normal View History

/*
2018-10-16 13:00:37 +08:00
* Copyright (c) 2006-2018, RT-Thread Development Team
*
2018-10-16 13:00:37 +08:00
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2013-11-15 bright the first version
*/
2017-10-16 19:16:10 +08:00
#include <rtthread.h>
#include "led.h"
/*
LED_GREEN: PC8
LED_RED : PC9
*/
/* Initial led gpio pin */
2017-10-16 19:16:10 +08:00
int rt_hw_led_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable the GPIO_LED Clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
/* Configure the GPIO_LED pin */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
2017-10-16 19:16:10 +08:00
return 0;
}
/* Initial components for device */
INIT_DEVICE_EXPORT(rt_hw_led_init);