本文整理汇总了C++中LCD_SetCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ LCD_SetCursor函数的具体用法?C++ LCD_SetCursor怎么用?C++ LCD_SetCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LCD_SetCursor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LCDD_DrawLine
/*
* \brief Draw a line on LCD, horizontal and vertical line are supported.
*
* \param x X-coordinate of line start.
* \param y Y-coordinate of line start.
* \param length line length.
* \param direction line direction: 0 - horizontal, 1 - vertical.
* \param color Pixel color.
*/
void LCDD_DrawLine(
uint32_t x,
uint32_t y,
uint32_t length,
uint32_t direction,
uint32_t color)
{
uint32_t i = 0;
LCD_SetCursor(x, y);
if(direction == DIRECTION_HLINE) {
LCD_WriteRAM_Prepare();
for(i = 0; i < length; i++) {
LCD_WriteRAM(color);
}
}
else {
for(i = 0; i < length; i++) {
LCD_WriteRAM_Prepare();
LCD_WriteRAM(color);
y++;
LCD_SetCursor(x, y);
}
}
}
示例2: main
/*******************************************************************************
* ?????? *
*******************************************************************************/
void main()
{
OSCCON = 0b01110010 ; // ???????8??????
OPTION_REG = 0b00000000 ; // ????I/O???????????????
ANSELA = 0b00000000 ; // ??????????????????I/O??????
TRISA = 0b00000110 ; // ???RA1(SCL)/RA2(SDA)????(RA3?????)
WPUA = 0b00000000 ; // RA1/RA2???????????????
PORTA = 0b00000000 ; // ????????(??LOW???)
RA4 = 0;
__delay_ms(500);
RA4 = 1;
__delay_ms(500);
int i = 0;
// ?????????(????100KHz)
InitI2C_Master(1) ;
// ??????????????
// ICON OFF,??????(0-63),VDD=3.3V???,LCD?8???
LCD_Init(LCD_NOT_ICON,32,LCD_VDD3V,8) ;
while(1)
{
if(RA4 == 0)
i++;
LCD_SetCursor(0,0) ; // ?????????
LCD_Puts("-JP7FKF-") ;
LCD_SetCursor(0,1) ; // ?????????
LCD_Putc(i+0x30) ;
}
}
示例3: LCD_DrawChar
/*******************************************************************************
* Function Name : LCD_DrawChar
* Description : Draws a character on LCD.
* Input : - Xpos: the Line where to display the character shape.
* This parameter can be one of the following values:
* - Linex: where x can be 0..9
* - Ypos: start column address.
* - c: pointer to the character data.
* Output : None
* Return : None
*******************************************************************************/
void LCD_DrawChar(u8 Xpos, u16 Ypos, uc16 *c)
{
u32 index = 0, i = 0;
u8 Xaddress = 0;
Xaddress = Xpos;
LCD_SetCursor(Xaddress, Ypos);
for(index = 0; index < 24; index++)
{
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
for(i = 0; i < 16; i++)
{
if((c[index] & (1 << i)) == 0x00)
{
LCD_WriteRAM(BackColor);
}
else
{
LCD_WriteRAM(TextColor);
}
}
Xaddress++;
LCD_SetCursor(Xaddress, Ypos);
}
}
示例4: LCD_DrawLine
/*******************************************************************************
* Function Name : LCD_DrawLine
* Description : Displays a line.
* Input : - Xpos: specifies the X position.
* - Ypos: specifies the Y position.
* - Length: line length.
* - Direction: line direction.
* This parameter can be one of the following values: Vertical
* or Horizontal.
* Output : None
* Return : None
*******************************************************************************/
void LCD_DrawLine(u8 Xpos, u16 Ypos, u16 Length, u8 Direction)
{
u32 i = 0;
LCD_SetCursor(Xpos, Ypos);
if(Direction == Horizontal)
{
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
for(i = 0; i < Length; i++)
{
LCD_WriteRAM(TextColor);
}
}
else
{
for(i = 0; i < Length; i++)
{
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
Xpos++;
LCD_SetCursor(Xpos, Ypos);
}
}
}
示例5: LCD_DrawChar
/**
* @brief Draws a character on LCD.
* @param Xpos: the Line where to display the character shape.
* @param Ypos: start column address.
* @param c: pointer to the character data.
* @retval None
*/
void LCD_DrawChar(uint8_t Xpos, uint16_t Ypos, const uint16_t *c)
{
uint32_t index = 0, i = 0;
uint8_t Xaddress = 0;
Xaddress = Xpos;
LCD_SetCursor(Xaddress, Ypos);
for(index = 0; index < 24; index++)
{
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
for(i = 0; i < 16; i++)
{
if((c[index] & (1 << i)) == 0x00)
{
LCD_WriteRAM(BackColor);
}
else
{
LCD_WriteRAM(TextColor);
}
}
LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
Xaddress++;
LCD_SetCursor(Xaddress, Ypos);
}
}
示例6: display
void display(void) {
ss = RTC_Read(0x00);
mm = RTC_Read(0x01);
hh = RTC_Read(0x02);
EE = RTC_Read(0x03);
DD = RTC_Read(0x04);
MM = RTC_Read(0x05);
YY = RTC_Read(0x06);
LCD_SetCursor(0, 0); // 表示位置を設定する
LCD_Putc(YY / 16 + '0');
LCD_Putc(YY % 16 + '0');
LCD_Putc('/');
LCD_Putc(MM / 16 + '0');
LCD_Putc(MM % 16 + '0');
LCD_Putc('/');
LCD_Putc(DD / 16 + '0');
LCD_Putc(DD % 16 + '0');
LCD_SetCursor(0, 1); // 表示位置を設定する
LCD_Putc(hh / 16 + '0');
LCD_Putc(hh % 16 + '0');
LCD_Putc(':');
LCD_Putc(mm / 16 + '0');
LCD_Putc(mm % 16 + '0');
LCD_Putc('-');
LCD_Putc(ss / 16 + '0');
LCD_Putc(ss % 16 + '0');
}
示例7: LCD_Clear
/**
* @brief Clears the hole LCD.
* @param Color: the color of the background.
* @retval None
*/
void LCD_Clear(uint16_t Color)
{
uint32_t index = 0;
if(LCDType == LCD_HX8347D)
{
LCD_SetCursor(0, 0);
}
else
{
LCD_SetCursor(0, 319);
}
/* Prepare to write GRAM */
LCD_WriteRAM_Prepare();
for(index = 0; index < (uint32_t)320*240; index++)
{
LCD_WriteRAM(Color);
}
/* Wait until a data is sent(not busy), before config /CS HIGH */
while (SPI_I2S_GetFlagStatus(LCD_SPI, SPI_I2S_FLAG_BSY) != RESET);
LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
}
示例8: LCD_DisplayTime
void LCD_DisplayTime(unsigned char hr,unsigned char min, unsigned char sec)
{
uint8_t d_hour, d_min, d_sec;
uint8_t digit0=0, digit1=0, digit2=0;
d_hour = bcd2dec(hr);
d_min = bcd2dec(min);
d_sec = bcd2dec(sec);
if ( Time_Format == 1 ) // 12 hour format
{
LCD_SetCursor(1,14);
if (d_hour >12)
{
d_hour -= 12;
LCD_Printf("PM");
}
else
{
if ( d_hour == 0) // time is 12 AM
{
d_hour = 12;
}
LCD_Printf("AM");
}
}
if ( Display_Style == 1) // both date and time are displayed in this style
{
LCD_GoToLine(1);
LCD_Printf(" %2d:%2d:%2d",d_hour,d_min,d_sec);
}
else // only date is displayed, so display big numbers
{
digit1 = d_hour/10;
digit0= d_hour%10;
LCD_DisplayBigNum(digit1,0); //display hour
LCD_DisplayBigNum(digit0,3);
// set colon
LCD_SetCursor(1,6);
lcd_DataWrite(0xA5);
LCD_SetCursor(2,6);
lcd_DataWrite(0xA5);
//display min
digit1 = d_min/10;
digit0= d_min%10;
LCD_DisplayBigNum(digit1,7);
LCD_DisplayBigNum(digit0,10);
//display sec
LCD_SetCursor(2,14);
LCD_Printf("%2x",sec);
}
}
示例9: Lcd_SetBox
/**********************************************
函数名:Lcd块选函数
功能:选定Lcd上指定的矩形区域
注意:xStart和 yStart随着屏幕的旋转而改变,位置是矩形框的四个角
入口参数:xStart x方向的起始点
ySrart y方向的终止点
xLong 要选定矩形的x方向长度
yLong 要选定矩形的y方向长度
返回值:无
***********************************************/
void Lcd_SetBox(unsigned int xStart,unsigned int yStart,unsigned int xLong,unsigned int yLong)
{
#if ID_AM==000
LCD_SetCursor(xStart+xLong-1,312-yStart+yLong-1);
#elif ID_AM==001
LCD_SetCursor(xStart+xLong-1,312-yStart+yLong-1);
#elif ID_AM==010
LCD_SetCursor(xStart,312-yStart+yLong-1);
#elif ID_AM==011
LCD_SetCursor(xStart,312-yStart+yLong-1);
#elif ID_AM==100
LCD_SetCursor(xStart+xLong-1,312-yStart);
#elif ID_AM==101
LCD_SetCursor(xStart+xLong-1,312-yStart);
#elif ID_AM==110
LCD_SetCursor(xStart,312-yStart);
#elif ID_AM==111
LCD_SetCursor(xStart,312-yStart);
#endif
LCD_WR_REG(0x0050,xStart);//水平 GRAM起始位置
LCD_WR_REG(0x0051,xStart+xLong-1);//水平GRAM终止位置
LCD_WR_REG(0x0052,312-yStart);//垂直GRAM起始位置
LCD_WR_REG(0x0053,312-yStart+yLong-1);//垂直GRAM终止位置
}
示例10: LCD_DrawCircle2
void LCD_DrawCircle2(u8 Xpos, u16 Ypos, u16 Radius)
{
s32 D;/* Decision Variable */
u32 CurX;/* Current X Value */
u32 CurY;/* Current Y Value */
D = 3 - (Radius << 1);
CurX = 0;
CurY = Radius;
while (CurX <= CurY)
{
LCD_SetCursor(Xpos + CurX, Ypos + CurY);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos + CurX, Ypos - CurY);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos - CurX, Ypos + CurY);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos - CurX, Ypos - CurY);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos + CurY, Ypos + CurX);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos + CurY, Ypos - CurX);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos - CurY, Ypos + CurX);
LCD_WriteRAMWord(BackColor);
LCD_SetCursor(Xpos - CurY, Ypos - CurX);
LCD_WriteRAMWord(BackColor);
if (D < 0)
{
D += (CurX << 2) + 6;
}
else
{
D += ((CurX - CurY) << 2) + 10;
CurY--;
}
CurX++;
}
}
示例11: DCMI_Start
//DCMI,启动传输
void DCMI_Start(void)
{
LCD_SetCursor(0,0);
LCD_WriteRAM_Prepare(); //开始写入GRAM
DMA2_Stream1->CR|=1<<0; //开启DMA2,Stream1
DCMI->CR|=1<<0; //DCMI捕获使能
}
示例12: SetDisplayWindow
/**
* @brief Sets display window.
* @param LayerIndex: layer index
* @param Xpos: LCD X position
* @param Ypos: LCD Y position
* @param Width: LCD window width
* @param Height: LCD window height
* @retval None
*/
static void SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
uint32_t value = 0;
LCD_WriteReg(SSD2119_H_RAM_START_REG, Xpos);
if ((Xpos+Width) >= LCD_PIXEL_WIDTH) {
LCD_WriteReg(SSD2119_H_RAM_END_REG, LCD_PIXEL_WIDTH-1);
} else {
LCD_WriteReg(SSD2119_H_RAM_END_REG, Xpos+Width);
}
if ((Ypos+Height) >= LCD_PIXEL_HEIGHT) {
value = (LCD_PIXEL_HEIGHT-1) << 8;
} else {
value = (Ypos+Height) << 8;
}
value |= Xpos;
LCD_WriteReg(SSD2119_V_RAM_POS_REG, value);
LCD_SetCursor(Xpos, Ypos);
// /********************************************************************//**
// * @brief for stm324fxG Eval EmWin
// **********************************************************************/
// /* Horizontal GRAM Start Address */
// LCD_WriteReg(SSD2119_H_RAM_START_REG, (Ypos));
// /* Horizontal GRAM End Address */
// LCD_WriteReg(SSD2119_H_RAM_END_REG, (Ypos + Height - 1));
//
// value = (LCD_PIXEL_WIDTH - Xpos - 1) << 8; // End addr
// value |= (LCD_PIXEL_WIDTH - Xpos - Width); // Begin Addr
// /* Vertical GRAM Start and End Address */
// LCD_WriteReg(SSD2119_V_RAM_POS_REG, value);
}
示例13: LCD_SetDisplayWindow
/**
* @brief Sets a display window
* @param Xpos: specifies the X buttom left position.
* @param Ypos: specifies the Y buttom left position.
* @param Height: display window height.
* @param Width: display window width.
* @retval None
*/
void LCD_SetDisplayWindow(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width)
{
/* Horizontal GRAM Start Address */
if(Xpos >= Height)
{
LCD_WriteReg(R80, (Xpos - Height + 1));
}
else
{
LCD_WriteReg(R80, 0);
}
/* Horizontal GRAM End Address */
LCD_WriteReg(R81, Xpos);
/* Vertical GRAM Start Address */
if(Ypos >= Width)
{
LCD_WriteReg(R82, (Ypos - Width + 1));
}
else
{
LCD_WriteReg(R82, 0);
}
/* Vertical GRAM End Address */
LCD_WriteReg(R83, Ypos);
LCD_SetCursor(Xpos, Ypos);
}
示例14: LCD_Clear
/**
* @brief Clears the hole LCD.
* @param Color: the color of the background.
* @retval None
*/
void LCD_Clear(uint16_t Color)
{
uint32_t index = 0;
if (LCD_ID == LCD_HX8347D) {
LCD_SetCursor(0x00, 0x0000);
} else {
LCD_SetCursor(0x00, 0x013F);
}
/* Prepare to write GRAM */
LCD_WriteRAM_Prepare();
for (index = 0; index < 76800; index++) {
LCD->LCD_RAM = Color;
}
}
示例15: showhanzi32
//在指定位置显示一个汉字(32*32大小)
void showhanzi32(unsigned int x,unsigned int y,unsigned char index)
{
unsigned char i,j,k;
const unsigned char *temp=hanzi32;
temp+=index*128;
for(j=0;j<32;j++)
{
LCD_SetCursor(x,y+j);
LCD_WriteRAM_Prepare(); //开始写入GRAM
for(k=0;k<4;k++)
{
for(i=0;i<8;i++)
{
if((*temp&(1<<i))!=0)
{
LCD_WR_DATA(POINT_COLOR);
}
else
{
LCD_WR_DATA(BACK_COLOR);
}
}
temp++;
}
}
}