Browse Source

add more UI files into radio.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@151 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 15 years ago
parent
commit
eb24e9da00
4 changed files with 21 additions and 58 deletions
  1. 5 46
      bsp/stm32_radio/application.c
  2. 1 1
      bsp/stm32_radio/board.c
  3. 2 2
      bsp/stm32_radio/gui.c
  4. 13 9
      bsp/stm32_radio/lcd.c

+ 5 - 46
bsp/stm32_radio/application.c

@@ -46,44 +46,6 @@
 #include <rtgui/rtgui_system.h>
 #include <rtgui/rtgui_system.h>
 #endif
 #endif
 
 
-/*
-key_enter   PA0
-key_down    PA1
-key_up      PA2
-key_right   PC2
-key_left    PC3
-*/
-#define key_enter_GETVALUE()  GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)
-#define key_down_GETVALUE()   GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_1)
-#define key_up_GETVALUE()     GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_2)
-#define key_right_GETVALUE()  GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_2)
-#define key_left_GETVALUE()   GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_3)
-
-void rt_key_entry(void *parameter)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
-
-    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC,ENABLE);
-
-    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IPU;
-    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
-    GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2;
-    GPIO_Init(GPIOA,&GPIO_InitStructure);
-
-    GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_2 | GPIO_Pin_3;
-    GPIO_Init(GPIOC,&GPIO_InitStructure);
-
-    while (1)
-    {
-        if ( key_enter_GETVALUE() == 0 )rt_kprintf("key_enter\r\n");
-        if ( key_down_GETVALUE()  == 0 )rt_kprintf("key_down\r\n");
-        if ( key_up_GETVALUE()    == 0 )rt_kprintf("key_up\r\n");
-        if ( key_right_GETVALUE() == 0 )rt_kprintf("key_right\r\n");
-        if ( key_left_GETVALUE()  == 0 )rt_kprintf("key_left\r\n");
-        rt_thread_delay(20);
-    }
-}
-
 /* thread phase init */
 /* thread phase init */
 void rt_init_thread_entry(void *parameter)
 void rt_init_thread_entry(void *parameter)
 {
 {
@@ -153,6 +115,9 @@ void rt_init_thread_entry(void *parameter)
 		rtgui_panel_register("main", &rect);
 		rtgui_panel_register("main", &rect);
 
 
 		rt_hw_lcd_init();
 		rt_hw_lcd_init();
+
+		info_init();
+		today_init();
 	}
 	}
 #endif
 #endif
 }
 }
@@ -174,14 +139,8 @@ int rt_application_init()
 #endif
 #endif
     if (init_thread != RT_NULL) rt_thread_startup(init_thread);
     if (init_thread != RT_NULL) rt_thread_startup(init_thread);
 
 
-    /* create keypad thread */
-    {
-        rt_thread_t key_tid;
-        key_tid = rt_thread_create("key",
-                                   rt_key_entry, RT_NULL,
-                                   512, 30, 5);
-        if (key_tid != RT_NULL) rt_thread_startup(key_tid);
-    }
+	rt_hw_key_init();
+
     return 0;
     return 0;
 }
 }
 
 

+ 1 - 1
bsp/stm32_radio/board.c

@@ -138,7 +138,7 @@ void rt_hw_timer_handler(void)
 /**
 /**
  * This function will initial STM32 Radio board.
  * This function will initial STM32 Radio board.
  */
  */
