📄 lpg.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 : lpg.h
Description : Header file for the LPG module
*******************************************************************************/
#ifndef LPG_H
#define LPG_H
#include "global_types.h"
#include "mapping.h"
#include "result.h"
//----------------------------------------------------------
// Definition of constant
//-----------------------------------------------------------
/* Address of the registers */
#define LPG_LCR_REG *(REGISTER_UWORD8*)(MAP_LPG_REG) /* Frequency & intensity register */
#define LPG_PMR_REG *(REGISTER_UWORD8*)(MAP_LPG_REG + 0x01) /* Power management register */
/* Usefull constants */
#define LPG_LPGRES 0x40 /* Reset LPG counter */
#define LPG_PERMON 0x80 /* Force permanent light on */
#define LPG_CLK_EN 0x01 /* enable LPG clock */
#define LPGPER125MS 0x00 /* LED blink frequencies */
#define LPGPER250MS 0x01
#define LPGPER500MS 0x02
#define LPGPER1S 0x03
#define LPGPER1_5S 0x04
#define LPGPER1S 0x03
/* Test constants */
#define LPG_NB_PERCTL 8 /* Number of blinking period of the LED */
#define LPG_NB_ONCTRL 8 /* Number of on time of the LED */
/* Watchdog Timer data */
#define LPG_VTCXO 20 /* VTCXO frequency in Mhz */
#define LPG_TIMER_PTV 7 /* Pre-scale clock Timer Value */
//----------------------------------------------------------
// Macros definition
//----------------------------------------------------------
/*----------------------------------------------------------
DISABLE_CLOCK : disable LPG_CLK
------------------------------------------------------------*/
#define LPG_DISABLE_CLOCK (LPG_PMR_REG &= ~LPG_CLK_EN)
/*----------------------------------------------------------
ENABLE_CLOCK : enable LPG_CLK
------------------------------------------------------------*/
#define LPG_ENABLE_CLOCK (LPG_PMR_REG |= LPG_CLK_EN)
/*----------------------------------------------------------
LPG_RESET : LPG counter reset
------------------------------------------------------------*/
#define LPG_RESET_COUNTER (LPG_LCR_REG &= 0xbf)
/*----------------------------------------------------------
LPG_RESET : LPG counter set
------------------------------------------------------------*/
#define LPG_SET (LPG_LCR_REG |= 0x40)
//----------------------------------------------------------
// LPG_PERM_ON : set high to force permanent light on
//-----------------------------------------------------------
#define LPG_SET_PERMANENT_LIGHT_ON (LPG_LCR_REG |= LPG_PERMON)
//----------------------------------------------------------
// LPG_PERM_OFF : set low to force permanent light off
//-----------------------------------------------------------
#define LPG_SET_PERMANENT_LIGHT_OFF (LPG_LCR_REG &= ~LPG_PERMON)
//----------------------------------------------------------
// Prototypes
//----------------------------------------------------------
void LPG_SetLpg(UWORD8 perctrl, UWORD8 onctrl);
void wait_pwt(UWORD16 value, UWORD8* fiqCount);
void LPG_TestLpgRegister();
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -