66 lines
2.3 KiB
C
66 lines
2.3 KiB
C
/**
|
||
****************************************************************************************************
|
||
* @file led.h
|
||
* @author XX<58>Ŷ<EFBFBD>
|
||
* @version V1.0
|
||
* @date 2021-10-14
|
||
* @brief LED <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* @license Copyright (c) 2020-2032,
|
||
****************************************************************************************************
|
||
* @attention
|
||
*
|
||
* <20><>ع<EFBFBD><D8B9><EFBFBD>ϵͳƽ̨<C6BD><CCA8>STM32F407
|
||
|
||
|
||
|
||
|
||
*
|
||
* <20><EFBFBD>˵<EFBFBD><CBB5>
|
||
|
||
* <20><>һ<EFBFBD>η<EFBFBD><CEB7><EFBFBD>
|
||
*
|
||
****************************************************************************************************
|
||
*/
|
||
#ifndef __LCD_H
|
||
#define __LCD_H
|
||
|
||
#include "drv_sys.h"
|
||
|
||
|
||
/******************************************************************************************/
|
||
/* 引脚 定义 */
|
||
|
||
#define LED0_GPIO_PORT GPIOF
|
||
#define LED0_GPIO_PIN GPIO_PIN_9
|
||
#define LED0_GPIO_CLK_ENABLE() do{ __HAL_RCC_GPIOF_CLK_ENABLE(); }while(0) /* PF口时钟使能 */
|
||
|
||
#define LED1_GPIO_PORT GPIOF
|
||
#define LED1_GPIO_PIN GPIO_PIN_10
|
||
#define LED1_GPIO_CLK_ENABLE() do{ __HAL_RCC_GPIOF_CLK_ENABLE(); }while(0) /* PF口时钟使能 */
|
||
|
||
/******************************************************************************************/
|
||
|
||
/* LED端口定义 */
|
||
#define LED0(x) do{ x ? \
|
||
HAL_GPIO_WritePin(LED0_GPIO_PORT, LED0_GPIO_PIN, GPIO_PIN_SET) : \
|
||
HAL_GPIO_WritePin(LED0_GPIO_PORT, LED0_GPIO_PIN, GPIO_PIN_RESET); \
|
||
}while(0) /* LED0 = RED */
|
||
|
||
#define LED1(x) do{ x ? \
|
||
HAL_GPIO_WritePin(LED1_GPIO_PORT, LED1_GPIO_PIN, GPIO_PIN_SET) : \
|
||
HAL_GPIO_WritePin(LED1_GPIO_PORT, LED1_GPIO_PIN, GPIO_PIN_RESET); \
|
||
}while(0) /* LED1 = GREEN */
|
||
|
||
/* LED取反定义 */
|
||
#define LED0_TOGGLE() do{ HAL_GPIO_TogglePin(LED0_GPIO_PORT, LED0_GPIO_PIN); }while(0) /* LED0 = !LED0 */
|
||
#define LED1_TOGGLE() do{ HAL_GPIO_TogglePin(LED1_GPIO_PORT, LED1_GPIO_PIN); }while(0) /* LED1 = !LED1 */
|
||
|
||
/******************************************************************************************/
|
||
/* 外部接口函数*/
|
||
void led_init(void); /* 初始化 */
|
||
|
||
#endif
|
||
|
||
|
||
|