#ifndef __LED_H #define __LED_H // #include "sys.h" #include "stm32f4xx_gpio.h" ////////////////////////////////////////////////////////////////////////////////// // 本程序只供国轩使用,未经作者许可,不得用于其它任何用途 // BMS3-MCU1主板 // LED驱动代码 // 作者:郁伉 // 创建日期:2018/10/11 // 版本:V1.0 // 版权所有,盗版必究。 // Copyright(C) 上海国轩新能源有限公司 2016-2024 // All rights reserved ////////////////////////////////////////////////////////////////////////////////// // LED RUN端口定义 #define macLED_RUN_PORT GPIOF // GPIO端口 #define macLED_RUN_CLK RCC_AHB1Periph_GPIOF // GPIO端口时钟 #define macLED_RUN_PIN GPIO_Pin_7 // 连接到SCL时钟线的GPIO // 看门狗端口定义 #define macWATCHDOG_PORT GPIOI // GPIO端口 #define macWATCHDOG_CLK RCC_AHB1Periph_GPIOI // GPIO端口时钟 #define macWATCHDOG_PIN GPIO_Pin_10 // 连接到SCL时钟线的GPIO // LED FAULT端口定义 #define macLED_FAULT_PORT GPIOC // GPIO端口 #define macLED_FAULT_CLK RCC_AHB1Periph_GPIOC // GPIO端口时钟 #define macLED_FAULT_PIN GPIO_Pin_2 // // 喂狗 #define FEED_DOG_ON() GPIO_SetBits(macWATCHDOG_PORT, macWATCHDOG_PIN) #define FEED_DOG_OFF() GPIO_ResetBits(macWATCHDOG_PORT, macWATCHDOG_PIN) #define FEED_DOG_TOGGLE() GPIO_WriteBit(macWATCHDOG_PORT, macWATCHDOG_PIN, (BitAction)(1 - (GPIO_ReadOutputDataBit(macWATCHDOG_PORT, macWATCHDOG_PIN)))) // LED RUN #define LED_RUN_ON() GPIO_ResetBits(macLED_RUN_PORT, macLED_RUN_PIN) #define LED_RUN_OFF() GPIO_SetBits(macLED_RUN_PORT, macLED_RUN_PIN) #define LED_RUN_TOGGLE() GPIO_WriteBit(macLED_RUN_PORT, macLED_RUN_PIN, (BitAction)(1 - (GPIO_ReadOutputDataBit(macLED_RUN_PORT, macLED_RUN_PIN)))) // LED FAULT #define LED_FAULT_ON() GPIO_ResetBits(macLED_FAULT_PORT, macLED_FAULT_PIN) #define LED_FAULT_OFF() GPIO_SetBits(macLED_FAULT_PORT, macLED_FAULT_PIN) #define LED_FAULT_TOGGLE() GPIO_WriteBit(macLED_FAULT_PORT, macLED_FAULT_PIN, (BitAction)(1 - (GPIO_ReadOutputDataBit(macLED_FAULT_PORT, macLED_FAULT_PIN)))) void LED_Init(void); // 初始化 #endif