- extern void FSMC_SRAM_Init(void);
+extern void FSMC_SRAM_Init(void);
 void rt_hw_board_init()
 void rt_hw_board_init()
 {
 {
     NAND_IDTypeDef NAND_ID;
     NAND_IDTypeDef NAND_ID;

+ 2 - 2
bsp/stm32_radio/gui.c

@@ -182,8 +182,8 @@ static void rtgui_demo_workbench_entry(void* parameter)
 		struct rtgui_box *box = rtgui_box_create(RTGUI_VERTICAL, &rtgui_empty_rect);
 		struct rtgui_box *box = rtgui_box_create(RTGUI_VERTICAL, &rtgui_empty_rect);
 		struct rtgui_box *hbox = rtgui_box_create(RTGUI_HORIZONTAL, &rtgui_empty_rect);
 		struct rtgui_box *hbox = rtgui_box_create(RTGUI_HORIZONTAL, &rtgui_empty_rect);
 		struct rtgui_button* button = rtgui_button_create("OK");
 		struct rtgui_button* button = rtgui_button_create("OK");
-		struct rtgui_textbox *textbox = rtgui_textbox_create("ąŕź­żň");
-		struct rtgui_iconbox *iconbox = rtgui_iconbox_create(image, "Íźąę",
+		struct rtgui_textbox *textbox = rtgui_textbox_create("text edit box");
+		struct rtgui_iconbox *iconbox = rtgui_iconbox_create(image, "icon",
 			RTGUI_ICONBOX_TEXT_RIGHT);
 			RTGUI_ICONBOX_TEXT_RIGHT);
 
 
 		RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = RTGUI_RGB(255, 255, 224);
 		RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = RTGUI_RGB(255, 255, 224);

+ 13 - 9
bsp/stm32_radio/lcd.c

@@ -40,14 +40,14 @@ void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
     unsigned short p;
     unsigned short p;
 
 
 	/* get color pixel */
 	/* get color pixel */
-	p = rtgui_color_to_565(*c);
+	p = rtgui_color_to_565p(*c);
 
 
 	/* set X point */
 	/* set X point */
     LCD_ADDR = 0x02;
     LCD_ADDR = 0x02;
     LCD_DATA = x;
     LCD_DATA = x;
-	
+
 	/* set Y point */
 	/* set Y point */
-    LCD_ADDR = 0x03; 
+    LCD_ADDR = 0x03;
     LCD_DATA16(y);
     LCD_DATA16(y);
 
 
 	/* write pixel */
 	/* write pixel */
@@ -57,17 +57,21 @@ void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
 
 
 void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
 void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
 {
 {
+    unsigned short p;
+
 	/* set X point */
 	/* set X point */
     LCD_ADDR = 0x02;
     LCD_ADDR = 0x02;
     LCD_DATA = x;
     LCD_DATA = x;
 
 
 	/* set Y point */
 	/* set Y point */
-    LCD_ADDR = 0x03; 
+    LCD_ADDR = 0x03;
     LCD_DATA16( y );
     LCD_DATA16( y );
 
 
 	/* read pixel */
 	/* read pixel */
 	LCD_ADDR = 0x0F;
 	LCD_ADDR = 0x0F;
-	LCD_DATA16_READ(*c);
+	LCD_DATA16_READ(p);
+
+	*c = rtgui_color_from_565p(p);
 }
 }
 
 
 void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y)
 void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y)
@@ -82,13 +86,13 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_
     LCD_DATA = x1;
     LCD_DATA = x1;
 
 
 	/* set Y point */
 	/* set Y point */
-    LCD_ADDR = 0x03; 
+    LCD_ADDR = 0x03;
     LCD_DATA16( y );
     LCD_DATA16( y );
 
 
 	/* write pixel */
 	/* write pixel */
     LCD_ADDR = 0x0E;
     LCD_ADDR = 0x0E;
-	while (x1 < x2) 
-	{ 
+	while (x1 < x2)
+	{
 		LCD_DATA16(p);
 		LCD_DATA16(p);
 		x1 ++;
 		x1 ++;
 	}
 	}
@@ -108,7 +112,7 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t
 	while(y1 < y2)
 	while(y1 < y2)
 	{
 	{
 		/* set Y point */
 		/* set Y point */
-		LCD_ADDR = 0x03; 
+		LCD_ADDR = 0x03;
 		LCD_DATA16( y1 );
 		LCD_DATA16( y1 );
 
 
 		/* write pixel */
 		/* write pixel */