📄 led.h
字号:
/******************************************************************************
TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
Property of Texas Instruments -- For Unrestricted Internal Use Only
Unauthorized reproduction and/or distribution is strictly prohibited. This
product is protected under copyright law and trade secret law as an
unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All
rights reserved.
Filename : led.h
Description : Header file for the LED module
*******************************************************************************/
#ifndef LED_H
#define LED_H
#include "global_types.h"
#include "mapping.h"
#include "result.h"
//----------------------------------------------------------
// Definition of constant
//-----------------------------------------------------------
/* Address of the registers */
#define LCR_REG_OFFSET 0x0
#define PMR_REG_OFFSET 0x4
#define LED1_LCR_REG *(REGISTER_UWORD8*)(LPG1_BASE_ADDR + LCR_REG_OFFSET) /* Frequency & intensity register */
#define LED1_PMR_REG *(REGISTER_UWORD8*)(LPG1_BASE_ADDR + PMR_REG_OFFSET) /* Power management register */
#define LED2_LCR_REG *(REGISTER_UWORD8*)(LPG2_BASE_ADDR + LCR_REG_OFFSET) /* Frequency & intensity register */
#define LED2_PMR_REG *(REGISTER_UWORD8*)(LPG2_BASE_ADDR + PMR_REG_OFFSET) /* Power management register */
/* Usefull constants */
#define LED_LEDRES 0x40 /* Reset LED counter */
#define LED_PERMON 0x80 /* Force permanent light on */
#define LED_CLK_EN 0x01 /* enable LED clock */
#define LEDPER125MS 0x00 /* LED blink frequencies */
#define LEDPER250MS 0x01
#define LEDPER500MS 0x02
#define LEDPER1S 0x03
#define LEDPER1_5S 0x04
#define LEDPER1S 0x03
/* Test constants */
#define LED_NB_PERCTL 8 /* Number of blinking period of the LED */
#define LED_NB_ONCTRL 8 /* Number of on time of the LED */
/* Watchdog Timer data */
#define LED_VTCXO 20 /* VTCXO frequency in Mhz */
#define LED_TIMER_PTV 7 /* Pre-scale clock Timer Value */
//----------------------------------------------------------
// Macros definition
//----------------------------------------------------------
/*----------------------------------------------------------
DISABLE_CLOCK : disable LED_CLK
------------------------------------------------------------*/
#define LED1_DISABLE_CLOCK (LED1_PMR_REG &= ~LED_CLK_EN)
#define LED2_DISABLE_CLOCK (LED2_PMR_REG &= ~LED_CLK_EN)
/*----------------------------------------------------------
ENABLE_CLOCK : enable LED_CLK
------------------------------------------------------------*/
#define LED1_ENABLE_CLOCK (LED1_PMR_REG |= LED_CLK_EN)
#define LED2_ENABLE_CLOCK (LED2_PMR_REG |= LED_CLK_EN)
/*----------------------------------------------------------
LED_RESET : LED counter reset
------------------------------------------------------------*/
#define LED1_RESET_COUNTER (LED1_LCR_REG &= 0xbf)
#define LED2_RESET_COUNTER (LED2_LCR_REG &= 0xbf)
/*----------------------------------------------------------
LED_RESET : LED counter set
------------------------------------------------------------*/
#define LED1_SET (LED1_LCR_REG |= 0x40)
#define LED2_SET (LED2_LCR_REG |= 0x40)
//----------------------------------------------------------
// LED_PERM_ON : set high to force permanent light on
//-----------------------------------------------------------
#define LED1_SET_PERMANENT_LIGHT_ON (LED1_LCR_REG |= LED_PERMON)
#define LED2_SET_PERMANENT_LIGHT_ON (LED2_LCR_REG |= LED_PERMON)
//----------------------------------------------------------
// LED_PERM_OFF : set low to force permanent light off
//-----------------------------------------------------------
#define LED1_SET_PERMANENT_LIGHT_OFF (LED1_LCR_REG &= ~LED_PERMON)
#define LED2_SET_PERMANENT_LIGHT_OFF (LED2_LCR_REG &= ~LED_PERMON)
//----------------------------------------------------------
// Prototypes
//----------------------------------------------------------
void LPG_SetLpg(UWORD8 perctrl, UWORD8 onctrl);
void wait_pwt(UWORD16 value, UWORD8* fiqCount);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -