📄 led.h
字号:
/************************************************************************************
* This header file is for LED Driver Interface.
*
*
* (c) Copyright 2006, Freescale, Inc. All rights reserved.
*
* Freescale Confidential Proprietary
* Digianswer Confidential
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
*
************************************************************************************/
#ifndef _LED_H_
#define _LED_H_
#include "AppToPlatformConfig.h"
#include "EmbeddedTypes.h"
/******************************************************************************
*******************************************************************************
* Public Macros
*******************************************************************************
******************************************************************************/
#define gLEDSupported_d 1
#if (gLEDSupported_d == 1)
#if (gTargetEVB_d == 1) || (gTargetSARD_d == 1) /* 13192-SARD or 13192-EVB */
#include "Led_MC1319xEVBSARD.h"
#elif (gTargetAxiomGB60_d == 1)
#include "Led_MC1319xGB60.h"
#elif (gTargetMC13213NCB_d == 1) || (gTargetMC13213SRB_d == 1)
#include "Led_MC1321xNCBSRB.h"
#elif (gTarget_UserDefined_d == 1)
#include "PortConfig.h"
#define mLED_PORT1_TARGET_c LED_PORT
#define mLED_PORT2_TARGET_c LED_PORT
#define mLED_PORT3_TARGET_c LED_PORT
#define mLED_PORT4_TARGET_c LED_PORT
#define mLED1_PIN_TARGET_c LED1_PIN
#define mLED2_PIN_TARGET_c LED2_PIN
#define mLED3_PIN_TARGET_c LED3_PIN
#define mLED4_PIN_TARGET_c LED4_PIN
#endif
#include "IoConfig.h"
#include "TMR_Interface.h"
/******************************************************************************
*******************************************************************************
* Public Macros
*******************************************************************************
******************************************************************************/
typedef enum {
LED1 = 0x01,
LED2 = 0x02,
LED3 = 0x04,
LED4 = 0x08
}LED_t;
/* mLEDTimerID_c is used for timer ID for timer to flashing a LED. This constanst may NOT be changed */
#define mLEDTimerID_c gApplicationTimerIDOffset_c+1
/* Interval time for toggle LED which is used for flashing LED (0 - 262140ms) */
#define mLEDInterval_c 300
/* Define LED port mapping */
#define mLED_PORT1_c mLED_PORT1_TARGET_c
#define mLED_PORT2_c mLED_PORT2_TARGET_c
#define mLED_PORT3_c mLED_PORT3_TARGET_c
#define mLED_PORT4_c mLED_PORT4_TARGET_c
#define mLED_PORT5_c mLED_PORT5_TARGET_c
#define mLED1_PIN_c mLED1_PIN_TARGET_c
#define mLED2_PIN_c mLED2_PIN_TARGET_c
#define mLED3_PIN_c mLED3_PIN_TARGET_c
#define mLED4_PIN_c mLED4_PIN_TARGET_c
#define mLED5_PIN_c mLED5_PIN_TARGET_c
/* Macros with functionality to LED */
#define Led1On mLED_PORT1_c &= ~mLED1_PIN_c;
#define Led1Off mLED_PORT1_c |= mLED1_PIN_c;
#define Led1Toggle mLED_PORT1_c ^= mLED1_PIN_c;
#define Led2On mLED_PORT2_c &= ~mLED2_PIN_c;
#define Led2Off mLED_PORT2_c |= mLED2_PIN_c;
#define Led2Toggle mLED_PORT2_c ^= mLED2_PIN_c;
#define Led3On mLED_PORT3_c &= ~mLED3_PIN_c;
#define Led3Off mLED_PORT3_c |= mLED3_PIN_c;
#define Led3Toggle mLED_PORT3_c ^= mLED3_PIN_c;
#define Led4On mLED_PORT4_c &= ~mLED4_PIN_c;
#define Led4Off mLED_PORT4_c |= mLED4_PIN_c;
#define Led4Toggle mLED_PORT4_c ^= mLED4_PIN_c;
#if (gTargetMC13213SRB_d == 1) || (gTargetMC13213NCB_d == 1)
#define Led5On mLED_PORT5_c &= ~mLED5_PIN_c;
#define Led5Off mLED_PORT5_c |= mLED5_PIN_c;
#define Led5Toggle mLED_PORT5_c ^= mLED5_PIN_c;
#endif
/* Turn off LEDs */
#define TurnOffLeds Led1Off Led2Off Led3Off Led4Off
/* Turn on LEDs */
#define TurnOnLeds Led1On Led2On Led3On Led4On
/* Flashing LED */
#define Led1Flashing LED_StartFlash(LED1);
#define Led2Flashing LED_StartFlash(LED2);
#define Led3Flashing LED_StartFlash(LED3);
#define Led4Flashing LED_StartFlash(LED4);
#define StopLed1Flashing StopFlashFunc(LED1);
#define StopLed2Flashing StopFlashFunc(LED2);
#define StopLed3Flashing StopFlashFunc(LED3);
#define StopLed4Flashing StopFlashFunc(LED4);
/* End of Macros with functionality to LED */
/******************************************************************************
*******************************************************************************
* Public prototypes
*******************************************************************************
******************************************************************************/
void LED_StartFlash(LED_t LEDNr);
void StopFlashFunc(LED_t LEDNr);
#else
#define Led1On
#define Led1Off
#define Led1Toggle
#define Led2On
#define Led2Off
#define Led2Toggle
#define Led3On
#define Led3Off
#define Led3Toggle
#define Led4On
#define Led4Off
#define Led4Toggle
#if (gTargetMC13213SRB_d == 1) || (gTargetMC13213NCB_d == 1)
#define Led5On
#define Led5Off
#define Led5Toggle
#endif
#define Led1Flashing
#define Led2Flashing
#define Led3Flashing
#define Led4Flashing
#define StopLed1Flashing
#define StopLed2Flashing
#define StopLed3Flashing
#define StopLed4Flashing
#define TurnOffLeds
#define TurnOnLeds
#endif /* gLEDSupported_d */
/******************************************************************************
*******************************************************************************
* Public type definitions
*******************************************************************************
******************************************************************************/
/* None */
/******************************************************************************
*******************************************************************************
* Public Memory Declarations
*******************************************************************************
******************************************************************************/
/* None */
/******************************************************************************
*******************************************************************************
* Public functions
*******************************************************************************
******************************************************************************/
/* None */
#endif /* _LED_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -