Both_Way_Comm_SY8833/TP3310_Demo.si4project/Backup/led(5262).h

114 lines
3.1 KiB
C
Raw Permalink 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"
#ifdef LED_DISPLAY
#ifdef _DEBUG_LED
#define _DEBUG_LED_1
#define _DEBUG_LED_2
#endif
/******************************************************************************\
Macro definitions
\******************************************************************************/
sbit pin_LED_1 = P0^3;
// LED端口定义
#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()
#define LED_PLUS_TIME 10 //LED闪烁最小时间周期单位ms
/******************************************************************************\
Typedef definitions
\******************************************************************************/
//LED工作状态
enum LED_STATE
{
LED_OFF,
LED_ON,
LED_FLASH,
LED_KEEP_FLASHING,
};
//LED控制结构体
typedef struct{
uint8_t State;//LED 的工作状态
uint8_t Flash_Duty;//LED占空比即点亮时间
uint8_t Flash_Period;//LED周期
uint8_t Flash_Times;//闪烁次数
uint8_t Timer;//时间计数 1ms计数一次
}TS_LED_INFO;
/******************************************************************************\
Global variables and functions
\******************************************************************************/
/*
* 函数名称 : LED_Init
* 功能描述 : LED初始化
* 参 数 : NONE
* 返回值 : NONE
*/
/******************************************************************************/
extern void LED_Init(void);
/******************************************************************************/
/*
* 函数名称 : LED_Clr
* 功能描述 : 熄灭全部LED
* 参 数 : NONE
* 返回值 : NONE
*/
/******************************************************************************/
extern void LED_Drv(void);
/******************************************************************************/
/*
* 函数名称 : LED_Set
* 功能描述 : LED工作方式设置
* 参 数 : State工作方式 / Period:闪烁周期(单位ms) / Times:闪烁次数
* 返回值 : NONE
*/
/******************************************************************************/
extern void LED_Set(uint8_t State,uint8_t Period,uint8_t Times);
/******************************************************************************/
// 外部操作接口;Fre:闪烁周期ms;n:闪烁次数
#define LED_R_ON() LED_Set(LED_ON, 0,0)
#define LED_R_OFF() LED_Set(LED_OFF, 0,0)
#define LED_R_FLASH(Fre,n) LED_Set(LED_FLASH, Fre,n)
#define LED_R_KEEP_FLASHING(Fre) LED_Set(LED_KEEP_FLASHING, Fre,0)
//------------------------------------------------------------------------------
#endif
#endif