TJ-WW03-H03/APP_smoke_N_V1.3/HARDWARE/LED/led.h

265 lines
6.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

////////////////////////////////////////////////////////////////////////////////
/// @file led.h
/// @author AE TEAM
/// @brief THIS FILE PROVIDES ALL THE SYSTEM FIRMWARE FUNCTIONS.
////////////////////////////////////////////////////////////////////////////////
/// @attention
///
/// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE
/// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE
/// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR
/// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH
/// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN
/// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS.
///
/// <H2><CENTER>&COPY; COPYRIGHT MINDMOTION </CENTER></H2>
////////////////////////////////////////////////////////////////////////////////
// Define to prevent recursive inclusion
#ifndef __LED_H
#define __LED_H
// Files includes
#include <string.h>
#include "mm32_device.h"
#include "hal_conf.h"
#include "public.h"
////////////////////////////////////////////////////////////////////////////////
/// @defgroup MM32_Example_Layer
/// @brief MM32 Example Layer
/// @{
////////////////////////////////////////////////////////////////////////////////
/// @defgroup MM32_RESOURCE
/// @brief MM32 Examples resource modules
/// @{
////////////////////////////////////////////////////////////////////////////////
/// @defgroup MM32_Exported_Constants
/// @{
#define LED1_Port GPIOA
#define LED1_Pin GPIO_Pin_3
#define LED2_Port GPIOA
#define LED2_Pin GPIO_Pin_5
#define LED3_Port GPIOA
#define LED3_Pin GPIO_Pin_4
// #define LED4_Port GPIOB
// #define LED4_Pin GPIO_Pin_6
// #define LED5_Port GPIOB
// #define LED5_Pin GPIO_Pin_7
//#define V_Port GPIOB
//#define V_Pin GPIO_Pin_3
#define Beep_port GPIOB
#define Beep_Pin GPIO_Pin_6
//#define V2_5V_port GPIOA
//#define V2_5V_Pin GPIO_Pin_5
#define CHANGE_port GPIOA
#define CHANGE_Pin GPIO_Pin_11
#define Bat_T_port GPIOB
#define Bat_T_Pin GPIO_Pin_0
#define TemP_port GPIOA
#define TemP_Pin GPIO_Pin_8
#define LDO_EN_Port GPIOA //LDOʹ<4F>ܿ<EFBFBD><DCBF>ƶ˿<C6B6>
#define LDO_EN_Pin GPIO_Pin_0
#define TEST_Port GPIOA
#define TEST_Pin GPIO_Pin_12
//#define up_Port GPIOB
//#define up_Pin GPIO_Pin_0
//#define down_Port GPIOA
//#define down_Pin GPIO_Pin_7
#define LED1_ON() GPIO_SetBits(LED1_Port,LED1_Pin)
#define LED1_OFF() GPIO_ResetBits(LED1_Port,LED1_Pin)
#define LED1_TOGGLE() (GPIO_ReadOutputDataBit(LED1_Port,LED1_Pin))?(GPIO_ResetBits(LED1_Port,LED1_Pin)):(GPIO_SetBits(LED1_Port,LED1_Pin))
#define LED2_ON() GPIO_SetBits(LED2_Port,LED2_Pin)
#define LED2_OFF() GPIO_ResetBits(LED2_Port,LED2_Pin)
#define LED2_TOGGLE() (GPIO_ReadOutputDataBit(LED2_Port,LED2_Pin))?(GPIO_ResetBits(LED2_Port,LED2_Pin)):(GPIO_SetBits(LED2_Port,LED2_Pin))
#define LED3_ON() GPIO_SetBits(LED3_Port,LED3_Pin)
#define LED3_OFF() GPIO_ResetBits(LED3_Port,LED3_Pin)
#define LED3_TOGGLE() (GPIO_ReadOutputDataBit(LED3_Port,LED3_Pin))?(GPIO_ResetBits(LED3_Port,LED3_Pin)):(GPIO_SetBits(LED3_Port,LED3_Pin))
// #define LED4_ON() GPIO_ResetBits(LED4_Port,LED4_Pin)
// #define LED4_OFF() GPIO_SetBits(LED4_Port,LED4_Pin)
// #define LED4_TOGGLE() (GPIO_ReadOutputDataBit(LED4_Port,LED4_Pin))?(GPIO_ResetBits(LED4_Port,LED4_Pin)):(GPIO_SetBits(LED4_Port,LED4_Pin))
// #define LED5_ON() GPIO_ResetBits(LED5_Port,LED5_Pin)
// #define LED5_OFF() GPIO_SetBits(LED5_Port,LED5_Pin)
// #define LED5_TOGGLE() (GPIO_ReadOutputDataBit(LED5_Port,LED5_Pin))?(GPIO_ResetBits(LED5_Port,LED5_Pin)):(GPIO_SetBits(LED5_Port,LED5_Pin))
//#define V2_5V_ON() GPIO_SetBits(V2_5V_port,V2_5V_Pin)
//#define V2_5V_OFF() GPIO_ResetBits(V2_5V_port,V2_5V_Pin)
//#define OPEN_ON() GPIO_SetBits(V_Port,V_Pin)
//#define OPEN_OFF() GPIO_ResetBits(V_Port,V_Pin)
#define Beep_ON() GPIO_SetBits(Beep_port,Beep_Pin)
#define Beep_OFF() GPIO_ResetBits(Beep_port,Beep_Pin)
#define Charge_OFF() GPIO_SetBits(CHANGE_port,CHANGE_Pin)
#define Charge_ON() GPIO_ResetBits(CHANGE_port,CHANGE_Pin)
#define Bat_T_ON() GPIO_SetBits(Bat_T_port,Bat_T_Pin)
#define Bat_T_OFF() GPIO_ResetBits(Bat_T_port,Bat_T_Pin)
#define Bat_T_TOGGLE() (GPIO_ReadOutputDataBit(Bat_T_port,Bat_T_Pin))?(GPIO_ResetBits(Bat_T_port,Bat_T_Pin)):(GPIO_SetBits(Bat_T_port,Bat_T_Pin))
#define Temp_ON() GPIO_SetBits(TemP_port,TemP_Pin)
#define Temp_OFF() GPIO_ResetBits(TemP_port,TemP_Pin)
#define Temp_TOGGLE() (GPIO_ReadOutputDataBit(TemP_port,TemP_Pin))?(GPIO_ResetBits(TemP_port,TemP_Pin)):(GPIO_SetBits(TemP_port,TemP_Pin))
#define LDO_ON() GPIO_SetBits(LDO_EN_Port,LDO_EN_Pin)
#define LDO_OFF() GPIO_ResetBits(LDO_EN_Port,LDO_EN_Pin)
#define TEST_ON() GPIO_SetBits(TEST_Port,TEST_Pin)
#define TEST_OFF() GPIO_ResetBits(TEST_Port,TEST_Pin)
//#define Charge_TOGGLE() (GPIO_ReadOutputDataBit(CHANGE_port,CHANGE_Pin))?(GPIO_ResetBits(CHANGE_port,CHANGE_Pin)):(GPIO_SetBits(CHANGE_port,CHANGE_Pin))
//#define up_ON() GPIO_SetBits(up_Port,up_Pin)
//#define up_OFF() GPIO_ResetBits(up_Port,up_Pin)
//#define down_ON() GPIO_SetBits(down_Port,down_Pin)
//#define down_OFF() GPIO_ResetBits(down_Port,down_Pin)
#define RED_ON LED3_ON()
#define RED_OFF LED3_OFF()
#define BLUE_ON LED2_ON()
#define BLUE_OFF LED2_OFF()
#define GREEN_ON LED1_ON()
#define GREEN_OFF LED1_OFF()
//#define GREEN_ON LED1_ON()
//#define GREEN_OFF LED1_OFF()
//#define BLUE_ON LED3_ON()
//#define BLUE_OFF LED3_OFF()
/// @}
////////////////////////////////////////////////////////////////////////////////
/// @defgroup MM32_Exported_Enumeration
/// @{
////////////////////////////////////////////////////////////////////////////////
/// @brief XXXX enumerate definition.
/// @anchor XXXX
////////////////////////////////////////////////////////////////////////////////
typedef enum {
LED1,
LED2,
LED3,
LED4
} Led_TypeDef;
/// @}
////////////////////////////////////////////////////////////////////////////////
/// @defgroup MM32_Exported_Variables
/// @{
#ifdef _LED_C_
#define GLOBAL
#else
#define GLOBAL extern
#endif
#undef GLOBAL
/// @}
////////////////////////////////////////////////////////////////////////////////
/// @defgroup MM32_Exported_Functions
/// @{
void LED_Init(void);
void V_led(void);
void led_flash(void);
/// @}
/// @}
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif
////////////////////////////////////////////////////////////////////////////////