/Modules/CommSerial/ETH01A/SW/STM32F107_ETH_uIP/Utilities/STM32_EVAL/stm32_eval.c |
---|
0,0 → 1,78 |
#include "stm32_eval.h" |
GPIO_TypeDef* GPIO_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT, LED3_GPIO_PORT, |
LED4_GPIO_PORT}; |
const uint16_t GPIO_PIN[LEDn] = {LED1_GPIO_PIN, LED2_GPIO_PIN, LED3_GPIO_PIN, |
LED4_GPIO_PIN}; |
const uint32_t GPIO_CLK[LEDn] = {LED1_GPIO_CLK, LED2_GPIO_CLK, LED3_GPIO_CLK, |
LED4_GPIO_CLK}; |
/** |
* @brief Configures LED GPIO. |
* @param Led: Specifies the Led to be configured. |
* This parameter can be one of following parameters: |
* @arg LED1 |
* @arg LED2 |
* @arg LED3 |
* @arg LED4 |
* @retval None |
*/ |
void STM_EVAL_LEDInit(Led_TypeDef Led) |
{ |
GPIO_InitTypeDef GPIO_InitStructure; |
/* Enable the GPIO_LED Clock */ |
RCC_APB2PeriphClockCmd(GPIO_CLK[Led], ENABLE); |
/* Configure the GPIO_LED pin */ |
GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led]; |
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; |
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; |
GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure); |
} |
/** |
* @brief Turns selected LED On. |
* @param Led: Specifies the Led to be set on. |
* This parameter can be one of following parameters: |
* @arg LED1 |
* @arg LED2 |
* @arg LED3 |
* @arg LED4 |
* @retval None |
*/ |
void STM_EVAL_LEDOn(Led_TypeDef Led) |
{ |
GPIO_PORT[Led]->BSRR = GPIO_PIN[Led]; |
} |
/** |
* @brief Turns selected LED Off. |
* @param Led: Specifies the Led to be set off. |
* This parameter can be one of following parameters: |
* @arg LED1 |
* @arg LED2 |
* @arg LED3 |
* @arg LED4 |
* @retval None |
*/ |
void STM_EVAL_LEDOff(Led_TypeDef Led) |
{ |
GPIO_PORT[Led]->BRR = GPIO_PIN[Led]; |
} |
/** |
* @brief Toggles the selected LED. |
* @param Led: Specifies the Led to be toggled. |
* This parameter can be one of following parameters: |
* @arg LED1 |
* @arg LED2 |
* @arg LED3 |
* @arg LED4 |
* @retval None |
*/ |
void STM_EVAL_LEDToggle(Led_TypeDef Led) |
{ |
GPIO_PORT[Led]->ODR ^= GPIO_PIN[Led]; |
} |
/Modules/CommSerial/ETH01A/SW/STM32F107_ETH_uIP/Utilities/STM32_EVAL/stm32_eval.d |
---|
0,0 → 1,20 |
Utilities/STM32_EVAL/stm32_eval.o: Utilities/STM32_EVAL/stm32_eval.c \ |
Utilities/STM32_EVAL/stm32_eval.h \ |
Project/Webserver_Demo_uIP/stm32f10x_conf.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_adc.h \ |
Libraries/CMSIS/Core/CM3/stm32f10x.h Libraries/CMSIS/Core/CM3/core_cm3.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/include/stdint.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/stdint.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/_ansi.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/newlib.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/sys/config.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/machine/ieeefp.h \ |
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/sys/features.h \ |
Libraries/CMSIS/Core/CM3/system_stm32f10x.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_exti.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_flash.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_gpio.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_rcc.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_spi.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_usart.h \ |
Libraries/STM32F10x_StdPeriph_Driver/inc/misc.h |
/Modules/CommSerial/ETH01A/SW/STM32F107_ETH_uIP/Utilities/STM32_EVAL/stm32_eval.h |
---|
0,0 → 1,36 |
#ifndef __STM32_EVAL_H__ |
#define __STM32_EVAL_H__ |
#include "stm32f10x_conf.h" |
#define LEDn 4 |
#define LED1_GPIO_PORT GPIOB |
#define LED1_GPIO_CLK RCC_APB2Periph_GPIOB |
#define LED1_GPIO_PIN GPIO_Pin_4 |
#define LED2_GPIO_PORT GPIOB |
#define LED2_GPIO_CLK RCC_APB2Periph_GPIOB |
#define LED2_GPIO_PIN GPIO_Pin_5 |
#define LED3_GPIO_PORT GPIOB |
#define LED3_GPIO_CLK RCC_APB2Periph_GPIOB |
#define LED3_GPIO_PIN GPIO_Pin_6 |
#define LED4_GPIO_PORT GPIOB |
#define LED4_GPIO_CLK RCC_APB2Periph_GPIOB |
#define LED4_GPIO_PIN GPIO_Pin_7 |
typedef enum |
{ |
LED1 = 0, |
LED2 = 1, |
LED3 = 2, |
LED4 = 3 |
} Led_TypeDef; |
void STM_EVAL_LEDInit(Led_TypeDef Led); |
void STM_EVAL_LEDOn(Led_TypeDef Led); |
void STM_EVAL_LEDOff(Led_TypeDef Led); |
void STM_EVAL_LEDToggle(Led_TypeDef Led); |
#endif /* __STM32_EVAL_H__ */ |