📄 lcddrv.c
字号:
LCDrCtrlWrite(LCDrDATCTL);
LCDrDataWrite(0x2); /* Column direction, Normal dis */
LCDrDataWrite(0x1); /* RGB Arrangement */
LCDrDataWrite(0x4); /* 16bit mode for RGB type B */
}
/* ----------------------------------------------------------------------------
Function : void LCDrClearAll(void)
Description: This function clears LCD RAM buffer to 00H.
Input : NULL
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrClearAll
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void LCDrClearAll(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrblockClear(0, 0, LCDrWIDTH - 1, LCDrHEIGHT - 1);
}
/* ----------------------------------------------------------------------------
Function : void LCDrblockClear(uint16 x1,uint16 y1,uint16 x2,uint16 y2)
Description: This function writes 0x00H in LCD RAM buffer from x1, y1 to x2, y2 location.
Input : x1, x2 (column addres)
y1, y2 (page address)
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrblockClear
* DESCRIPTION
*
* PARAMETERS
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrblockClear(uint16 x1, uint16 y1, uint16 x2, uint16 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
uint16 LCDrx;
uint16 LCDry;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrSetPageAddr((uint8) y1, (uint8) y2);
LCDrSetColAddr((uint8) x1, (uint8) x2);
LCDrWrStart();
for (LCDry = y1; LCDry <= y2; LCDry++) /* Y Coordinate Page Addresses */
for (LCDrx = x1; LCDrx <= x2; LCDrx++) /* X Coordinate Column Addresses */
{
LCDrRAMWrite(0x0F00);
}
}
/* ----------------------------------------------------------------------------
Function : void LCDrDrawRectangle(uint16 x1,uint16 y1,uint16 x2,uint16 y2, uint16 data)
Description: This function draw rectangle on the LCD from location x1, y1 to x2, y2 with data.
Input : x1, x2
y1, y2
data
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrDrawRectangle
* DESCRIPTION
*
* PARAMETERS
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* data [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrDrawRectangle(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint16 data)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
uint16 LCDrx;
uint16 LCDry;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrSetPageAddr((uint8) y1, (uint8) y2); /* Page Address */
LCDrSetColAddr((uint8) x1, (uint8) x2); /* Column Address */
LCDrWrStart(); /* Write Command */
for (LCDry = y1; LCDry <= y2; LCDry++) /* Filling the LCD RAM */
for (LCDrx = x1; LCDrx <= x2; LCDrx++)
{
LCDrRAMWrite(data);
}
}
/* ----------------------------------------------------------------------------
Function : void LCDrBlockWrite(uint16 x1,uint16 y1,uint16 x2,uint16 y2)
Description: This function writes in LCD RAM from location x1, y1 to x2, y2 of shadow buffer.
Input : x1, x2
y1, y2
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrBlockWrite
* DESCRIPTION
*
* PARAMETERS
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrBlockWrite(uint16 x1, uint16 y1, uint16 x2, uint16 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
uint16 LCDrx;
uint16 LCDry;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrSetPageAddr((uint8) y1, (uint8) y2); /* Page Address */
LCDrSetColAddr((uint8) x1, (uint8) x2); /* Column Address */
LCDrWrStart(); /* Write Command */
for (LCDry = y1; LCDry <= y2; LCDry++) /* Filling the LCD RAM */
for (LCDrx = x1; LCDrx <= x2; LCDrx++)
{
LCDrRAMWrite(gShadowBuffer[LCDry][LCDrx]);
/* LCDrDelay(); */
}
}
/* ----------------------------------------------------------------------------
Function : void LCDrblockRead(uint16 x1,uint16 y1,uint16 x2,uint16 y2)
Description: This function reads data from LCD RAM from location x1, y1 to x2, y2 in shadow buffer.
Input : x1, x2
y1, y2
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrblockRead
* DESCRIPTION
*
* PARAMETERS
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrblockRead(uint16 x1, uint16 y1, uint16 x2, uint16 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
uint16 LCDrx;
uint16 LCDry;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrSetPageAddr((uint8) y1, (uint8) y2);
LCDrSetColAddr((uint8) x1, (uint8) x2);
LCDrRdStart();
for (LCDry = y1; LCDry <= y2; LCDry++)
for (LCDrx = x1; LCDrx <= x2; LCDrx++)
{
/* gShadowBuffer[LCDrx][LCDry]=LCDrbg; */
LCDrRAMRead(gShadowBuffer[LCDry][LCDrx]);
}
}
/* ----------------------------------------------------------------------------
Function : void LCDrSetPageAddr(uint8 startPage, uint8 endPage)
Description: This function sets start and end page address for LCD RAM read or write.
Input : start
stop page address
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrSetPageAddr
* DESCRIPTION
*
* PARAMETERS
* startPage [IN]
* endPage [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrSetPageAddr(uint8 startPage, uint8 endPage)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrCtrlWrite(LCDrPASET);
LCDrDataWrite(startPage);
LCDrDataWrite(endPage);
}
/* ----------------------------------------------------------------------------
Function : void LCDrSetColAddr(uint8 startColumn, uint8 endColumn)
Description: This function sets start and end column address for LCD RAM read or write.
Input : start
stop column address
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrSetColAddr
* DESCRIPTION
*
* PARAMETERS
* startColumn [IN]
* endColumn [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrSetColAddr(uint8 startColumn, uint8 endColumn)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrCtrlWrite(LCDrCASET);
LCDrDataWrite(startColumn);
LCDrDataWrite(endColumn);
}
/* ----------------------------------------------------------------------------
Function : void LCDrDISPartial(uint8 startBlock, uint8 endBlock)
Description: This function display the partial LCD RAM content specified by start and end block address.
Input : start and end block address
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrDISPartial
* DESCRIPTION
*
* PARAMETERS
* startBlock [IN]
* endBlock [IN]
* RETURNS
* void
*****************************************************************************/
void LCDrDISPartial(uint8 startBlock, uint8 endBlock)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LCDrCtrlWrite(LCDrPTLIN);
LCDrDataWrite(startBlock);
LCDrDataWrite(endBlock);
}
/* ----------------------------------------------------------------------------
Function : void LCDrDISPartialExit(void)
Description: This function is called to exit from the partial mode.
Input : NULL
Output : None
------------------------------------------------------------------------------- */
/*****************************************************************************
* FUNCTION
* LCDrDISPartialExit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -