コード例 #1
0
ファイル: gui.c プロジェクト: nvero/fmhobby
//加载显示界面
//在PS2/触控画图时用到
//设置界面 
//str:"选择/确定"
void Load_Gui_Show(u8 *lbtstr,u8 *mbtstr,u8 *rbtstr)
{			 	   					  			   
    LCD_Clear(WHITE);  //清屏  
 	POINT_COLOR=DARKBLUE;//深蓝色	 
	LCD_DrawLine(0,297,239,297);
 	LCD_Fill(0,298,239,308,LIGHTBLUE);//填充底部颜色(浅蓝色)	
 	LCD_Fill(0,308,239,319,GRAYBLUE); //填充底部颜色(灰蓝色)	  	   
	POINT_COLOR=WHITE;//白色字体
	Show_Str(5,300,lbtstr,16,0x01);    //叠加模式,非自动换行
	Show_Str(104,300,mbtstr,16,0x01);  //叠加模式,非自动换行		  
	Show_Str(203,300,rbtstr,16,0x01);  //叠加模式,非自动换行  
}
コード例 #2
0
ファイル: board.c プロジェクト: dragonflyor/STM32F4-TestProjs
//显示串口收到的数据
//comdata:要显示的数据
void com_statusBar(char * comdata){
	static u8 rec_count = 0;
	LCD_DrawRectangle(1,lcddev.height-40,lcddev.width-1,lcddev.height-1); //屏幕底部画一个矩形	
	LCD_DrawLine(1,lcddev.height-20,lcddev.width,lcddev.height-20);		//画线
	LCD_ShowString(2,lcddev.height-39,500,16,16,"Received data from srialport:"); //标题
	
	LCD_Fill(2,lcddev.height-19,lcddev.width-2,lcddev.height-2,WHITE);
	LCD_ShowString(2,lcddev.height-19,500,16,16,(u8*)comdata); //内容
	
	//状态条尾部蓝绿色闪烁:表示系统串口任务正在接收数据
	LCD_Fill(lcddev.width-19,lcddev.height-39,lcddev.width,lcddev.height-21,lcd_discolor[10-rec_count%2]); //填充状态信号
}
コード例 #3
0
/*******************************************************************************
* Function Name  : Get_State_COLOR_Mn
* Description    :
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void Draw_COLOR_Mn(uint8_t Leight)
{
	uint8_t i;

	for(i = 0; i < Leight; i++) 
	{
		LCD_SetGraphicsColor(*(p256ColorMassive + (i * ColorMn.ColorCoeff)));
		LCD_DrawLine(ColorMn.X + i, ColorMn.Y, ColorMn.X + i, ColorMn.Y + ColorMn.Height);
	}

	ColorMn.State = DRAW;
}
コード例 #4
0
/**
  * @brief  This function move the cursor right.
  * @param  None
  * @retval None
  */
void right(void)
{
  int cursor_pos= 0;
  cursor_pos= detect_cursor();
  if (cursor_pos == 1)
  {
    LCD_EraseLine(33, 16, 33, 23);
    LCD_EraseLine(32, 16, 32, 23);
    LCD_DrawLine(33, 24, 33, 31);
    LCD_DrawLine(32, 24, 32, 31);
  }
  else if (cursor_pos == 2)
  {
    LCD_EraseLine(33, 24, 33, 31);
    LCD_EraseLine(32, 24, 32, 31);
    LCD_DrawLine(33, 40, 33, 47);
    LCD_DrawLine(32, 40, 32, 47);
  }
  else if (cursor_pos == 3)
  {
    LCD_EraseLine(33, 40, 33, 47);
    LCD_EraseLine(32, 40, 32, 47);
    LCD_DrawLine(33, 48, 33, 55);
    LCD_DrawLine(32, 48, 32, 55);
  }
  else if (cursor_pos == 4)
    ;
}
コード例 #5
0
ファイル: lcd_display.c プロジェクト: Rost-enTroniX/hpks
void AbgasTemperatureView(void)
{
	uint16_t	i,y;
	MEASUREMENT_VIEW_struct * viewMem = pt100_getViewMem();
	LCD_ClearScreen();
	LCD_SetPenColor(1);
	LCD_SetFont(0);
	LCD_PrintXY(30,0,"ABGAS:");
	LCD_PrintXY(80,0,viewMem->cur_value);
		
	LCD_SetFont(0);
	
  int max = roundUp(viewMem->max);
  int min  = roundDown(viewMem->min);
  int diff = max-min;
  int span;
  if(!diff) {
    span = 10;
    if(min) min -= 10;
  }else {
    span = diff/3;
  }
  
  if(span < 10) span = 10;
  
  char dummy[10];
 
    sprintf(dummy,"%4u-",min+(span*3));
    LCD_PrintXY(0,0, dummy);
    
    sprintf(dummy,"%4u-",min+(span*2));
    LCD_PrintXY(0,18,dummy);
    
    sprintf(dummy,"%4u-",min+(span*1));
    LCD_PrintXY(0,37,dummy);
    
    sprintf(dummy,"%4u-",min);
    LCD_PrintXY(0,56,dummy);

  
	LCD_DrawLine(27,0,27,63);
  diff = (span*3);
  
	for(i=27;i<128;i++)
	{
		y = viewMem->Mem[127-i];
		y =  64 - ((double)(y-min)*(double)(64.0/diff));
		LCD_PutPixel(i,y,1);
		LCD_PutPixel(i,y+1,1);
		
	}
}
コード例 #6
0
ファイル: gui.c プロジェクト: nvero/fmhobby
//加载浏览界面
//设置界面 
//str:"选择/确定"
void Load_Gui_Bro(u8 * str)
{			 	   					  			   
    LCD_Clear(WHITE);//清屏
	//顶部 						   
 	LCD_Fill(0,0,239,9,LIGHTBLUE);  //填充底部颜色(浅蓝色)	
 	LCD_Fill(0,10,239,20,GRAYBLUE); //填充底部颜色(灰蓝色)
	//中部
	POINT_COLOR=DARKBLUE;//深蓝色  
	LCD_DrawLine(0,21,239,21);
	LCD_Fill(0,22,239,41,LIGHTBLUE);//填充中部部颜色(浅灰蓝色)
	LCD_DrawLine(0,41,239,41);	    
	//底部
	LCD_DrawLine(0,298,239,298);
 	LCD_Fill(0,299,239,308,LIGHTBLUE);//填充底部颜色(浅蓝色)	
 	LCD_Fill(0,308,239,319,GRAYBLUE);//填充底部颜色(灰蓝色)

	POINT_COLOR=DARKBLUE;
	Show_Str(0,23,"请选择:",16,0x01); //叠加模式,非自动换行
	POINT_COLOR=WHITE;
	Show_Str(5,300,str,16,0x01);   //叠加模式,非自动换行
	Show_Str(203,300,"返回",16,0x01); //叠加模式,非自动换行  
}
コード例 #7
0
ファイル: main.c プロジェクト: iGaryGu/Painter
/**
* @brief  Configure the IO Expander and the Touch Panel.
* @param  None
* @retval None
*/
static void TP_Config(void)
{
  /* Clear the LCD */ 
  LCD_Clear(LCD_COLOR_WHITE);
  
  /* Configure the IO Expander */
  if (IOE_Config() == IOE_OK)
  {   
    LCD_SetFont(&Font8x8);
    LCD_DisplayStringLine(LINE(32), (uint8_t*)"              Touch Panel Paint     ");
    LCD_DisplayStringLine(LINE(34), (uint8_t*)"              Example               ");
    LCD_SetTextColor(LCD_COLOR_BLUE2); 
    LCD_DrawFullRect(5, 250, 30, 30);
    LCD_SetTextColor(LCD_COLOR_CYAN); 
    LCD_DrawFullRect(40, 250, 30, 30);
    LCD_SetTextColor(LCD_COLOR_YELLOW); 
    LCD_DrawFullRect(75, 250, 30, 30);
    LCD_SetTextColor(LCD_COLOR_RED); 
    LCD_DrawFullRect(5, 288, 30, 30);
    LCD_SetTextColor(LCD_COLOR_BLUE); 
    LCD_DrawFullRect(40, 288, 30, 30);
    LCD_SetTextColor(LCD_COLOR_GREEN); 
    LCD_DrawFullRect(75, 288, 30, 30);
    LCD_SetTextColor(LCD_COLOR_MAGENTA); 
    LCD_DrawFullRect(145, 288, 30, 30);
    LCD_SetTextColor(LCD_COLOR_BLACK); 
    LCD_DrawFullRect(110, 288, 30, 30);
    LCD_DrawRect(180, 270, 48, 50);
    LCD_SetFont(&Font16x24);
    LCD_DisplayChar(LCD_LINE_12, 195, 0x43);
    LCD_DrawLine(0, 248, 240, LCD_DIR_HORIZONTAL);
    LCD_DrawLine(0, 284, 180, LCD_DIR_HORIZONTAL);
    LCD_DrawLine(1, 248, 71, LCD_DIR_VERTICAL);
    LCD_DrawLine(37, 248, 71, LCD_DIR_VERTICAL);
    LCD_DrawLine(72, 248, 71, LCD_DIR_VERTICAL);
    LCD_DrawLine(107, 248, 71, LCD_DIR_VERTICAL);
    LCD_DrawLine(142, 284, 36, LCD_DIR_VERTICAL);
    LCD_DrawLine(0, 319, 240, LCD_DIR_HORIZONTAL);
  }  
  else
  {
    LCD_Clear(LCD_COLOR_RED);
    LCD_SetTextColor(LCD_COLOR_BLACK); 
    LCD_DisplayStringLine(LCD_LINE_6,(uint8_t*)"   IOE NOT OK      ");
    LCD_DisplayStringLine(LCD_LINE_7,(uint8_t*)"Reset the board   ");
    LCD_DisplayStringLine(LCD_LINE_8,(uint8_t*)"and try again     ");
  }
}
//--------------------------------------------------------------
void LCD_DrawFullCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius, uint16_t color)
{
  int32_t  D;    /* Decision Variable */
  uint32_t  CurX;/* Current X Value */
  uint32_t  CurY;/* Current Y Value */

  D = 3 - (Radius << 1);

  CurX = 0;
  CurY = Radius;

  while (CurX <= CurY)
  {
    if(CurY > 0)
    {
      LCD_DrawLine(Xpos - CurX, Ypos - CurY, 2*CurY, LCD_DIR_VERTICAL, color);
      LCD_DrawLine(Xpos + CurX, Ypos - CurY, 2*CurY, LCD_DIR_VERTICAL, color);
    }

    if(CurX > 0)
    {
      LCD_DrawLine(Xpos - CurY, Ypos - CurX, 2*CurX, LCD_DIR_VERTICAL, color);
      LCD_DrawLine(Xpos + CurY, Ypos - CurX, 2*CurX, LCD_DIR_VERTICAL, color);
    }
    if (D < 0)
    {
      D += (CurX << 2) + 6;
    }
    else
    {
      D += ((CurX - CurY) << 2) + 10;
      CurY--;
    }
    CurX++;
  }

  LCD_DrawCircle(Xpos, Ypos, Radius, color);
}
コード例 #9
0
ファイル: json.c プロジェクト: jh247247/vassal
// Draw the line described by the given string
// args are x0, x1, y0, y1, color
const char* JSON_evalLine(const char* ptr) {
  // should be endptrs for the atoi func.
  const char* data[4] = {NULL};
  if(getAmountOfArgs(&ptr, data, 4) != 4) {
    // how do I reconver? do all the other elements die?
    return ptr; // error! too few args
  }
  LCD_DrawLine(atoi(data[0]),
               atoi(data[1]),
               atoi(data[2]),
               atoi(data[3]),
               atoi(ptr-1));
  return ptr;
}
コード例 #10
0
ファイル: lcd_display.c プロジェクト: Rost-enTroniX/hpks
void O2_ErrorView(void)
{
	uint16_t	i,y;
  
	LCD_ClearScreen();
	LCD_SetPenColor(1);
	LCD_SetFont(0);
	LCD_PrintXY( 0,0, "Lambda Fehler!");
	
	LCD_SetFont(0);
  
	LCD_PrintXY(0, 0, "W | S | U | U | S | C");
	LCD_PrintXY(0, 9, "D | P | H | L | O | J");
  LCD_DrawLine(0,18,127,18);
  LCD_PrintXY(0,19, "  |   |   |   |   |  ");
  
  if(lambda_get_single_error(WATCHDOG)) LCD_PrintXY(0,19, "X");
  if(lambda_get_single_error(SPI_ERROR)) LCD_PrintXY(24,19, "X");
  if(lambda_get_single_error(UBAT_HIGH)) LCD_PrintXY(48,19, "X");
  if(lambda_get_single_error(UBAT_LOW)) LCD_PrintXY(72,19, "X");
  if(lambda_get_single_error(SONDE_OVERHEAT)) LCD_PrintXY(96,19, "X");
  if(lambda_get_single_error(CJ_ERROR)) LCD_PrintXY(120,19, "X");

      
      
  LCD_PrintXY(0,35, "DIAHG|IA/IP|UN|VM");
  LCD_PrintXY(0,44, "DIAHD|IA/IP|UN|VM");
  LCD_DrawLine(0,53,127,53);
  LCD_PrintXY(0,54, "     |     |  |  ");
   if(lambda_get_single_cjerror(DIAHG_DIAHD_ERROR)) LCD_PrintXY(12,54, "X");                 
   if(lambda_get_single_cjerror(IA_IP_ERROR)) LCD_PrintXY(54,54, "X"); 
   if(lambda_get_single_cjerror(UN_ERROR)) LCD_PrintXY(78,54, "X"); 
   if(lambda_get_single_cjerror(VM_ERROR)) LCD_PrintXY(96,54, "X"); 
  
  

}
コード例 #11
0
/*******************************************************************************
* Function Name  : btnTIME_SCALE_trigX_Update
* Description    :
* Input          :
* Return         : None
*******************************************************************************/
void btnTIME_SCALE_trigX_Update(DrawState NewState)
{
	static uint16_t Old_Position = 2, Old_WindowPosition = 0;
	float win_widht = (float)btnTIME_SCALE.Width * ((float)gSamplesWin.WindowWidh / (float)gOSC_MODE.oscNumPoints );
	float win_pos = trigPosX_cursor.WindowPosition * (win_widht / *SweepScale);
	uint16_t tX = 0;

	if(NewState == CLEAR)
	{
		tX = Old_Position + btnTIME_SCALE.Left;

		if(Old_WindowPosition == trigPosX_cursor.WindowPosition) LCD_SetGraphicsColor(DarkOrange2);
		else LCD_SetGraphicsColor(btnTIME_SCALE.Color);
		LCD_DrawLine(tX, btnTIME_SCALE.Lower + 1, tX, (btnTIME_SCALE.Lower + btnTIME_SCALE.Height) - 1);
	}

	LCD_Draw_SIN(btnTIME_SCALE.Left + 1, btnTIME_SCALE.Lower + (btnTIME_SCALE.Height/4) + 1, (btnTIME_SCALE.Left + btnTIME_SCALE.Width) - 1,
						btnTIME_SCALE.Lower + ((btnTIME_SCALE.Height * 3)/4) + 2, 10, LightGray4);

	if((gSyncState.Mode != Sync_NONE) && (NewState == DRAW))
	{
		tX = (uint16_t)(((float)(trigPosX_cursor.Position - leftLimit) * (float)btnTIME_SCALE.Width) / ((float)gOSC_MODE.oscNumPoints * (float)(*SweepScale)));

		if(tX < win_pos + 1) tX = win_pos + 1;
		else if(tX > win_pos + win_widht - 1) tX = win_pos + win_widht - 1;

		tX += btnTIME_SCALE.Left;
		if(tX < btnTIME_SCALE.Left + 2) tX = btnTIME_SCALE.Left + 2;
		else if(tX > (btnTIME_SCALE.Left + btnTIME_SCALE.Width) - 2) tX = (btnTIME_SCALE.Left + btnTIME_SCALE.Width) - 2;

		LCD_SetGraphicsColor(White);
		LCD_DrawLine(tX, btnTIME_SCALE.Lower + 1, tX, (btnTIME_SCALE.Lower + btnTIME_SCALE.Height) - 1);
	}

	Old_Position = tX - btnTIME_SCALE.Left;;
	Old_WindowPosition = trigPosX_cursor.WindowPosition;
}
コード例 #12
0
ファイル: draw_graph.c プロジェクト: pyth7853/freertos-stm32
void DrawBackground(void)
{
	struct graph_info *graph;

	LCD_SetTextColor(LCD_COLOR_WHITE);
	for (graph = fence_info; graph->wl.width; graph++) {
		LCD_DrawFullRect(graph->x, graph->y, 
					graph->wl.width, graph->hd.height);
	}

	LCD_SetTextColor(LCD_COLOR_YELLOW);
	for (graph = dline_info; graph->wl.len; graph++) {
		LCD_DrawLine(graph->x, graph->y, graph->wl.len, graph->hd.dir);
	}
}
コード例 #13
0
ファイル: IHM.c プロジェクト: MIDMX/RaVisual
void setting_menu(){

	//fond d'écran, header
	header(5,TRUE,TRUE);

	//choix de la police
	LCD_SetFont(&Bebasn);

	//initialisation des variables
	int i = 0, taille = 6;
	const int offsetY = 36;

	//filling text container
	create_rectangle(0,25,320,190,0x5ACB); //TODO: inutile, à virer

	//affichage du menu-list dans le menu settings
	for(i = 0;i<taille;i++){

		//drawing separators
		LCD_DrawLine(0,(32*i)+24,320,LCD_DIR_HORIZONTAL,0x39C7);
		LCD_DrawLine(0,(32*i)+25,320,LCD_DIR_HORIZONTAL,0x738E);

		//displaying text and icons in "non selected color"
		LCD_DisplayStringLine((32*i)+offsetY,45,(uint8_t *)list[i],0xD6BA,0x5ACB,LCD_NO_DISPLAY_ON_UART);
		DISP_BMP((uint8_t*)logoff[i],10,(32*i)+28,24,24);

		//bufferisation de la position des boutons
		create_button(button,i,0,(i*32)+25,320,33);

	}

	//affichage du footer, puis lecture de l'écran tactile
	footer(SETTINGS);
	read_screen(button,SETTINGS,taille);

}
コード例 #14
0
ファイル: _textsel.c プロジェクト: sbstnp/deviation
void _DrawTextSelectHelper(struct guiTextSelect *select, const char *str)
{
    struct guiBox *box = &select->header.box;
    // plate text select for devo 10, copy most behavior from label.c
    GUI_DrawBackground(box->x, box->y, box->width, box->height);
    u8 arrow_width = ARROW_WIDTH - 1;
    if (select->enable  & 0x01) {
        u16 y = box->y + box->height / 2;  // Bug fix: since the logic view is introduced, a coordinate could be greater than 10000
        u16 x1 = box->x + arrow_width -1;
        LCD_DrawLine(box->x, y, x1, y - 2, 0xffff);
        LCD_DrawLine(box->x, y, x1, y + 2, 0xffff); //"<"
        x1 = box->x + box->width - arrow_width;
        u16 x2 = box->x + box->width -1;
        LCD_DrawLine(x1, y - 2, x2, y, 0xffff);
        LCD_DrawLine(x1, y + 2, x2, y, 0xffff); //">"
    }  else if (select->enable == 2) {  // ENBALBE == 2 means the textsel can be pressed but not be selected
        select->desc.style = LABEL_UNDERLINE;
    } else {
        if (!select->enable)  // avoid drawing button box when it is disable
            select->desc.style = LABEL_CENTER;
    }
    GUI_DrawLabelHelper(box->x + arrow_width , box->y, box->width - 2 * arrow_width , box->height,
            str, &select->desc, (guiObject_t *)select == objSELECTED);
}
コード例 #15
0
/**
  * @brief  This function handles RTC Alarm interrupt (A and B) request.
  * @param  None
  * @retval None
  */
void RTC_Alarm_IRQHandler(void)
{
  uint32_t tmp = 0;
  
  /* Check on the Alarm A flag and on the number of interrupts per Second (60*8) */
  if(RTC_GetITStatus(RTC_IT_ALRA) != RESET) 
  { 
    /* Clear RTC AlarmA Flags */
    RTC_ClearITPendingBit(RTC_IT_ALRA);
    if(uwRTCAlarmCount != 480)
    {
      /* Increment the counter of Alarm A interrupts */
      uwRTCAlarmCount++;

      /* Set the LCD Back Color */
      LCD_SetTextColor(Green);

      /* Draw rectangle on the LCD */
      LCD_DrawLine(80,290 - (uwRTCAlarmCount/2),25,Vertical);

      /* Set the LCD text color */
      LCD_SetTextColor(Red);

      /* Display rectangle on the LCD */
      LCD_DrawRect(80, 290, 25, 240 );

      /* Define the rate of Progress bar */
      tmp = (uwRTCAlarmCount * 100)/ 480; 

      /* Set the LCD Font */
      LCD_SetFont(&Font16x24);
    
      /* Display Char on the LCD : XXX% */
      LCD_DisplayChar(LINE(2),200, (tmp / 100) +0x30);
      LCD_DisplayChar(LINE(2),180, ((tmp  % 100 ) / 10) +0x30);
      LCD_DisplayChar(LINE(2),160, (tmp % 10) +0x30);
      LCD_DisplayChar(LINE(2),140, 0x25);
    }
    else
    {
      /* Disable the RTC Clock */
      RCC_RTCCLKCmd(DISABLE);
    }
  }
  /* Clear the EXTI line 17 */
  EXTI_ClearITPendingBit(EXTI_Line17);
  
}
コード例 #16
0
ファイル: main.c プロジェクト: wms124/STM32_UCOSIII
//主函数
int main(void)
{
	OS_ERR err;
	CPU_SR_ALLOC();
	
	delay_init(168);  	//时钟初始化
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//中断分组配置
	uart_init(115200);  //串口初始化
	LED_Init();         //LED初始化	
	LCD_Init();			//LCD初始化	
	KEY_Init();			//按键初始化
	FSMC_SRAM_Init();	//初始化SRAM
	my_mem_init(SRAMIN);//初始化内部RAM
	
	POINT_COLOR = RED;
	LCD_ShowString(30,10,200,16,16,"Explorer STM32F4");	
	LCD_ShowString(30,30,200,16,16,"UCOSIII Examp 13-1");
	LCD_ShowString(30,50,200,16,16,"Pend Multi");
	LCD_ShowString(30,70,200,16,16,"ATOM@ALIENTEK");
	LCD_ShowString(30,90,200,16,16,"2015/5/20");
	
	POINT_COLOR = BLACK;
	LCD_DrawRectangle(5,110,234,314);	
	LCD_DrawLine(5,130,234,130);
	POINT_COLOR = RED;
	LCD_ShowString(50,111,200,16,16,"ObjRdy_NUM: 0");
	POINT_COLOR = BLUE;
	
	OSInit(&err);		    	//初始化UCOSIII
	OS_CRITICAL_ENTER();	//进入临界区			 
	//创建开始任务
	OSTaskCreate((OS_TCB 	* )&StartTaskTCB,		//任务控制块
				 (CPU_CHAR	* )"start task", 		//任务名字
                 (OS_TASK_PTR )start_task, 			//任务函数
                 (void		* )0,					//传递给任务函数的参数
                 (OS_PRIO	  )START_TASK_PRIO,     //任务优先级
                 (CPU_STK   * )&START_TASK_STK[0],	//任务堆栈基地址
                 (CPU_STK_SIZE)START_STK_SIZE/10,	//任务堆栈深度限位
                 (CPU_STK_SIZE)START_STK_SIZE,		//任务堆栈大小
                 (OS_MSG_QTY  )0,					//任务内部消息队列能够接收的最大消息数目,为0时禁止接收消息
                 (OS_TICK	  )0,					//当使能时间片轮转时的时间片长度,为0时为默认长度,
                 (void   	* )0,					//用户补充的存储区
                 (OS_OPT      )OS_OPT_TASK_STK_CHK|OS_OPT_TASK_STK_CLR, //任务选项
                 (OS_ERR 	* )&err);				//存放该函数错误时的返回值
	OS_CRITICAL_EXIT();	//退出临界区	 
	OSStart(&err);      //开启UCOSIII
}
コード例 #17
0
ファイル: main.c プロジェクト: wms124/STM32_UCOSIII
//加载主界面
void ucos_load_main_ui(void)
{
	POINT_COLOR = RED;
	LCD_ShowString(10,10,200,16,16,"Explorer STM32F4");	
	LCD_ShowString(10,30,200,16,16,"UCOSIII Examp 11-2");
	LCD_ShowString(10,50,200,16,16,"Task Queue");
	LCD_ShowString(10,70,220,16,16,"KEY_UP:Tmr1");
	LCD_ShowString(10,90,200,16,16,"2015/5/20");
	
	POINT_COLOR = BLACK;
	LCD_DrawLine(0,107,239,107);		//画线
	POINT_COLOR = RED;
	LCD_ShowString(30,130,100,16,16,"tmr1 state:");
	LCD_ShowString(30,170,120,16,16,"Task_QMsg Size:");
	LCD_ShowString(30,210,120,16,16,"Task_QMsg rema:");
	LCD_ShowString(30,250,100,16,16,"Task_QMsg:");
	POINT_COLOR = BLUE;
	LCD_ShowString(40,150,100,16,16,"TMR1 STOP! ");
}
コード例 #18
0
ファイル: lcd_display.c プロジェクト: Rost-enTroniX/hpks
void O2View(void)
{
	uint16_t	i,y;
  
  if(lambda_fehler()) {
    O2_ErrorView();
    return;
  } 
  else if(!lambda_run()) {
    O2_StatusView();
    return;
  }
  
	MEASUREMENT_VIEW_struct * viewMem = lambda_getViewMem();
	LCD_ClearScreen();
	LCD_SetPenColor(1);
	LCD_SetFont(0);
	LCD_PrintXY(40,0,"O2:");
	LCD_PrintXY(80,0,viewMem->cur_value);
		
	LCD_SetFont(0);
	LCD_PrintXY(0,0, "25-");
	LCD_PrintXY(0,18,"15-");
	LCD_PrintXY(0,37," 5-");
	LCD_PrintXY(0,56," 0-");
	LCD_DrawLine(15,0,15,63);

  
  for(i=16;i<128;i++)
	{
    y = viewMem->Mem[127-i];
    if(y < 25) {
		
      y =  64 - ((double)(y)*(double)(64.0/25));
      LCD_PutPixel(i,y,1);
      LCD_PutPixel(i,y+1,1);
    }
	}

}
コード例 #19
0
ファイル: lcd_display.c プロジェクト: Rost-enTroniX/hpks
void DS18B20View(void)
{	
  char a[20];
  int i, count;
  DS18B20_struct *ds18b20_dev;
  
 
LCD_ClearScreen();
LCD_SetFont(0);	
  LCD_SetPenColor(1);
LCD_PrintXY(0,0,"DS18B20");
  LCD_DrawLine(0,21,127,21);
  count =  ds18b20_getDeviceCount() ;


  for(i=0; i<count;i++) {
    ds18b20_dev = ds18b20_getDevice(i);
    if(ds18b20_dev->crc)
      LCD_PrintfXY(0,23+(8*i), "%s: %5.1f",ds18b20_dev->_deviceid, ds18b20_dev->tempGrad); 
    else
      LCD_PrintfXY(0,23+(8*i), "%s: Fehler",ds18b20_dev->_deviceid); 
  }
}
コード例 #20
0
ファイル: gl_mgr.c プロジェクト: denisweir/STM32F40X
/**
  * @brief  Background main window custom draw callback
  * @param  None
  * @retval None
  */
static void DrawBackgroundZone (void)
{

  LCD_SetTextColor(0x1253);
  GL_LCD_FillRect(38, 319, 202, 75);
  GL_LCD_FillRect(0, 319, 38, 320);

  LCD_SetTextColor(GL_Black);

  LCD_DrawLine(40, 243,200,Vertical);
  LCD_DrawLine(39, 244, 245,Horizontal);
  LCD_DrawLine(39, 320, 75,Horizontal);


  LCD_SetTextColor(GL_Grey);
  LCD_DrawLine(39, 244,201,Vertical);
  LCD_DrawLine(38, 244, 245,Horizontal);
  LCD_DrawLine(38, 320, 75,Horizontal);

  GL_SetTextColor(GL_White);
  GL_SetFont(GL_FONT_SMALL);
  GL_UpdateGroupSelectionLabel (GL_Group);
  GL_DisplayAdjStringLine(10 , 250,  (uint8_t *)"STM32 Demonstration builder", GL_TRUE);
}
コード例 #21
0
ファイル: main.c プロジェクト: bennycooly/school-projects
//GAME
int main(void){unsigned long i=64,j=0;
  PLL_Init();  // Set the clocking to run at 80MHz from the PLL.
  LCD_Init();  // Initialize LCD
	Piano_Init();
	Sound_Init();
	ADC_Init();		//initialize ADC
	ADC_SetChannel(1); //PE2
	
	Missile_Init();
	Enemy1_Init();
	
  LCD_Goto(10,0);
  LCD_SetTextColor(255,0,0); // yellow= red+green, no blue
  printf("Welcome to Pokemon Capture!");
	delay_long();
	LCD_DrawFilledRect(0,0,320,80,0x00);
	delay_short();
	
	while((GPIO_PORTE_DATA_R&0x01)==0){
		LCD_Goto(10,0);
		printf("Press any button to begin...");
		delay_blink();
		LCD_DrawFilledRect(0,0,320,80,0x00);
		delay_blink();
	}
	delay_short();
	
	LCD_SetTextColor(255,255,0);
	LCD_Goto(0,0);
	printf("Tragedy has struck Pallet Town! Four Pokemon have    escaped from their Pokeballs, and it's your job to   put them back where they belong.");
	delay_long();
	delay_long();
	delay_long();
	LCD_DrawFilledRect(0,0,320,80,0x00);
	delay_short();
	
	LCD_Goto(0,0);
	printf("Use the slider to aim, and when you think you have a shot, press the button to throw your Pokeball.");
	delay_long();
	delay_long();
	delay_long();
	LCD_DrawFilledRect(0,0,320,80,0x00);
	delay_blink();
	
	LCD_Goto(0,0);
	printf("You only have so many Pokeballs, so be smart where   you throw them!");
	delay_long();
	delay_long();
	LCD_DrawFilledRect(0,0,320,80,0x00);
	delay_short();
	
	LCD_Goto(0,0);
	printf("Good luck!");
	delay_long();
	LCD_DrawFilledRect(0,0,320,80,0x00);
	delay_short();
	
	LCD_SetTextColor(255,0,0);
	LCD_Goto(0,0);
	printf("Captured:");
	
	LCD_SetTextColor(0,255,0);
	LCD_Goto(14,0);
	printf("Pokeballs Left:");
	
	LCD_SetTextColor(0,0,255);
	LCD_Goto(35,0);
	printf("Accuracy:");
  LCD_DrawLine(10,16,310,16,BURNTORANGE);
  
  Timer2_Init(7256); // 11kHz
	SysTick_Init(2666667);	//30 Hz
  EnableInterrupts();
	
	Pokeballs = 25;
  while(1){
		if((25-(hits+misses))==0){
			if(kill!=4){
				DisableInterrupts();
				LCD_SetTextColor(255,0,0);
				
				LCD_DrawFilledRect(0,0,320,80,0x00);
				delay_short();
				
				LCD_Goto(0,0);
				printf("Sorry, you were not able to catch all the Pokemon.");
				delay_long();
				delay_long();
				LCD_DrawFilledRect(0,0,320,80,0x00);
				delay_short();
				
				LCD_Goto(0,0);
				printf("Try again.");
				delay_long();
				LCD_DrawFilledRect(0,0,320,80,0x00);
				delay_short();
				
				while(1){
				LCD_Goto(0,0);
				printf("Press RESET to play again.");
				delay_blink();
				LCD_DrawFilledRect(0,0,320,80,0x00);
				delay_blink();
				}
			}
		}
				
		if(kill==4){
			DisableInterrupts();
			LCD_SetTextColor(0,255,255);
			
			LCD_DrawFilledRect(0,0,320,80,0x00);
			delay_short();
			
			LCD_Goto(0,0);
			printf("Congratulations! You have captured all the Pokemon!");
			delay_long();
			delay_long();
			LCD_DrawFilledRect(0,0,320,80,0x00);
			delay_short();
			
			LCD_Goto(0,0);
			printf("You are now a Pokemon Master!");
			delay_long();
			delay_long();
			LCD_DrawFilledRect(0,0,320,80,0x00);
			delay_short();
			
			while(1){
				LCD_Goto(0,0);
				printf("Press RESET to play again.");
				delay_blink();
				LCD_DrawFilledRect(0,0,320,80,0x00);
				delay_blink();
			}
		}
		
		
    if(Semaphore){
			
			LCD_SetTextColor(255,0,0);
			LCD_Goto(10,0);
			LCD_PrintInteger(kill);
			
			LCD_SetTextColor(0,255,0);
			LCD_Goto(30,0);
			LCD_PrintInteger(25-(hits+misses));
			if((25-(hits+misses))<10){
				LCD_Goto(31,0);
				printf(" ");
			}
			
			LCD_SetTextColor(0,0,255);
			LCD_Goto(45,0);
			LCD_PrintInteger(hits/(hits+misses));
			
			//draw ship
			if(Ship_Position>288){
				Ship_Position=288;
			}
      LCD_DrawBMP(PlayerShip,Ship_Position,220);
			LCD_DrawFilledRect(0,220,Ship_Position,9,0x00);
			LCD_DrawFilledRect(Ship_Position+32,220,320-(Ship_Position+32),9,0x00);
			
			
      for(j=0;j<1;j++){
				if(Missile[j].life==1){
					LCD_DrawBMP(Missile[j].image, Missile[j].x, Missile[j].y);
				} else{
					LCD_DrawFilledRect(Missile[j].x,Missile[j].y,16,18,0x00);
				}
				if(Missile[j].y<=18){
					LCD_DrawFilledRect(Missile[j].x,Missile[j].y,16,18,0x00);
					Missile[j].life=0;
					misses++;
				}
			}
			
      for(i=0;i<4;i++){
				if(Enemy1[i].life!=0){
					LCD_DrawBMP(Enemy1[i].image,Enemy1[i].x,Enemy1[i].y);
				}
				else{
					LCD_DrawFilledRect(Enemy1[i].x,Enemy1[i].y,32,32,0x00);
				}
			}
			
			LCD_DrawFilledRect(0,17,320,4,0x00);
			
      Semaphore = 0;
    }
  }
}
コード例 #22
0
ファイル: main.c プロジェクト: jongtao/stm32l-dev-chain
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32l1xx_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32l1xx.c file
     */
 
  uint32_t index = 0, tmp=0 ;
  
  /* Initialize the LCD */
  STM32L152D_LCD_Init(); 
  
  /* Clear the LCD */ 
  LCD_Clear(White);
  
  /* Set the LCD Back Color */
  LCD_SetBackColor(Blue);
  
  /* Set the LCD Text Color */
  LCD_SetTextColor(White);
  
  /* Displays MESSAGE1 on line 1 */
  LCD_DisplayStringLine(LINE(0), (uint8_t *)MESSAGE1);
  
  /* Set the LCD Back Color */
  LCD_SetBackColor(Cyan);
  
  /* Set the LCD Text Color */
  LCD_SetTextColor(Black);
  
  /* Draw lines */
  LCD_DrawUniLine(69, 121, 69,20);
  LCD_DrawUniLine(171, 121, 171, 20);
  
  /* Draw 4 lines  */
  LCD_DrawUniLine(70, 121, 120, 71);
  LCD_DrawUniLine(120, 71, 170,121);
  LCD_DrawUniLine(70, 20, 120, 70);
  LCD_DrawUniLine(120, 70, 170,20);
  
  /* Initailize the Display Picture */  
  for (index = 0; index < 100 ; index++)
  {
    if ((index % 2) ==0)
    {
      /* Set the LCD Text Color */
      LCD_SetTextColor(Blue);
      /* Draw Horizontal line */
      LCD_DrawLine(70 + (index/2) , 120 - (index/2)  , 101 - (index + 1) ,Horizontal);
      /* Set the LCD Text Color */
      LCD_SetTextColor(White);
      /* Draw Horizontal line */
      LCD_DrawLine(170 - (index/2) , 120 - (index/2)  , 101 - (index + 1) ,Horizontal);
    }
  }
  
  /* Set the LCD Text Color */
  LCD_SetTextColor(Blue); 
  /* Set the LCD Back Color */
  LCD_SetBackColor(White);
  
  /* Display String on the LCD  */
  LCD_DisplayStringLine(LINE(3), " Set Timer:");
  LCD_DisplayStringLine(95,     "   01:00 ");  
  
  /* Initialize Timer to 60 seconds */
  SecondNumb = 60;
  
  /* Configure the external interrupt "LEFT", "RIGHT" , "DOWN" and "UP" buttons */
  STM_EVAL_PBInit(BUTTON_RIGHT, BUTTON_MODE_EXTI);
  STM_EVAL_PBInit(BUTTON_LEFT, BUTTON_MODE_EXTI);
  STM_EVAL_PBInit(BUTTON_UP, BUTTON_MODE_EXTI);
  STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_EXTI);
  
  /* Configure DOWN button in GPIO mode */  
   STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_GPIO);  
  
  /* Configure the RTC peripheral by selecting the clock source.*/
  RTC_Config();
 
  /* Configure RTC AlarmA register to generate 8 interrupts per 1 Second */
  RTC_AlarmConfig();
  
  /* Set Text and Back color and Text size */
  LCD_SetFont(&Font12x12);
  LCD_SetBackColor(Cyan);
  LCD_SetTextColor(Black);
  LCD_DisplayStringLine(LINE(18), (uint8_t *)MESSAGE2);
  
  /* Set the LCD Back Color */
  LCD_SetBackColor(Blue);
  LCD_SetTextColor(White);
  LCD_DisplayStringLine(LINE(19), (uint8_t *)MESSAGE3);
  LCD_SetFont(&Font16x24);

  while (1)
  {
    /* Check on the event 'start' */
    if(StartEvent == 8)
    {
      /* Check on the Alarm event counter */
      if(RTCAlarmCount != 0 ) 
      {
        tmp = (uint32_t) ((RTCAlarmCount * 100)/ (8 * SecondNumb)); 
        
        /* First */
        Delay((1000* SecondNumb));
        
        LCD_SetTextColor(Blue);
        LCD_DrawLine(120, 70, 2, Vertical);
        LCD_DrawLine(122, 68, 2, Vertical);
        LCD_DrawLine(122, 72, 2, Vertical);
        if(tmp <= 72)
        {  
          LCD_SetTextColor(White);
          LCD_DrawLine(130, 70, 2, Vertical);
          LCD_DrawLine(132, 68, 2, Vertical);
          LCD_DrawLine(132, 72, 2, Vertical);
        }
        LCD_SetTextColor(Blue);
        LCD_DrawLine(140, 70, 2, Vertical);
        LCD_DrawLine(142, 69, 2, Vertical);
        LCD_DrawLine(142, 72, 2, Vertical);
        
        /* Second */
        Delay((1000*SecondNumb));
        if(tmp <= 90)
        { 
          LCD_SetTextColor(White);
          LCD_DrawLine(120, 70, 2, Vertical);
          LCD_DrawLine(122, 68, 2, Vertical);
          LCD_DrawLine(122, 72, 2, Vertical);
        }
        LCD_SetTextColor(Blue);
        LCD_DrawLine(130, 70, 2, Vertical);
        LCD_DrawLine(132, 68, 2, Vertical);
        LCD_DrawLine(132, 72, 2, Vertical);
        if(tmp <= 52)
        { 
          LCD_SetTextColor(White);
          LCD_DrawLine(140, 70, 2, Vertical);
          LCD_DrawLine(142, 68, 2, Vertical);
          LCD_DrawLine(142, 72, 2, Vertical);
        }
      }
    }
    else if (StartEvent == 9)
    {
      LCD_SetTextColor(Blue);
      LCD_DrawLine(120, 70, 2, Vertical);
      LCD_DrawLine(122, 68, 2, Vertical);
      LCD_DrawLine(122, 72, 2, Vertical);
      
      LCD_DrawLine(130, 70, 2, Vertical);
      LCD_DrawLine(132, 68, 2, Vertical);
      LCD_DrawLine(132, 72, 2, Vertical);
      
      LCD_DrawLine(140, 70, 2, Vertical);
      LCD_DrawLine(142, 68, 2, Vertical);
      LCD_DrawLine(142, 72, 2, Vertical);
    }
    else
    {
      if(tmp <= 90)
      { 
        LCD_SetTextColor(White);
      }
      else
      {
        LCD_SetTextColor(Blue);
      }
      LCD_DrawLine(120, 70, 2, Vertical);
      LCD_DrawLine(122, 68, 2, Vertical);
      LCD_DrawLine(122, 72, 2, Vertical);
      
      if(tmp <= 72)
      { 
        LCD_SetTextColor(White);
      }
      else
      {
        LCD_SetTextColor(Blue);
      }
      LCD_DrawLine(130, 70, 2, Vertical);
      LCD_DrawLine(132, 68, 2, Vertical);
      LCD_DrawLine(132, 72, 2, Vertical);
      
      if(tmp <= 52)
      { 
        LCD_SetTextColor(White);
      }
      else
      {
        LCD_SetTextColor(Blue);
      }
      LCD_DrawLine(140, 70, 2, Vertical);
      LCD_DrawLine(142, 68, 2, Vertical);
      LCD_DrawLine(142, 72, 2, Vertical);
      
    }
  }
}
コード例 #23
0
ファイル: mytest.c プロジェクト: nvero/fmhobby
void LCD_DrawLineEx(u16 y)
{

	LCD_DrawLine(0,y*LN_HEIGHT-1,319,y*LN_HEIGHT-1);

}
コード例 #24
0
ファイル: gui.c プロジェクト: nvero/fmhobby
//加载游戏界面
//size:3,3*3图片
//     4,4*4图片
//     5,5*5图片
//#define FRAME1 0XBC40 //棕色
void Load_Game_ICO(u8 size)
{
	u8 i;
	LCD_Clear(LGRAY);//清屏
	for(i=0;i<4;i++)//画大边框
	{		
		POINT_COLOR=FRAME1;
		LCD_DrawRectangle(i,i,239-i,239-i);
	}
	if(size==3)
	{
		for(i=0;i<4;i++)//画小边框
		{		
			POINT_COLOR=FRAME1;
			LCD_DrawRectangle(154+i,235+i,239-i,316-i);
		}									 
	    LCD_Fill(158,235,235,239,WHITE);//把多余的去掉	
		POINT_COLOR=RED;
		LCD_DrawRectangle(158,235,235,312);//画空的方框,事先不放图片
		LCD_DrawRectangle(4,4,235,235); //画最大的红框

		LCD_DrawLine(81,4,81,235);  //画内部红框
		LCD_DrawLine(158,4,158,235);//画内部红框
		LCD_DrawLine(4,81,235,81);  //画内部红框
		LCD_DrawLine(4,158,235,158);//画内部红框
	}else if(size==4)
	{
		for(i=0;i<4;i++)//画小边框
		{		
			POINT_COLOR=FRAME1;
			LCD_DrawRectangle(174+i,236+i,239-i,298-i);
		}									 
	    LCD_Fill(178,236,236,240,WHITE);//把多余的去掉	
		POINT_COLOR=RED;
		LCD_DrawRectangle(178,236,236,294);//画空的方框,第十六格
		LCD_DrawRectangle(4,4,236,236);    //画最大的红框

		for(i=0;i<size;i++)LCD_DrawLine(4,4+58*i,236,4+58*i);  //画内部横网格线
		for(i=0;i<size;i++)LCD_DrawLine(4+58*i,4,4+58*i,236);  //画内部竖网格线	   										  
	}else if(size==5)
	{
		for(i=0;i<4;i++)//画小边框
		{		
			POINT_COLOR=FRAME1;
			LCD_DrawRectangle(184+i,234+i,239-i,284-i);
		}	
		LCD_DrawLine(4,235,236,235);  //误差横线填充线
		LCD_DrawLine(235,4,235,281);  //误差竖线填充线
										 
	    LCD_Fill(188,234,234,239,WHITE);//把多余的去掉	
		POINT_COLOR=RED;
		LCD_DrawRectangle(188,234,234,280);//画空的方框,第十六格
		LCD_DrawRectangle(4,4,234,234);    //画最大的红框

		for(i=0;i<size;i++)LCD_DrawLine(4,4+46*i,234,4+46*i);  //画内部横网格线
		for(i=0;i<size;i++)LCD_DrawLine(4+46*i,4,4+46*i,234);  //画内部竖网格线
	}	  		  								    	  		  
	LCD_DrawRectangle(2,241,79,318);//包括预览图片
	
	BACK_COLOR=WHITE;
	POINT_COLOR=BLUE;//画笔颜色
	Show_Str(81,242,"等级:",16,0x01);
	POINT_COLOR=RED;//画笔颜色
	if(size==3)Show_Str(121,242,"简单",16,0x01);
	else if(size==4)Show_Str(121,242,"一般",16,0x01);
	else Show_Str(121,242,"困难",16,0x01);
	POINT_COLOR=BLUE;//画笔颜色
	Show_Str(81,258,"步数:",16,0x01);
	Show_Str(81,274,"用时:",16,0x01);   
	GUI_Draw_Button(98,298,37,20,"退出",BLACK);		  					     
} 		 	 
コード例 #25
0
ファイル: stm32l1xx_it.c プロジェクト: Amna2013/stm32-test
/**
  * @brief  This function handles External lines 9 to 5 interrupt request.
  * @param  None
  * @retval None
  */
void EXTI9_5_IRQHandler(void)
{
  uint32_t tmp = 0, tmp1 = 0;
  uint8_t index = 0;
  if((EXTI_GetITStatus(LEFT_BUTTON_EXTI_LINE) != RESET) )
  {
    /* Set the LCD Back Color */
    LCD_SetBackColor(White);
    StartEvent = 0;
    /* Reset Counter*/
    RTCAlarmCount = 0;
    
    /* Disable the alarm */
    RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
    
    /* Display Char on the LCD : XXX% */
    LCD_DisplayChar(40,110,0x30);
    LCD_DisplayChar(40,88, 0x30);
    LCD_DisplayChar(40,66, 0x30);
    LCD_DisplayChar(40,44, 0x25);
    
    for (index = 0; index < 100 ; index++)
    {
      if ((index % 2) ==0)
      {
        /* Set the LCD Text Color */
        LCD_SetTextColor(Blue);
        LCD_DrawLine(70 + (index/2) , 120 - (index/2)  , 101 - (index + 1) ,Horizontal);
        /* Set the LCD Text Color */
        LCD_SetTextColor(White);
        LCD_DrawLine(170 - (index/2) , 120 - (index/2)  , 101 - (index + 1) ,Horizontal);
        
      }
    } 
    /* Displays MESSAGE6 on line 5 */
    LCD_SetFont(&Font12x12);
    /* Set the LCD Back Color */
    LCD_SetBackColor(Blue);
    LCD_SetTextColor(White);
    LCD_DisplayStringLine(LINE(19), (uint8_t *)MESSAGE6);
    LCD_SetFont(&Font16x24);
    /* Set the LCD Text Color */
    LCD_SetTextColor(Black); 
    
    /* Clear the LEFT EXTI  pending bit */
    EXTI_ClearITPendingBit(LEFT_BUTTON_EXTI_LINE);  
  }
  else if (EXTI_GetITStatus(RIGHT_BUTTON_EXTI_LINE) != RESET)
  {
    
    if(StartEvent == 8)
    {
      StartEvent = 0;
   
      /* Enable the alarmA */
      RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
      
      /* Clear the TAMPER EXTI  pending bit */
      EXTI_ClearITPendingBit(RIGHT_BUTTON_EXTI_LINE); 
      
      /* Displays MESSAGE4 on line 5 */
      LCD_SetFont(&Font12x12);
      /* Set the LCD Back Color */
      LCD_SetBackColor(Blue);
      LCD_SetTextColor(White);
      LCD_DisplayStringLine(LINE(19), (uint8_t *)MESSAGE4);
      LCD_SetFont(&Font16x24);
      /* Set the LCD Text Color */
      LCD_SetTextColor(Black); 
    }
    else
    {
      
      /* Displays MESSAGE5 on line 5 */
      LCD_SetFont(&Font12x12);
      
      /* Set the LCD Back Color */
      LCD_SetBackColor(Blue);
      LCD_SetTextColor(White);
      LCD_DisplayStringLine(LINE(19), (uint8_t *)MESSAGE5);
      LCD_SetFont(&Font16x24);
      /* Set the LCD Back Color */
      LCD_SetBackColor(White);
      
      /* Enable the alarmA */
      RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
      StartEvent = 8;
      /* Clear the LEFT EXTI  pending bit */
      EXTI_ClearITPendingBit(RIGHT_BUTTON_EXTI_LINE); 
    }
    
    
  }
  else if(EXTI_GetITStatus(DOWN_BUTTON_EXTI_LINE) != RESET)
  {
    
    if(RTCAlarmCount == 0)
    {
      SecondNumb--;
      if(SecondNumb < 15) SecondNumb = 15; 
      
      tmp = (uint32_t) (SecondNumb/60);
      tmp1 =   SecondNumb -(tmp*60);
      LCD_SetFont(&Font16x24); 
      /* Set the LCD text color */
      LCD_SetTextColor(Blue);
      /* Set the LCD Back Color */
      LCD_SetBackColor(White);
      LCD_DisplayStringLine(95,     "         ");  
      /* Display Char on the LCD : XXX% */       
      LCD_DisplayChar(95,294, (tmp / 10) +0x30);
      LCD_DisplayChar(95,278, (tmp  % 10 ) +0x30);
      LCD_DisplayChar(95,262, ':');
      LCD_DisplayChar(95,246, (tmp1 / 10) +0x30);
      LCD_DisplayChar(95,230, (tmp1  % 10 ) +0x30);
    }
    
    /* Clear the LEFT EXTI  pending bit */
    EXTI_ClearITPendingBit(DOWN_BUTTON_EXTI_LINE); 
    /* Clear the EXTI Line 8 */
    EXTI_ClearITPendingBit(EXTI_Line8);
  }
  
}
コード例 #26
0
ファイル: osc.c プロジェクト: izhaolei/stm32_osc
void OSC_Gui(u8 xdata,u8 ydata)
	{
	
	LCD_Clear(WHITE);
	delay_ms(1);	
	//这里需要修改
	LCD_ShowString(50,10,300,16,16,"X :   us/DIV Y :  V/DIV");
	switch(xdata)
		{
		 	case 0:
				LCD_ShowString(74,10,32,16,16,"2");
				xbujin=10;
				break;
			case 1:
				LCD_ShowString(74,10,32,16,16,"200");
				xbujin=0.1;
				break;
			default:
				LCD_ShowString(74,10,80,16,16,"20m ");
				xbujin=0.001;
				break;	
		}
		switch(ydata)
		{
		 	case 0:
				LCD_ShowString(170,10,32,16,16,"1");
				ybujin=10;
				break;
			case 1:
				LCD_ShowString(170,10,32,16,16,"0.1");
				ybujin=100;
				break;	
		}
	 //截止区
	 LCD_ShowString(50,220,100,16,16,"T:        ms");
	LCD_ShowxNum(68,220,TIM5CH1_CAPTURE_VAL,6,16,0);
	LCD_DrawVitalLine(20,30,20,210);	
	LCD_DrawVitalLine(40,30,40,210);
	LCD_DrawVitalLine(60,30,60,210);
	LCD_DrawVitalLine(80,30,80,210);
	LCD_DrawVitalLine(100,30,100,210);
	LCD_DrawVitalLine(120,30,120,210);
	LCD_DrawVitalLine(140,30,140,210);
	LCD_DrawLine(160,30,160,210);
	LCD_DrawVitalLine(180,30,180,210);
	LCD_DrawVitalLine(200,30,200,210);
	LCD_DrawVitalLine(220,30,220,210);
	LCD_DrawVitalLine(240,30,240,210);
	LCD_DrawVitalLine(260,30,260,210);
	LCD_DrawVitalLine(280,30,280,210);
	LCD_DrawVitalLine(300,30,300,210);
	LCD_DrawVitalLine(0,30,319,30);
	LCD_DrawVitalLine(0,50,319,50);
	LCD_DrawVitalLine(0,70,319,70);
	LCD_DrawVitalLine(0,90,319,90);
	LCD_DrawVitalLine(0,110,319,110);
	LCD_DrawLine(0,130,319,130);
	LCD_DrawVitalLine(0,150,319,150);
	LCD_DrawVitalLine(0,170,319,170);
	LCD_DrawVitalLine(0,190,319,190);
	LCD_DrawVitalLine(0,210,319,210); 

	}
コード例 #27
0
ファイル: guiEditBox.c プロジェクト: AndreyFursov/AFGUI
void EditBoxDraw(GUI_EDIT_BOX * pEditBox)
{
	int i;
	if (pEditBox->wmObj.Visible)
	{
		// Borders
		LCD_SetTextColor(pEditBox->wmObj.BorderColor);
		if (pEditBox->wmObj.BorderWidth)
		{
			if (pEditBox->wmObj.Visual3D == 1)
			{
				for (i = 0; i < pEditBox->wmObj.BorderWidth; i++)
				{
					LCD_SetTextColor(LCD_COLOR_GREYD);
					// Top Border
					LCD_DrawLine(pEditBox->wmObj.xPos, pEditBox->wmObj.yPos, pEditBox->wmObj.Width-i-1, LCD_DIR_HORIZONTAL);
					// Left Border
					LCD_DrawLine(pEditBox->wmObj.xPos, pEditBox->wmObj.yPos, pEditBox->wmObj.Height-i, LCD_DIR_VERTICAL);

					if (i == pEditBox->wmObj.BorderWidth-1 && pEditBox->wmObj.Color == LCD_COLOR_WHITE)
						LCD_SetTextColor(LCD_COLOR_GREYL);
					else
						LCD_SetTextColor(LCD_COLOR_WHITE);
					// Bottom Border
					LCD_DrawLine(pEditBox->wmObj.xPos+1+i, pEditBox->wmObj.yPos+pEditBox->wmObj.Height-i-1, pEditBox->wmObj.Width-i-2, LCD_DIR_HORIZONTAL);
					// Right Border
					LCD_DrawLine(pEditBox->wmObj.xPos+pEditBox->wmObj.Width-i-1, pEditBox->wmObj.yPos+i+1, pEditBox->wmObj.Height-i-2, LCD_DIR_VERTICAL);
				}
			}
			else
			{
				// Top Border
				LCD_DrawFillRect(pEditBox->wmObj.xPos, pEditBox->wmObj.yPos, pEditBox->wmObj.Width, pEditBox->wmObj.BorderWidth);
				// Left Border
				LCD_DrawFillRect(pEditBox->wmObj.xPos, pEditBox->wmObj.yPos, pEditBox->wmObj.BorderWidth, pEditBox->wmObj.Height);
				// Bottom Border
				LCD_DrawFillRect(pEditBox->wmObj.xPos, pEditBox->wmObj.yPos+pEditBox->wmObj.Height-pEditBox->wmObj.BorderWidth, pEditBox->wmObj.Width, pEditBox->wmObj.BorderWidth);
				// Right Border
				LCD_DrawFillRect(pEditBox->wmObj.xPos+pEditBox->wmObj.Width-pEditBox->wmObj.BorderWidth, pEditBox->wmObj.yPos, pEditBox->wmObj.BorderWidth, pEditBox->wmObj.Height);
			}
		}
		// Back
		if (pEditBox->wmObj.Transparent == 0)
		{
			LCD_SetTextColor(pEditBox->wmObj.Color);
			LCD_DrawFillRect(pEditBox->wmObj.xPos + pEditBox->wmObj.BorderWidth,
							pEditBox->wmObj.yPos + pEditBox->wmObj.BorderWidth,
							pEditBox->wmObj.Width - 2*pEditBox->wmObj.BorderWidth,
							pEditBox->wmObj.Height - 2*pEditBox->wmObj.BorderWidth
							);
		}
		// Text
		LCD_SetFont(pEditBox->wmTxt.vFont);
		if (pEditBox->wmObj.Enable)
			LCD_SetColors(pEditBox->wmTxt.TextColor, pEditBox->wmObj.Color);
		else
			LCD_SetColors(guiChangeColorLight(pEditBox->wmObj.Color, 120), pEditBox->wmObj.Color);

		LCD_DrawString(pEditBox->wmTxt.Text, pEditBox->wmTxt.TextLen, pEditBox->wmTxt.TextPosX, pEditBox->wmTxt.TextPosY);
	}
}
コード例 #28
0
ファイル: tslib.c プロジェクト: ShowerXu/Elink407Board
void Tp_Put_Cross(int x, int y, unsigned colidx)
{
	LCD_DrawLine (x - 10, y, x - 2, y, colidx);
	LCD_DrawLine (x + 2, y, x + 10, y, colidx);
	LCD_DrawLine (x, y - 10, x, y - 2, colidx);
	LCD_DrawLine (x, y + 2, x, y + 10, colidx);
	
	LCD_DrawLine (x - 6, y - 9, x - 9, y - 9, colidx + 1);
	LCD_DrawLine (x - 9, y - 8, x - 9, y - 6, colidx + 1);
	LCD_DrawLine (x - 9, y + 6, x - 9, y + 9, colidx + 1);
	LCD_DrawLine (x - 8, y + 9, x - 6, y + 9, colidx + 1);
	LCD_DrawLine (x + 6, y + 9, x + 9, y + 9, colidx + 1);
	LCD_DrawLine (x + 9, y + 8, x + 9, y + 6, colidx + 1);
	LCD_DrawLine (x + 9, y - 6, x + 9, y - 9, colidx + 1);
	LCD_DrawLine (x + 8, y - 9, x + 6, y - 9, colidx + 1);
}
コード例 #29
0
/*******************************************************************************
* Function Name  : LCD_Update
* Description    : Controls the wave player application LCD display messages.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void LCD_Update(uint32_t Status)
{
  uint8_t tmp = 0;
  uint32_t counter = 0;

  /* Enable the FSMC that share a pin w/ I2C1 (LBAR) */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);

  switch (Status)
  {
   case PROGRESS:
         tmp = (uint8_t) ((uint32_t)((GetVar_AudioDataIndex()) * 100) / GetVar_AudioDataLength());
         if (tmp == 0)
         { 
           LCD_SetTextColor(Magenta);
           LCD_ClearLine(Line8);
           LCD_DrawRect(Line8, 310, 16, 300);
         }
         else
         {
           LCD_SetTextColor(Magenta);
           LCD_DrawLine(Line8, 310 - (tmp * 3), 16, Vertical);
         }         
         break;
   case FRWD:
         tmp = (uint8_t) ((uint32_t)((GetVar_AudioDataIndex()) * 100) / GetVar_AudioDataLength());

         LCD_SetTextColor(Magenta);
         LCD_ClearLine(Line8);
         LCD_DrawRect(Line8, 310, 16, 300);
         LCD_SetTextColor(Magenta);

         for (counter = 0; counter <= tmp; counter++)
         {
           LCD_DrawLine(Line8, 310 - (counter * 3), 16, Vertical);
         }          
         break;
   case STOP:
         /* Display the stopped status menu */ 
         LCD_SetTextColor(White); 
         LCD_DisplayStringLine(Line3, CmdTitle1Stopped);
         LCD_DisplayStringLine(Line4, CmdTitle2Stopped);
         LCD_SetTextColor(Red);
         LCD_DisplayStringLine(Line6, StatusTitleStopped);
         LCD_ClearLine(Line9);
         LCD_SetTextColor(Black);
         LCD_DisplayChar(Line9, 250, 'v'); 
         LCD_DisplayChar(Line9, 235, 'o'); 
         LCD_DisplayChar(Line9, 220, 'l'); 
         LCD_DisplayChar(Line9, 200, '-'); 
         LCD_DisplayChar(Line9, 85, '+'); 
         LCD_DrawRect(Line9 + 8, 185, 10, 100); 
         break; 
   case PAUSE: 
         /* Display the paused status menu */ 
         LCD_SetTextColor(White);
         LCD_DisplayStringLine(Line3, CmdTitle1Paused);
         LCD_DisplayStringLine(Line4, CmdTitle2Paused);
         LCD_SetTextColor(Red);
         LCD_DisplayStringLine(Line6, StatusTitlePaused);
         break;
   case PLAY:
         /* Display the Titles */   
         LCD_SetTextColor(Black);
         LCD_DisplayStringLine(Line0, DemoTitle);
         LCD_DisplayStringLine(Line2, CmdTitle0); 

         /* Display the Playing status menu */ 
         LCD_SetTextColor(White);
         LCD_DisplayStringLine(Line3, CmdTitle1Playing);
         LCD_DisplayStringLine(Line4, CmdTitle2Playing);
         LCD_SetTextColor(Red);
         LCD_DisplayStringLine(Line6, StatusTitlePlaying);
         LCD_ClearLine(Line9);
         LCD_SetTextColor(Black);
         LCD_DisplayChar(Line9, 250, 'v'); 
         LCD_DisplayChar(Line9, 235, 'o'); 
         LCD_DisplayChar(Line9, 220, 'l'); 
         LCD_DisplayChar(Line9, 200, '-'); 
         LCD_DisplayChar(Line9, 85, '+'); 
         LCD_DrawRect(Line9 + 8, 185, 10, 100); 
         break;
   case ALL: 
         I2S_CODEC_LCDConfig();
         /* Display the stopped status menu */ 
         LCD_SetTextColor(White); 
         LCD_DisplayStringLine(Line3, CmdTitle1Stopped);
         LCD_DisplayStringLine(Line4, CmdTitle2Stopped);
         LCD_SetTextColor(Red);
         LCD_DisplayStringLine(Line6, StatusTitleStopped);
         LCD_ClearLine(Line9);
         LCD_SetTextColor(Black);
         LCD_DisplayChar(Line9, 250, 'v'); 
         LCD_DisplayChar(Line9, 235, 'o'); 
         LCD_DisplayChar(Line9, 220, 'l'); 
         LCD_DisplayChar(Line9, 200, '-'); 
         LCD_DisplayChar(Line9, 85, '+'); 
         LCD_DrawRect(Line9 + 8, 185, 10, 100); 
         break;
  }
  /* Update the volume bar in all cases except when progress bar is to be apdated */
  if (Status != PROGRESS)
  {
    /* Compute the current volume percentage */
    tmp = (uint8_t) ((uint16_t)((0xFF - GetVar_CurrentVolume()) * 100) / 0xFF) ;
 
    /* Clear the previuos volume bar */
    LCD_SetTextColor(Blue);
    LCD_DrawLine(Line9 + 10, 185 - previoustmp , 8, Vertical);
    LCD_DrawLine(Line9 + 10, 185 - previoustmp + 1 , 8, Vertical);    
 
    /* Draw the new volume bar */
    LCD_SetTextColor(Red);
    LCD_DrawLine(Line9 + 10, 185 - tmp , 8, Vertical);
    LCD_DrawLine(Line9 + 10, 185 - tmp + 1 , 8, Vertical);
 
    /* save the current position */
    previoustmp = tmp;
  }
  /* Disable the FSMC that share a pin w/ I2C1 (LBAR) */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, DISABLE);
}
int main(void)
{
	SystemInit();						// Configurações e inicialização do clock

	UB_LCD_Init();					// Inicialização LCD

	UB_LCD_LayerInit_Fullscreen();	// Inicialização da camadas da tela

	UB_LCD_SetLayer_1();				// Inicialização da camadas do fundo

	UB_LCD_FillLayer(RGB_COL_WHITE);	// Cor do fundo

	UB_LCD_SetLayer_2();				// Inicialização da camadas em primeiro plano

	UB_LCD_FillLayer(RGB_COL_WHITE);	// Cor do primeiro plano

	CurrentFrameBuffer=LCD_FRAME_BUFFER + LCD_FRAME_OFFSET;  // Variáveis de controle da tela
	aktColor=LCD_COLOR_BLUE;			// Variável para armazenar cor de preferência

	menu=0;							//Programa inicia no menu inicial

	if(UB_Touch_Init()!=SUCCESS)	// Verifica se a inicialização da tela sensível ao toque ocorreu corretamente
	{
		UB_Font_DrawString(10,28,"Touch error",&Arial_11x20,RGB_COL_WHITE,RGB_COL_RED);		//Imprime mensagem de erro
		UB_Font_DrawString(10,46,"Reconecte a energia",&Arial_11x20,RGB_COL_WHITE,RGB_COL_RED);
	while(1);						//Impede o progresso das demais rotinas
	}

	USB_HID_HOST_STATUS_t host_status;	// Variável para armazenar o estado da comunicação USB

	USB_Init();							// Inicializações para utilizar USB

	while(1){

	  LCD_DrawFullRect(0, 0, 240, 320, LCD_COLOR_BLACK);	// Imprime retângulo branco do tamanha da tela(apaga tudo)
	  imprimir_menu();										// Imprime grafismo do menu inicial

//--------------------------------------------------------------
	  while(menu==0)					// Enquanto menu==0 o programa fica no menu inicial
	  {

		  host_status=USB_Function();			// Esta função deve ser chamada periodicamente para o funcionamento do teclado

		  if(host_status!=USB_HID_DEV_DETACHED)	// Se o USB não tiver sido desconectado
			  menu = arrow_function();			// Chama função que controla o selecionamento do menu

		  UB_Touch_Read();						// Lê informações do touch
		  if(Touch_Data.status==TOUCH_PRESSED) {
			  if((Touch_Data.yp < 130) && (Touch_Data.yp >= 70)) {			// Verifica limites da região de um botão touch na tela
				  if((Touch_Data.xp < 215) && (Touch_Data.xp > 45)) {
					  menu=1;												// Se o toque ocorreu muda o estado do programa
				  }
			  }
		  }

		  if(Touch_Data.status==TOUCH_PRESSED) {
			  if((Touch_Data.yp < 260) && (Touch_Data.yp >= 200)) {			// Verifica limites da região de um botão touch na tela
				  if((Touch_Data.xp < 215) && (Touch_Data.xp > 45)) {
		 					  menu=2;												// Se o toque ocorreu muda o estado do programa
				  }
			  }
		  }

		  if(menu==1){							// menu==1 equivale ao modo de Digitação
			  pos.x = 10;						// Posições onde o cursor de digitação começa
			  pos.y = 10;
			  LCD_DrawFullRect(0, 0, 240, 320, LCD_COLOR_WHITE);	// Imprime retângulo branco do tamanha da tela(apaga tudo)
		  }
		  if(menu==2){							// menu==2 equivale ao modo de Opções
			  LCD_DrawFullRect(0, 0, 240, 320, LCD_COLOR_WHITE);	// Imprime retângulo branco do tamanha da tela(apaga tudo)
			  UB_Font_DrawString(10,10,"Cor do texto",&Arial_11x20,aktColor,RGB_COL_WHITE);		//Imprime mensagem
		  }
	  }

	  while(menu==1)							// menu==1 equivale ao modo de Digitação
	  {
		host_status=USB_Function();				//Esta função deve ser chamada periodicamente para o funcionamento do teclado

		UB_Touch_Read();						//Leitura do Touch
		LCD_DrawLine(pos.x,pos.y, 20, LCD_DIR_VERTICAL, RGB_COL_WHITE);
		if(Touch_Data.status==TOUCH_PRESSED) {
			if((Touch_Data.yp < 317) && (Touch_Data.yp >= 3)) {		// Verifica se touch foi na tela( para evitar erros}
				if((Touch_Data.xp < 237) && (Touch_Data.xp > 3)) {
					pos.x=Touch_Data.xp;							// Posiciona o cursor sobre o local tocado
					pos.y=Touch_Data.yp;
					LCD_DrawLine(pos.x,pos.y, 20, LCD_DIR_VERTICAL, RGB_COL_WHITE);
				}
			}

		}

		if(host_status!=USB_HID_DEV_DETACHED)		//Se o USB não tiver sido desconectado
			pos = key_function(pos);				//Interpreta todas teclas e funções do teclado, retorna posição do cursor

		if(host_status==USB_HID_DEV_CONNECTED)		//Se o USB for reconectado
			LCD_DrawFullRect(0, 302, 240, 320, LCD_COLOR_WHITE);	//Apaga mensagem pedindo para conectar

		if(host_status==USB_HID_DEV_DETACHED)		//Se o USB for desconectado
			UB_Font_DrawString(10,302,"Teclado desconectado",&Arial_11x20,RGB_COL_RED,RGB_COL_WHITE);	//Imprime mensagem
	  }
	  while(menu==2)							// menu==2 equivale ao modo de Opções
	  {
		  host_status=USB_Function();			//Esta função deve ser chamada periodicamente para o funcionamento do teclado

		  if(host_status!=USB_HID_DEV_DETACHED)	//Se o USB não tiver sido desconectado
			  menu = opcoes();

	  }
	}
}