Ejemplo n.º 1
0
static void
on_config_font_set_changed(GSettings *settings, const char *key)
{
	/* update application to reflect new value */
	I7App *theapp = i7_app_get();
	update_font(GTK_WIDGET(theapp->prefs->source_example));
	update_font(GTK_WIDGET(theapp->prefs->tab_example));
	i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_fonts, NULL);
}
Ejemplo n.º 2
0
static void
on_config_custom_font_changed(GSettings *settings, const char *key)
{
	/* update application to reflect new value */
	I7App *theapp = i7_app_get();
	GSettings *prefs = i7_app_get_prefs(theapp);
	if(g_settings_get_enum(prefs, PREFS_FONT_SET) == FONT_CUSTOM) {
		update_font(GTK_WIDGET(theapp->prefs->source_example));
		update_font(GTK_WIDGET(theapp->prefs->tab_example));
		i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_fonts, NULL);
	}
}
Ejemplo n.º 3
0
int main(void)
{
	u8 key,fontok=0; 
   	Stm32_Clock_Init(9);	//系统时钟设置
	delay_init(72);			//延时初始化
	uart_init(72,115200); 	//串口1初始化 
	LCD_Init();				//初始化液晶 
	LED_Init();         	//LED初始化	 
	KEY_Init();				//按键初始化	 
	usmart_dev.init(72);	//usmart初始化	
 	USART2_Init(36,115200);	//初始化串口2 
	TP_Init();				//初始化触摸屏
	mem_init(SRAMIN);		//初始化内部内存池	    
 	exfuns_init();			//为fatfs相关变量申请内存  
  	f_mount(0,fs[0]); 		//挂载SD卡 
	key=KEY_Scan(0);  
	if(key==KEY_RIGHT)		//强制校准
	{
		LCD_Clear(WHITE);	//清屏
		TP_Adjust();  		//屏幕校准 
		TP_Save_Adjdata();	  
		LCD_Clear(WHITE);	//清屏
	}
	fontok=font_init();		//检查字库是否OK
	if(fontok||key==KEY_DOWN)//需要更新字库				 
	{
		LCD_Clear(WHITE);		   	//清屏
 		POINT_COLOR=RED;			//设置字体为红色	   	   	  
		LCD_ShowString(60,50,200,16,16,"ALIENTEK STM32");
		while(SD_Initialize())		//检测SD卡
		{
			LCD_ShowString(60,70,200,16,16,"SD Card Failed!");
			delay_ms(200);
			LCD_Fill(60,70,200+60,70+16,WHITE);
			delay_ms(200);		    
		}								 						    
		LCD_ShowString(60,70,200,16,16,"SD Card OK");
		LCD_ShowString(60,90,200,16,16,"Font Updating...");
		key=update_font(20,110,16,0);//从SD卡更新
		while(key)//更新失败		
		{			 		  
			LCD_ShowString(60,110,200,16,16,"Font Update Failed!");
			delay_ms(200);
			LCD_Fill(20,110,200+20,110+16,WHITE);
			delay_ms(200);		       
		} 		  
		LCD_ShowString(60,110,200,16,16,"Font Update Success!");
		delay_ms(1500);	
		LCD_Clear(WHITE);//清屏	       
	}  
	sim900a_test();
}
Ejemplo n.º 4
0
void Sys_Init(void)
{
	u8 key,fontok=0;  
	Stm32_Clock_Init(9);	//系统时钟设置
	delay_init(72);			//延时初始化
	uart_init(72,115200); 	//串口1初始化 
	LCD_Init();				//初始化液晶 
	LED_Init();         	//LED初始化	 
	KEY_Init();				//按键初始化	 	
 	USART2_Init(36,115200);	//初始化串口2 
	mem_init();		        //初始化内部内存池	    
 	exfuns_init();			//为fatfs相关变量申请内存  
    f_mount(fs[0],"0:",1); 	//挂载SD卡  
	key = KEY_Scan(0);  
	fontok = font_init();		//检查字库是否OK
	if(fontok||key == KEY1_PRES)//需要更新字库 (KEY1按下或字库丢失)				 
	{
		LCD_Clear(WHITE);		   	//清屏
 		POINT_COLOR=RED;			//设置字体为红色	   	   	  
		LCD_ShowString(70,50,200,16,16,"GSM  TEST");
		while(SD_Initialize())		//检测SD卡
		{
			LCD_ShowString(60,70,200,16,16,"SD Card Failed!");
			delay_ms(200);
			LCD_Fill(60,70,200+60,70+16,WHITE);
			delay_ms(200);		    
		}								 						    
		LCD_ShowString(60,70,200,16,16,"SD Card OK");
		LCD_ShowString(60,90,200,16,16,"Font Updating...");
		key = update_font(20,110,16);    //更新字库
		while(key)  //更新失败		
		{			 		  
			LCD_ShowString(60,110,200,16,16,"Font Update Failed!");
			delay_ms(200);
			LCD_Fill(20,110,200+20,110+16,WHITE);
			delay_ms(200);		       
		} 		  
		LCD_ShowString(60,110,200,16,16,"Font Update Success!");
		delay_ms(1500);	
		LCD_Clear(WHITE);//清屏	       
	} 
}
 int main(void)
 { 
	u32 fontcnt;		  
	u8 i,j;
	u8 fontx[2];//gbk码
	u8 key,t;			 
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);// 设置中断优先级分组2 
	delay_init();	    	 //延时函数初始化	  
	uart_init(9600);	 	//串口初始化为9600			 
	LCD_Init();			//初始化液晶 
	LED_Init();         //LED初始化	 													    
	KEY_Init();				//按键初始化	  													    
	usmart_dev.init(72);	//usmart初始化	
 	mem_init();				//初始化内存池	    
 	exfuns_init();			//为fatfs相关变量申请内存  
  f_mount(fs[0],"0:",1); 	//挂载SD卡 
 	f_mount(fs[1],"1:",1); 	//挂载FLASH.
	while(font_init()) 	//检查字库
	{
UPD:    
		LCD_Clear(WHITE);		   	//清屏
 		POINT_COLOR=RED;			//设置字体为红色	   	   	  
		LCD_ShowString(60,50,200,16,16,"mini STM32");
		while(SD_Initialize())		//检测SD卡
		{
			LCD_ShowString(60,70,200,16,16,"SD Card Failed!");
			delay_ms(200);
			LCD_Fill(60,70,200+60,70+16,WHITE);
			delay_ms(200);		    
		}								 						    
		LCD_ShowString(60,70,200,16,16,"SD Card OK");
		LCD_ShowString(60,90,200,16,16,"Font Updating...");
	 	key=update_font(20,110,16);//更新字库
		while(key)//更新失败		
		{			 		  
			LCD_ShowString(60,110,200,16,16,"Font Update Failed!");
			delay_ms(200);
			LCD_Fill(20,110,200+20,110+16,WHITE);
			delay_ms(200);		       
		} 		  
		LCD_ShowString(60,110,200,16,16,"Font Update Success!");
		delay_ms(1500);	
		LCD_Clear(WHITE);//清屏	       
	}  
	POINT_COLOR=RED;       
	Show_Str(60,50,200,16,"Mini STM32开发板",16,0);				    	 
	Show_Str(60,70,200,16,"GBK字库测试程序",16,0);				    	 
	Show_Str(60,90,200,16,"正点原子@ALIENTEK",16,0);				    	 
	Show_Str(60,110,200,16,"2014年1月3日",16,0);
	Show_Str(60,130,200,16,"按KEY0,更新字库",16,0);
 	POINT_COLOR=BLUE;  
	Show_Str(60,150,200,16,"内码高字节:",16,0);				    	 
	Show_Str(60,170,200,16,"内码低字节:",16,0);				    	 
	Show_Str(60,190,200,16,"汉字计数器:",16,0);

	Show_Str(60,220,200,24,"对应汉字为:",24,0); 
	Show_Str(60,244,200,16,"对应汉字(16*16)为:",16,0);			 
	Show_Str(60,260,200,12,"对应汉字(12*12)为:",12,0);			 
	while(1)
	{
		fontcnt=0;
		for(i=0x81;i<0xff;i++)
		{		
			fontx[0]=i;
			LCD_ShowNum(148,150,i,3,16);		//显示内码高字节    
			for(j=0x40;j<0xfe;j++)
			{
				if(j==0x7f)continue;
				fontcnt++;
				LCD_ShowNum(148,170,j,3,16);	//显示内码低字节	 
				LCD_ShowNum(148,190,fontcnt,5,16);//汉字计数显示	 
			 	fontx[1]=j;
				Show_Font(60+132,220,fontx,24,0);	  
				Show_Font(60+144,244,fontx,16,0);	  		 		 
				Show_Font(60+108,260,fontx,12,0);	  		 		 
				t=200;
				while(t--)//延时,同时扫描按键
				{
					delay_ms(1);
					key=KEY_Scan(0);
					if(key==KEY0_PRES)goto UPD;
				}
				LED0=!LED0;
			}   
		}	
	} 
}
Ejemplo n.º 6
0
int main(void)
{
    u32 fontcnt;
    u8 i,j;
    u8 fontx[2];//gbk码
    u8 key,t;

    delay_init();	    	 //延时函数初始化
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
    uart_init(115200);	 	//串口初始化为115200
    usmart_dev.init(72);		//初始化USMART
    LED_Init();		  			//初始化与LED连接的硬件接口
    KEY_Init();					//初始化按键
    LCD_Init();			   		//初始化LCD
    W25QXX_Init();				//初始化W25Q128
    my_mem_init(SRAMIN);		//初始化内部内存池
    exfuns_init();				//为fatfs相关变量申请内存
    f_mount(fs[0],"0:",1); 		//挂载SD卡
    f_mount(fs[1],"1:",1); 		//挂载FLASH.
    while(font_init()) 			//检查字库
    {
        LCD_Clear(WHITE);		   	//清屏
        POINT_COLOR=RED;			//设置字体为红色
        LCD_ShowString(30,50,200,16,16,"WarShip STM32");
        while(SD_Init())			//检测SD卡
        {
            LCD_ShowString(30,70,200,16,16,"SD Card Failed!");
            delay_ms(200);
            LCD_Fill(30,70,200+30,70+16,WHITE);
            delay_ms(200);
        }
        LCD_ShowString(30,70,200,16,16,"SD Card OK");
        LCD_ShowString(30,90,200,16,16,"Font Updating...");
        key=update_font(20,110,16,"0:");//更新字库
        while(key)//更新失败
        {
            LCD_ShowString(30,110,200,16,16,"Font Update Failed!");
            delay_ms(200);
            LCD_Fill(20,110,200+20,110+16,WHITE);
            delay_ms(200);
        }
        LCD_ShowString(30,110,200,16,16,"Font Update Success!   ");
        delay_ms(1500);
        LCD_Clear(WHITE);//清屏
    }
    POINT_COLOR = MAGENTA;
    Show_Str(20,20,200,24,"第十一届全国电子",24,0);
    Show_Str(80,50,200,24,"设计大赛",24,0);

    POINT_COLOR = BLUE;
    Show_Str(60,80,200,24,"武昌首义学院",24,0);
    Show_Str(30,130,200,24,"参赛题目课题:",24,0);
    Show_Str(45,160,200,24,"旋转倒立摆",24,0);

    Show_Str(30,210,200,24,"参赛者:李观称",24,0);
    Show_Str(45,240,200,24,"赖丽清,张建",24,0);

    while(1)
    {
        fontcnt=0;
        for(i=0x81; i<0xff; i++)
        {
            fontx[0]=i;
//			LCD_ShowNum(118,150,i,3,16);		//显示内码高字节
            for(j=0x40; j<0xfe; j++)
            {
                if(j==0x7f)continue;
                fontcnt++;
//				LCD_ShowNum(118,170,j,3,16);	//显示内码低字节
//				LCD_ShowNum(118,190,fontcnt,5,16);//汉字计数显示
//			 	fontx[1]=j;
//				Show_Font(30+132,220,fontx,24,0);
//				Show_Font(30+144,244,fontx,16,0);
//				Show_Font(30+108,260,fontx,12,0);
                t=200;
                while(t--)//延时,同时扫描按键
                {
                    delay_ms(1);
                }
                LED0=!LED0;
            }
        }
    }
}
Ejemplo n.º 7
0
 void set_angle(double angle)
 {
   angle_ = (angle / 360 ) * 3.14159 * 2;
   update_font();
 }
Ejemplo n.º 8
0
GtkWidget *
font_color_prefs_show(void)
{
  GtkWidget     *main_vb, *main_grid, *label, *combo_box;
  GtkWidget     *font_sample, *color_sample, *colorsel;
  static const gchar   *mt[] = {
    "Marked packet foreground",          /* MFG_IDX 0*/
    "Marked packet background",          /* MBG_IDX 1*/
    "Ignored packet foreground",         /* IFG_IDX 2*/
    "Ignored packet background",         /* IBG_IDX 3*/
    "'Follow Stream' client foreground", /* CFG_IDX 4*/
    "'Follow Stream' client background", /* CBG_IDX 5*/
    "'Follow Stream' server foreground", /* SFG_IDX 6*/
    "'Follow Stream' server background", /* SBG_IDX 7*/
    "Valid filter text entry",           /* FTV_IDX 8*/
    "Invalid filter text entry",         /* FTI_IDX 9*/
    "Deprecated filter text entry"       /* FTD_IDX 10*/
  };
  int            mcount = sizeof(mt) / sizeof (gchar *);
  GtkTextBuffer *buf;
  GtkTextIter    iter;
  GRand         *rand_state     = g_rand_new();
  GString       *preview_string = g_string_new("");
  int            i;

#define GRID_FONT_ROW      0
#define GRID_COLOR_ROW     1
#define GRID_COLOR_SEL_ROW 3

  /* The font hasn't been changed yet. */
  font_changed = FALSE;

  color_t_to_gdkxxx(&tcolors[MFG_IDX], &prefs.gui_marked_fg);
  color_t_to_gdkxxx(&tcolors[MBG_IDX], &prefs.gui_marked_bg);
  color_t_to_gdkxxx(&tcolors[IFG_IDX], &prefs.gui_ignored_fg);
  color_t_to_gdkxxx(&tcolors[IBG_IDX], &prefs.gui_ignored_bg);
  color_t_to_gdkxxx(&tcolors[CFG_IDX], &prefs.st_client_fg);
  color_t_to_gdkxxx(&tcolors[CBG_IDX], &prefs.st_client_bg);
  color_t_to_gdkxxx(&tcolors[SFG_IDX], &prefs.st_server_fg);
  color_t_to_gdkxxx(&tcolors[SBG_IDX], &prefs.st_server_bg);
  color_t_to_gdkxxx(&tcolors[FTV_IDX], &prefs.gui_text_valid);
  color_t_to_gdkxxx(&tcolors[FTI_IDX], &prefs.gui_text_invalid);
  color_t_to_gdkxxx(&tcolors[FTD_IDX], &prefs.gui_text_deprecated);
  color_t_to_gdkxxx(&filter_text_fg, &filter_text_fg_color);

#if ! GTK_CHECK_VERSION(3,4,0)
  for (i=0; i<MAX_IDX; i++) {
    tcolors_orig[i] = tcolors[i];
  }
#endif

  curcolor = &tcolors[CFG_IDX];

  /* Enclosing containers for each row of widgets */
  main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE);
  gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5);

  main_grid = ws_gtk_grid_new();
  gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
  ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 40);
  ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 15);
  gtk_widget_show(main_grid);

  label = gtk_label_new("Main window font:");
  gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
  ws_gtk_grid_attach_extended(GTK_GRID(main_grid), label,
                              0, GRID_FONT_ROW, 1, 1,
                              (GtkAttachOptions)(GTK_EXPAND|GTK_FILL), (GtkAttachOptions)0, 0, 0);
  gtk_widget_show(label);

  font_button = gtk_font_button_new_with_font(prefs.gui_gtk2_font_name);
  gtk_font_button_set_title(GTK_FONT_BUTTON(font_button), "Wireshark: Font");
  ws_gtk_grid_attach(GTK_GRID(main_grid), font_button,
                     1, GRID_FONT_ROW, 1, 1);
  gtk_widget_show(font_button);

  g_string_printf(preview_string, " %s 0123456789",
                  font_pangrams[g_rand_int_range(rand_state, 0, NUM_FONT_PANGRAMS)]);

  font_sample = gtk_text_view_new();
  gtk_text_view_set_editable(GTK_TEXT_VIEW(font_sample), FALSE);
  buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(font_sample));
  gtk_text_buffer_get_start_iter(buf, &iter);
  srand((unsigned int) time(NULL));
  gtk_text_buffer_insert(buf, &iter, preview_string->str, -1);
  ws_gtk_grid_attach_extended(GTK_GRID(main_grid), font_sample,
                              2, GRID_FONT_ROW, 1, 1,
                              (GtkAttachOptions)(GTK_EXPAND|GTK_FILL), (GtkAttachOptions)0, 0, 0);
  g_signal_connect(font_button, "font-set", G_CALLBACK(select_font), NULL);
  gtk_widget_show(font_sample);

  g_string_free(preview_string, TRUE);
  g_object_set_data(G_OBJECT(font_button), FONT_SAMPLE_KEY, font_sample);

  label = gtk_label_new("Colors:");
  gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
  ws_gtk_grid_attach_extended(GTK_GRID(main_grid), label,
                              0, GRID_COLOR_ROW, 1, 1,
                              (GtkAttachOptions)(GTK_EXPAND|GTK_FILL), (GtkAttachOptions)0, 0,0);
  gtk_widget_show(label);

  /* We have to create this now, and configure it below. */

#if GTK_CHECK_VERSION(3,4,0)
  /* XXX: There appears to be a bug in the GTK3 GtkColorChooserWidget such that
   *  when in the GtkColorChooserWidget "customize" mode (aka "color-edit" mode)
   *  selecting a color doesn't trigger a "motify::rgba" callback.
   *  The effect is that the sample text FG/BG colors don't update for the GTK3
   *  GtkColorChooserWidget in "custon color edit node").
   *  I expect use of the "customize mode" will be minimal and that the bug will
   *  not be very noticeable.
   *  (A GTK3 bug report has beem submitted.
   */
#endif
  colorsel = gtk_color_xxx_new();

  combo_box = gtk_combo_box_text_new();
  for (i = 0; i < mcount; i++){
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), mt[i]);
  }
  gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), CFG_IDX);
  g_signal_connect(combo_box, "changed", G_CALLBACK(update_current_color), colorsel);
  ws_gtk_grid_attach(GTK_GRID(main_grid), combo_box,
                     1, GRID_COLOR_ROW, 1, 1);

  gtk_widget_show(combo_box);

  color_sample = gtk_text_view_new();
  update_font(user_font_get_regular(), font_sample, color_sample);
  gtk_text_view_set_editable(GTK_TEXT_VIEW(color_sample), FALSE);
  buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(color_sample));
  gtk_text_buffer_get_start_iter(buf, &iter);

  gtk_text_buffer_create_tag(buf, "marked",
                             TAG_PROP_FG_COLOR, &tcolors[MFG_IDX],
                             TAG_PROP_BG_COLOR, &tcolors[MBG_IDX],
                             NULL);
  gtk_text_buffer_create_tag(buf, "ignored",
                             TAG_PROP_FG_COLOR, &tcolors[IFG_IDX],
                             TAG_PROP_BG_COLOR, &tcolors[IBG_IDX],
                             NULL);
  gtk_text_buffer_create_tag(buf, "client",
                             TAG_PROP_FG_COLOR, &tcolors[CFG_IDX],
                             TAG_PROP_BG_COLOR, &tcolors[CBG_IDX],
                             NULL);
  gtk_text_buffer_create_tag(buf, "server",
                             TAG_PROP_FG_COLOR, &tcolors[SFG_IDX],
                             TAG_PROP_BG_COLOR, &tcolors[SBG_IDX],
                             NULL);
  gtk_text_buffer_create_tag(buf, "text_valid",
                             TAG_PROP_FG_COLOR, &filter_text_fg,
                             TAG_PROP_BG_COLOR, &tcolors[FTV_IDX],
                             NULL);
  gtk_text_buffer_create_tag(buf, "text_invalid",
                             TAG_PROP_FG_COLOR, &filter_text_fg,
                             TAG_PROP_BG_COLOR, &tcolors[FTI_IDX],
                             NULL);
  gtk_text_buffer_create_tag(buf, "text_deprecated",
                             TAG_PROP_FG_COLOR, &filter_text_fg,
                             TAG_PROP_BG_COLOR, &tcolors[FTD_IDX],
                             NULL);

  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_MARKED_TEXT,  -1,
                                           "marked", NULL);
  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_IGNORED_TEXT, -1,
                                           "ignored", NULL);
  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_CLIENT_TEXT,  -1,
                                           "client", NULL);
  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_SERVER_TEXT,  -1,
                                           "server", NULL);
  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_VALID_TEXT,  -1,
                                           "text_valid", NULL);
  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_INVALID_TEXT,  -1,
                                           "text_invalid", NULL);
  gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_DEPRECATED_TEXT,  -1,
                                           "text_deprecated", NULL);

  ws_gtk_grid_attach_extended(GTK_GRID(main_grid), color_sample,
                              2, GRID_COLOR_ROW, 1, 2,
                              (GtkAttachOptions)(GTK_EXPAND|GTK_FILL), (GtkAttachOptions)0, 0, 0);
  gtk_widget_show(color_sample);

  gtk_color_xxx_set_yyy(GTK_COLOR_XXX(colorsel), curcolor);
  ws_gtk_grid_attach_extended(GTK_GRID(main_grid), colorsel,
                              1, GRID_COLOR_SEL_ROW, 2, 1,
                              (GtkAttachOptions)(GTK_FILL|GTK_EXPAND), (GtkAttachOptions)0, 0, 0);

  g_object_set_data(G_OBJECT(combo_box), COLOR_SAMPLE_KEY, color_sample);
  g_object_set_data(G_OBJECT(colorsel),  COLOR_SAMPLE_KEY, color_sample);
  g_signal_connect(colorsel, COLOR_CHANGED_SIGNAL, G_CALLBACK(update_text_color), NULL);
  gtk_widget_show(colorsel);

  g_rand_free(rand_state);
  gtk_widget_show(main_vb);
  return main_vb;
}
Ejemplo n.º 9
0
 int main(void)
 {	 
	//定义全局变量
	u8 key,mode;
	u16 t=0;			 
	u8 tmp_buf[33];	

	 
	//函数初始化
	delay_init();	    	 //延时函数初始化	  
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
	uart_init(115200);	 	//串口初始化为115200
 	usmart_dev.init(72);		//初始化USMART	
	LED_Init();		  			//初始化与LED连接的硬件接口
	KEY_Init();					//初始化按键
	
	NRF24L01_Init();    		//初始化NRF24L01 
	 
	W25QXX_Init();				//初始化W25Q128
	my_mem_init(SRAMIN);		//初始化内部内存池
	LCD_Init();			   		//初始化LCD 
	exfuns_init();				//为fatfs相关变量申请内存  
 	f_mount(fs[0],"0:",1); 		//挂载SD卡 
 	f_mount(fs[1],"1:",1); 		//挂载FLASH.	 
 
	//检查中文字库
	while(font_init()) 			//检查字库
	{
		LCD_Clear(WHITE);		   	//清屏
 		POINT_COLOR=RED;			//设置字体为红色	   	   	  
		LCD_ShowString(30,50,200,16,16,"WarShip STM32");
		while(SD_Init())			//检测SD卡
		{
			LCD_ShowString(30,70,200,16,16,"SD Card Failed!");
			delay_ms(200);
			LCD_Fill(30,70,200+30,70+16,WHITE);
			delay_ms(200);		    
		}								 						    
		LCD_ShowString(30,70,200,16,16,"SD Card OK");
		LCD_ShowString(30,90,200,16,16,"Font Updating...");
		key=update_font(20,110,16,"0:");//更新字库
		while(key)//更新失败		
		{			 		  
			LCD_ShowString(30,110,200,16,16,"Font Update Failed!");
			delay_ms(200);
			LCD_Fill(20,110,200+20,110+16,WHITE);
			delay_ms(200);		       
		} 		  
		LCD_ShowString(30,110,200,16,16,"Font Update Success!   ");
		delay_ms(1500);	
		LCD_Clear(WHITE);//清屏	       
	}  
	
	//检查无线通信
	while(NRF24L01_Check())
	{
		LCD_ShowString(30,130,200,16,16,"NRF24L01 Error");
		delay_ms(200);
		LCD_Fill(30,130,239,130+16,WHITE);
 		delay_ms(200);
	}

	//初始化界面
	POINT_COLOR = MAGENTA; 
	Show_Str(20,20,200,24,"第十一届全国电子",24,0);
	Show_Str(80,50,200,24,"设计大赛",24,0);	
	
 	while(1)
	{	
		//按键扫描
		key=KEY_Scan(0);
		
		if(key!=0)
		{
			LCD_Clear(WHITE);
			Show_Str(60,20,200,24,"旋转倒立摆",24,0);
			Show_Str(20,50,200,24,"任务1:",24,0);
			Show_Str(20,80,200,24,"任务2:",24,0);
			Show_Str(20,110,200,24,"任务3:",24,0);
			Show_Str(20,140,200,24,"任务4:",24,0);
			Show_Str(20,170,200,24,"任务5:",24,0);
			Show_Str(20,200,200,24,"任务6:",24,0);
			
			while(1)
			{
				key=KEY_Scan(0);
				//WKUP_PRES  功能:返回主界面
				if(key==WKUP_PRES)
				{
					MUSE_TASK();
				}
				
				//KEY1_PRES 功能:执行任务1
				else if(key==KEY0_PRES)
				{
					KEY0_TASK();
				}
//				//KEY1_PRES 功能:执行任务1
//				else if(key==KEY1_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY2_PRES 功能:执行任务2
//				else if(key==KEY2_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY3_PRES 功能:执行任务3
//				else if(key==KEY3_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY4_PRES 功能:执行任务4
//				else if(key==KEY4_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY5_PRES 功能:执行任务5
//				else if(key==KEY5_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY6_PRES 功能:执行任务6
//				else if(key==KEY6_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY7_PRES 功能:执行任务7
//				else if(key==KEY7_PRES)
//				{
//					mode=1;
//					break;
//				}
//				//KEY8_PRES 功能:执行任务8
//				else if(key==KEY8_PRES)
//				{
//					mode=1;
//					break;
//				}
//				
			}
		}
		
		t++;
		if(t==100)
			//LCD_ShowString(10,150,230,16,16,"KEY0:RX_Mode  KEY1:TX_Mode"); //闪烁显示提示信息
			Show_Str(10,150,230,24,"按任意键进入主菜单",24,0);
 		if(t==200)
		{	
			LCD_Fill(10,150,240,150+50,WHITE);
			t=0; 
		}
		delay_ms(5);
	} 
}	
Ejemplo n.º 10
0
void console_widget_t::set_font_name(int new_name)
{
	font_name = new_name;
	update_font();
}
Ejemplo n.º 11
0
void console_widget_t::set_font_size(int new_size)
{
	font_size = new_size;
	update_font();
}