📄 panel.c
字号:
/********************************************************************
* Copyright (C) 1999 Acer Labs, Inc. All Rights Reserved. *
* *
* File: panel.c *
* *
* Contents: Front Panel Control *
* *
* Public Header is panel.h *
* *
* History: *
* Date By Reason *
* =========== ======== ====== *
* 25-Nov-1999 WuCC Create *
* 8-4-03 Benjamin for dview
* 7-5-03 benjamin add comment
********************************************************************/
#include <comsub.h>
#include <ui.h>
#include "frntp.h"
#include <panel.h>
#include "pnlmacro.h"
#include <platform.h>
#include <ui_sub.h> //30213-02sd
#if defined VFD_USE_UPD16311
#include "../sci/upd16311.c"
#endif
#if defined VFD_USE_UPD16312
#include "../sci/upd16312.c"
#endif
#if defined VFD_USE_BU2872
#include "../sci/bu2872.c"
#endif
#if defined VFD_USE_HT1621
#include "../sci/ht1621.c"
#endif
//Added by brook
#if defined VFD_USE_LG
#include "../sci/lg.c"
#endif
/*----------------------*/
/* data type definition */
/*----------------------*/
typedef DWORD PNL_MSG_TYPE;
typedef struct
{
BYTE grid;
DWORD mask;
}
PNL_POS_TYPE;
/*------------------*/
/* data declaration */
/*------------------*/
static /*const*/ PNL_POS_TYPE PnlPosNull[] = {PNL_POS_NULL};
static const PNL_MSG_TYPE PnlDigital2MsgTable[] =
{
PNL_MSG_0, PNL_MSG_1, PNL_MSG_2, PNL_MSG_3,
PNL_MSG_4, PNL_MSG_5, PNL_MSG_6, PNL_MSG_7,
PNL_MSG_8, PNL_MSG_9, PNL_MSG_A, PNL_MSG_B,
PNL_MSG_C, PNL_MSG_D, PNL_MSG_E, PNL_MSG_F
};
//static const unsigned long PnlKeyTrans[] = //30210-01jf
#if (_TRANSFER_ALI_BOARD_ == _TRANSFER_ALI_BOARD_DISABLE_)
#else
extern BOOL I2CIsBusy;//20040216 Tom Yang
unsigned long PnlKeyTrans[] __attribute__ ((section ("IRstandby_DATA"))) = //30210-01jf
{
PNL_KEY_00000001,
PNL_KEY_00000002,
PNL_KEY_00000004,
PNL_KEY_00000008,
PNL_KEY_00000010,
PNL_KEY_00000020,
PNL_KEY_00000040,
PNL_KEY_00000080,
PNL_KEY_00000100,
PNL_KEY_00000200,
PNL_KEY_00000400,
PNL_KEY_00000800,
PNL_KEY_00001000,
PNL_KEY_00002000,
PNL_KEY_00004000,
PNL_KEY_00008000,
PNL_KEY_00010000,
PNL_KEY_00020000,
PNL_KEY_00040000,
PNL_KEY_00080000,
PNL_KEY_00100000,
PNL_KEY_00200000,
PNL_KEY_00400000,
PNL_KEY_00800000,
PNL_KEY_01000000,
PNL_KEY_02000000,
PNL_KEY_04000000,
PNL_KEY_08000000,
PNL_KEY_10000000,
PNL_KEY_20000000,
PNL_KEY_40000000,
PNL_KEY_80000000
};
#endif
/********************************************************************
* Basis Operations *
********************************************************************/
/* Grid Buffer */
static DWORD PnlLightTable[VFD_GRID_NUM+1];
static DWORD PnlLBNorTable[VFD_GRID_NUM+1];
static DWORD PnlBlinkTable[VFD_GRID_NUM+1];
#if (_TRANSFER_ALI_BOARD_ == _TRANSFER_ALI_BOARD_DISABLE_)
static DWORD PnlLightTableBck[VFD_GRID_NUM+1];
static DWORD PnlLBNorTableBck[VFD_GRID_NUM+1];
static DWORD PnlBlinkTableBck[VFD_GRID_NUM+1];
static DWORD PnlLDSpeedCountBck;
static DWORD PnlSpeedCountBck;
#endif
/* Update Flag */
static DWORD PnlBDirty = 1;
static DWORD PnlSpeedCount = PNL_CLK_BLINK_MIDDLE;
static BYTE bBlinkMode = 0;
static DWORD dwPanelCountIR = 0;
static BOOL bShowLoading = FALSE;
#if (_TRANSFER_ALI_BOARD_ == _TRANSFER_ALI_BOARD_DISABLE_)
static BOOL bShowAngle = FALSE;
#endif
#define TDR ((volatile unsigned int *)0xFF102004)
/*------------------------------------------------------------------\
| Function_Name: void PnlLightOffS(PNL_POS_TYPE pos) |
| |
| Description: light off the position recoed in pos |
| |
| Arguments: |
| PNL_POS_TYPE pos : record of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlLightOffS(PNL_POS_TYPE pos)
{
register BYTE grid = pos.grid;
PnlLightTableOff(grid, pos.mask);
PnlBlinkTableUpdate(grid);
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlLightOnS(PNL_POS_TYPE pos) |
| |
| Description: light on and blink off the position recoed in pos |
| |
| Arguments: |
| PNL_POS_TYPE pos : record of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlLightOnS(PNL_POS_TYPE pos)
{
register grid = pos.grid;
PnlLightTableOn(grid, pos.mask);
PnlLBNorTableOff(grid, pos.mask);
PnlBlinkTableUpdate(grid);
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlBlinkOnS(PNL_POS_TYPE pos) |
| |
| Description: light on and blink on the position recoed in pos |
| |
| Arguments: |
| PNL_POS_TYPE pos : record of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlBlinkOnS(PNL_POS_TYPE pos)
{
register BYTE grid = pos.grid;
register DWORD mask = pos.mask;
PnlLightTableOn(grid, mask);
PnlLBNorTableOn(grid, mask);
PnlBlinkTableUpdate(grid);
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlLightOn(PNL_POS_TYPE *pPos) |
| |
| Description: light on those positions pointed by pPos |
| |
| Arguments: |
| PNL_POS_TYPE *pPos : pointer of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlLightOn(PNL_POS_TYPE *pPos)
{
register BYTE grid = pPos->grid;
while (grid != PnlPosNull->grid)
{
PnlLightTableOn(grid, pPos->mask);
PnlBlinkTableUpdate(grid);
grid = (++pPos)->grid;
}
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlLightOff(PNL_POS_TYPE *pPos) |
| |
| Description: light off those positions pointed by pPos |
| |
| Arguments: |
| PNL_POS_TYPE *pPos : pointer of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlLightOff(PNL_POS_TYPE *pPos)
{
register BYTE grid = pPos->grid;
while (grid != PnlPosNull->grid)
{
#if ((_FP==22)||(_FP==111))
if(((pPos->mask)&0x800000)&&(grid!=4)) /*rockman*/
{
PnlLightTableOff(1, 0x800000);
PnlLightTableOff(2, 0x00003f);
PnlBlinkTableUpdate(1);
PnlBlinkTableUpdate(2);
}
else
{
PnlLightTableOff(grid, pPos->mask);
PnlBlinkTableUpdate(grid);
}
grid = (++pPos)->grid;
#elif(_FP==90)
if(((pPos->mask)&0xfc0000)&&(grid==3)) /*rockman*/
{
PnlLightTableOff(4, 0x000001);
PnlLightTableOff(3, 0xfc0000);
PnlBlinkTableUpdate(4);
PnlBlinkTableUpdate(3);
}
PnlLightTableOff(grid, pPos->mask);
PnlBlinkTableUpdate(grid);
grid = (++pPos)->grid;
#else
PnlLightTableOff(grid, pPos->mask);
PnlBlinkTableUpdate(grid);
grid = (++pPos)->grid;
#endif
}
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlBlinkOn(PNL_POS_TYPE *pPos) |
| |
| Description: blink on those positions pointed by pPos |
| |
| Arguments: |
| PNL_POS_TYPE *pPos : pointer of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlBlinkOn(PNL_POS_TYPE *pPos)
{
register BYTE grid = pPos->grid;
while (grid != PnlPosNull->grid)
{
PnlLBNorTableOn(grid, pPos->mask);
PnlBlinkTableUpdate(grid);
grid = (++pPos)->grid;
}
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlBlinkOff(PNL_POS_TYPE *pPos) |
| |
| Description: blink off those positions pointed by pPos |
| |
| Arguments: |
| PNL_POS_TYPE *pPos : pointer of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlBlinkOff(PNL_POS_TYPE *pPos)
{
register BYTE grid = pPos->grid;
while (grid != PnlPosNull->grid)
{
PnlLBNorTableOff(grid, pPos->mask);
PnlBlinkTableUpdate(grid);
grid = (++pPos)->grid;
}
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlSetMessage(PNL_MSG_TYPE *pMsg, |
| PNL_POS_TYPE *pPos) |
| |
| Description: fill those position pointed by pPos |
| with message pMsg |
| |
| Arguments: |
| PNL_POS_TYPE *pPos : pointer of position |
| |
| Return Value: |
\------------------------------------------------------------------*/
void PnlSetMessage(PNL_MSG_TYPE *pMsg, PNL_POS_TYPE *pPos)
{
register BYTE grid = pPos->grid;
while (grid != PnlPosNull->grid)
{
register PNL_MSG_TYPE msg = *pMsg;
register DWORD mask = pPos->mask;
/* added by ShenZhen start here . 08/25/2000 */
#if((_FP==22)||(_FP==111)) /*added for KCL Front Panel.*/
/* shift message to its correct position according mask */
if(mask&0x800000)
{
PnlLightTableOff(1, 0x800000);
PnlLightTableOff(2, 0x00003f);
}
#elif( (_FP==90) )
/* shift message to its correct position according mask */
if((mask&0xfc0000)&&(grid==3))
{
PnlLightTableOff(4, 0x000001);
PnlLightTableOff(3, 0xfc0000);
}
#endif
/* Added by ShenZhen End here . 08/25/2000 */
PnlLightTableOff(grid, mask);
while (!(mask & 0x0001))
{
msg <<= 1;
mask >>= 1;
}
/* do (msg & pPos->mask) to avoid invalid message */
PnlLightTableOn(grid, msg & pPos->mask);
PnlBlinkTableUpdate(grid);
pMsg++;
grid = (++pPos)->grid;
}
PnlBDirty = 1;
}
/*------------------------------------------------------------------\
| Function_Name: void PnlDigitalSetMessage(int value, |
| PNL_POS_TYPE *pPos) |
| |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -