SY883x_For_Client_JLAB_JS07/UsrInc/led/led.h

95 lines
2.4 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
* @brief led dispaly module
*
*
* @version 1.0
* @date 2023/05/12 09:59:40
* @author Alex Xu
*
* Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd.
* All Rights Reserved
*
* History:
* Revision Date Author Desc
* 1.0.0 2023/07/12 Alex build this file
******************************************************************************
*/
#ifndef __LED_H__
#define __LED_H__
#include "define.h"
#if LED_DISPLAY
/******************************************************************************\
Macro definitions
\******************************************************************************/
// LED端口定义
sbit pin_LED_1 = P0^3;
#define LEDR_ON() pin_LED_1 = 1 //LED_1_ON() p03
#define LEDR_OFF() pin_LED_1 = 0 //LED_1_OFF()
#define LEDR_TOG() pin_LED_1 = !pin_LED_1 //LED_1_RUN()
sbit pin_LED_3 = P0^4;
#define LEDB_ON() pin_LED_3 = 1 //LED_3_ON()
#define LEDB_OFF() pin_LED_3 = 0 //LED_3_OFF()
#define LEDB_TOG() pin_LED_3 = !pin_LED_3 //LED_3_RUN()
/******************************************************************************\
Typedef definitions
\******************************************************************************/
//LED名称重定义顺序和上方的宏定义保持一致
enum LED_ID
{
LED_R,
LED_B,
LED_ID_MAX
};
#ifdef BREATHING_LIGHT
//LED呼吸灯控制结构体
typedef struct{
uint8_t Breathing_Light_On; //呼吸灯使能标志位。
uint8_t BL_Flash_Duty; //LED占空比即点亮时间
uint8_t BL_Timer; //时间计数 100us计数一次
uint8_t Flash_Duty_Rising; //呼吸灯逐亮标志
uint8_t Flash_Duty_Declining; //呼吸灯逐暗标志
}BRTH_LED_INFO;
extern idata BRTH_LED_INFO BL_LED;
#define BL_DUTY_MAX 170
#define BL_STEP 2
//LED改变最小时间周期单位
#define LED_PLUS_TIME 1
/*
* 函数名称 : LED_Breathing_Light
* 功能描述 : LED呼吸灯驱动需放在100us时间片中
* 参 数 : NONE
* 返回值 : NONE
*/
/******************************************************************************/
extern void LED_Breathing_Light(void);
/******************************************************************************/
#endif
//------------------------------------------------------------------------------
#endif
#endif