【转】STM32 + RT Thread OS 学习笔记[三]

[复制链接]
 楼主| sunmeat 发表于 2015-1-22 09:10 | 显示全部楼层 |阅读模式
RTGUI

据说RTGUI是多线程的,因此与RT-Thread OS的耦合度较高,有可能要访问RT-Thread的线程控制块。如果要移植到其它OS,估计难度较大。目前还处于Alpha状态,最终将会包含进RT-Thread中,成为其中的标准组件。


 楼主| sunmeat 发表于 2015-1-22 09:12 | 显示全部楼层
1、  RTGUI下载
当前,要获取包含RTGUI的源码,需要到SVN库里去拉。
因此,需要先安装SVN客户端。比较简单的就是命令行,当然你也可以其它选择。
这里使用Apache Subversion command line tools,下载地址:http://www.visualsvn.com/downloads/
图像 066.png
 楼主| sunmeat 发表于 2015-1-22 09:13 | 显示全部楼层
下载文件是一个压缩包,解压到任意目录即可。
RT-Thread SVN源码浏览
图像 067.png
 楼主| sunmeat 发表于 2015-1-22 09:14 | 显示全部楼层
打开cmd窗口,进入上面解压缩目录,运行下面的命令:
svn checkout http://rt-thread.googlecode.com/svn/tags/rtt_1_1_1\mcu\rtt111
这样就把rtt_1_1_1这个版本下载到根目录下的 mcu\rtt111中。
图像 068.png
图像 069.png
图像 070.png

注1:由于众所周知的原因,从googlecode下载有点困难,建议使用***等方式。

注2:下载的bsp目录,实际只需要simulator(模拟器)和stm32f10x(奋斗板V3对应),其它的都可以删除或转移到其它目录。

 楼主| sunmeat 发表于 2015-1-22 09:15 | 显示全部楼层
2、  项目生成
与之前一样,修改rtconfig.h,打开RT_USING_RTGUI选项;
图像 071.png
运行命令:scons –target=mdk4 –s
打开生成的项目文件,可以看到已经包含了RTGUI。
 楼主| sunmeat 发表于 2015-1-22 09:17 | 显示全部楼层
3、  LCD驱动(SSD1963)
a)      这是重新下载的源码,所以对LED的定义,还需要按之前章节所述,修改相应代码。
b)      编译
在驱动未完成前,examples和calibration.c(由文件名看应该是触摸屏校准程序)都可以不要。从项目中移除(remove)组gui_examples以及文件calibration.c,重新编译,成功。
图像 077.png
 楼主| sunmeat 发表于 2015-1-22 09:17 | 显示全部楼层
c)      驱动代码
默认状态下,包含了ssd1289这个驱动文件,我们要参照它来写一个ssd1963的驱动。
代码:
ssd1963.c
  1. #include <rtthread.h>
  2. #include "stm32f10x.h"

  3. // 分辨率(H:0-479 V:0-271)
  4. unsigned int  HDP=479;
  5. unsigned int  VDP=271;

  6. unsigned int  HT=531;
  7. unsigned int  HPS=43;
  8. unsigned int  LPS=8;
  9. unsigned char HPW=1;

  10. unsigned int  VT=288;
  11. unsigned int  VPS=12;
  12. unsigned int  FPS=4;
  13. unsigned char VPW=10;

  14. #define Bank1_LCD_D    ((uint32_t)0x60020000)    //disp Data ram
  15. #define Bank1_LCD_C    ((uint32_t)0x60000000)     //disp Reg ram

  16. void Delay(__IO uint32_t nCount)
  17. {
  18.   for(; nCount != 0; nCount--);
  19. }

  20. void LCD_WR_REG(u16 index)
  21. {
  22. *(__IO uint16_t *) (Bank1_LCD_C)= index;
  23. }

  24. u16 LCD_RD_DAT(void)
  25. {
  26. u16 a=0;
  27. a=*(__IO uint16_t *) (Bank1_LCD_D);
  28. return(a);
  29. }

  30. void LCD_WR_DAT(u16 val)
  31. {  
  32. *(__IO uint16_t *) (Bank1_LCD_D)= val;      
  33. }

  34. void _set_window(u16 x1, u16 y1, u16 x2, u16 y2)
  35. {
  36. LCD_WR_REG(0x002A);
  37.          LCD_WR_DAT(x1>>8);      
  38.          LCD_WR_DAT(x1&0x00ff);
  39.          LCD_WR_DAT(x2>>8);
  40.          LCD_WR_DAT(x2&0x00ff);
  41.          LCD_WR_REG(0x002b);
  42.          LCD_WR_DAT(y1>>8);
  43.          LCD_WR_DAT(y1&0x00ff);
  44.          LCD_WR_DAT(y2>>8);
  45.          LCD_WR_DAT(y2&0x00ff);
  46. }

  47. void _set_cursor(u16 x,u16 y)
  48. {
  49. _set_window(x, y, HDP, VDP);
  50. }

  51. void lcd_set_pixel(const char* pixel, int x, int y)
  52. {
  53. _set_cursor(x, y);
  54. LCD_WR_REG(0x2c);
  55. LCD_WR_DAT(*(rt_uint16_t*)pixel);
  56. }

  57. void lcd_get_pixel(char* pixel, int x, int y)
  58. {
  59. _set_cursor(x, y);
  60. LCD_WR_REG(0x2e);
  61. *(rt_uint16_t*)pixel = LCD_RD_DAT();
  62. }

  63. void lcd_draw_hline(const char* pixel, int x1, int x2, int y)
  64. {
  65. _set_cursor(x1, y);
  66. LCD_WR_REG(0x2c);
  67.     while (x1 < x2)
  68.     {
  69.         LCD_WR_DAT(*(rt_uint16_t*)pixel);
  70.         x1++;
  71.     }
  72. }

  73. void lcd_draw_vline(const char* pixel, int x, int y1, int y2)
  74. {
  75. _set_window(x, y1, x, y2);
  76. LCD_WR_REG(0x2c);
  77.     while (y1 < y2)
  78.     {
  79.         LCD_WR_DAT(*(rt_uint16_t*)pixel);
  80.         y1++;
  81.     }
  82. }

  83. void lcd_blit_line(const char* pixels, int x, int y, rt_size_t size)
  84. {
  85. rt_uint16_t *ptr;
  86. ptr = (rt_uint16_t*)pixels;

  87. _set_cursor(x, y);
  88. LCD_WR_REG(0x2c);
  89.     while (size)
  90.     {
  91.         LCD_WR_DAT(*ptr ++);
  92.            size --;
  93.     }
  94. }

  95. void lcd_clear()
  96. {                  
  97.     int w = HDP + 1, h = VDP + 1;
  98. _set_cursor(0, 0);
  99. LCD_WR_REG(0x2c);
  100.     while (w--)
  101.     {
  102.         while(h--)
  103.         {
  104.             LCD_WR_DAT(0xffff);
  105.         }
  106.            h = VDP + 1;
  107.     }
  108. }

  109. void LCD_INIT(void)
  110. {
  111. GPIO_ResetBits(GPIOE, GPIO_Pin_1);
  112.     Delay(0xAFFFF);                                         
  113.     GPIO_SetBits(GPIOE, GPIO_Pin_1 );                          
  114. Delay(0xAFFFF);

  115.     LCD_WR_REG(0x00E2);                 // PLL=10*36/3=120M
  116. LCD_WR_DAT(0x0023);          //N=0x36 for 6.5M, 0x23 for 10M crystal
  117. LCD_WR_DAT(0x0002);
  118. LCD_WR_DAT(0x0004);
  119. LCD_WR_REG(0x00E0);        
  120. LCD_WR_DAT(0x0001);
  121. Delay(0xAFFF);
  122. LCD_WR_REG(0x00E0);
  123. LCD_WR_DAT(0x0003);              
  124. Delay(0xAFFF);
  125. LCD_WR_REG(0x0001);      
  126. Delay(0xAFFF);
  127. LCD_WR_REG(0x00E6);              //PLL setting for PCLK, depends on resolution
  128. LCD_WR_DAT(0x0001);
  129. LCD_WR_DAT(0x0033);
  130. LCD_WR_DAT(0x0032);

  131. LCD_WR_REG(0x00B0);              //module
  132. LCD_WR_DAT(0x0000);
  133. LCD_WR_DAT(0x0000);
  134. LCD_WR_DAT((HDP>>8)&0X00FF);  //Set HDP
  135. LCD_WR_DAT(HDP&0X00FF);
  136.     LCD_WR_DAT((VDP>>8)&0X00FF);  //Set VDP
  137. LCD_WR_DAT(VDP&0X00FF);
  138.     LCD_WR_DAT(0x0000);

  139. LCD_WR_REG(0x00B4);      //HSYNC
  140. LCD_WR_DAT((HT>>8)&0X00FF);  //Set HT
  141. LCD_WR_DAT(HT&0X00FF);
  142. LCD_WR_DAT((HPS>>8)&0X00FF);  //Set HPS
  143. LCD_WR_DAT(HPS&0X00FF);
  144. LCD_WR_DAT(HPW);                       //Set HPW
  145. LCD_WR_DAT((LPS>>8)&0X00FF);  //Set HPS
  146. LCD_WR_DAT(LPS&0X00FF);
  147. LCD_WR_DAT(0x0000);

  148. LCD_WR_REG(0x00B6);      //VSYNC
  149. LCD_WR_DAT((VT>>8)&0X00FF);   //Set VT
  150. LCD_WR_DAT(VT&0X00FF);
  151. LCD_WR_DAT((VPS>>8)&0X00FF);  //Set VPS
  152. LCD_WR_DAT(VPS&0X00FF);
  153. LCD_WR_DAT(VPW);                       //Set VPW
  154. LCD_WR_DAT((FPS>>8)&0X00FF);  //Set FPS
  155. LCD_WR_DAT(FPS&0X00FF);

  156. LCD_WR_REG(0x00BA);
  157. LCD_WR_DAT(0x000F);    //GPIO[3:0] out 1

  158. LCD_WR_REG(0x00B8);
  159. LCD_WR_DAT(0x0007);    //GPIO3=input, GPIO[2:0]=output
  160. LCD_WR_DAT(0x0001);    //GPIO0 normal

  161. LCD_WR_REG(0x0036);            //rotation
  162. LCD_WR_DAT(0x0000);

  163. LCD_WR_REG(0x00F0);             //16位  565 color module
  164. LCD_WR_DAT(0x0003);

  165. Delay(0xAFFF);

  166. LCD_WR_REG(0x0029); //display on

  167. LCD_WR_REG(0x00BE); //set PWM for B/L
  168. LCD_WR_DAT(0x0006);
  169. LCD_WR_DAT(0x0080);
  170. LCD_WR_DAT(0x0001);
  171. LCD_WR_DAT(0x00f0);
  172. LCD_WR_DAT(0x0000);
  173. LCD_WR_DAT(0x0000);

  174. LCD_WR_REG(0x00d0);// backlight
  175. LCD_WR_DAT(0x000d);
  176. }

  177. void GPIO_INIT(void)
  178. {
  179.     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC
  180.                                                        | RCC_APB2Periph_GPIOD| RCC_APB2Periph_GPIOE| RCC_APB2Periph_GPIOF , ENABLE);
  181. }

  182. void FSMC_LCD_Init(void)
  183. {
  184.   FSMC_NORSRAMInitTypeDef  FSMC_NORSRAMInitStructure;
  185.   FSMC_NORSRAMTimingInitTypeDef  p;
  186.   GPIO_InitTypeDef  GPIO_InitStructure;

  187.   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);      

  188.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;                              
  189.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;                    
  190.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;                  
  191.   GPIO_Init(GPIOD, &GPIO_InitStructure);   
  192.   GPIO_SetBits(GPIOD, GPIO_Pin_13);                                 


  193.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;               
  194.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;                  
  195.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;                  
  196.   GPIO_Init(GPIOE, &GPIO_InitStructure);

  197.         

  198.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 |
  199.                                 GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_14 |
  200.                                 GPIO_Pin_15;
  201.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;                 
  202.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;         
  203.   GPIO_Init(GPIOD, &GPIO_InitStructure);


  204.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |
  205.                                 GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 |
  206.                                 GPIO_Pin_15;
  207.   GPIO_Init(GPIOE, &GPIO_InitStructure);




  208.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
  209.   GPIO_Init(GPIOD, &GPIO_InitStructure);


  210.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 ;
  211.   GPIO_Init(GPIOD, &GPIO_InitStructure);

  212.   p.FSMC_AddressSetupTime = 0x02;
  213.   p.FSMC_AddressHoldTime = 0x00;
  214.   p.FSMC_DataSetupTime = 0x05;
  215.   p.FSMC_BusTurnAroundDuration = 0x00;
  216.   p.FSMC_CLKDivision = 0x00;
  217.   p.FSMC_DataLatency = 0x00;
  218.   p.FSMC_AccessMode = FSMC_AccessMode_B;

  219.   FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
  220.   FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
  221.   FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_NOR;
  222.   FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
  223.   FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
  224.   FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
  225.   FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
  226.   FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
  227.   FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
  228.   FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
  229.   FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
  230.   FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
  231.   FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
  232.   FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
  233.   FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;

  234.   FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);


  235.   FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
  236. }


  237. struct rt_device_graphic_ops ssd1963_ops =
  238. {
  239. lcd_set_pixel,
  240. lcd_get_pixel,
  241. lcd_draw_hline,
  242. lcd_draw_vline,
  243. lcd_blit_line
  244. };

  245. struct rt_device _lcd_device;
  246. static rt_err_t lcd_init(rt_device_t dev)
  247. {
  248. return RT_EOK;
  249. }

  250. static rt_err_t lcd_open(rt_device_t dev, rt_uint16_t oflag)
  251. {
  252. return RT_EOK;
  253. }

  254. static rt_err_t lcd_close(rt_device_t dev)
  255. {
  256. return RT_EOK;
  257. }

  258. static rt_err_t lcd_control(rt_device_t dev, rt_uint8_t cmd, void *args)
  259. {
  260. switch (cmd)
  261. {
  262. case RTGRAPHIC_CTRL_GET_INFO:
  263.            {
  264.                     struct rt_device_graphic_info *info;

  265.                     info = (struct rt_device_graphic_info*) args;
  266.                     RT_ASSERT(info != RT_NULL);

  267.                     info->bits_per_pixel = 16;
  268.                     info->pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
  269.                     info->framebuffer = RT_NULL;
  270.                     info->width = HDP + 1;
  271.                     info->height = VDP + 1;
  272.            }
  273.            break;

  274. case RTGRAPHIC_CTRL_RECT_UPDATE:
  275.            /* nothong to be done */
  276.            break;

  277. default:
  278.            break;
  279. }

  280. return RT_EOK;
  281. }

  282. void rt_hw_lcd_init(void)
  283. {

  284. /* register lcd device */
  285. _lcd_device.type  = RT_Device_Class_Graphic;
  286. _lcd_device.init  = lcd_init;
  287. _lcd_device.open  = lcd_open;
  288. _lcd_device.close = lcd_close;
  289. _lcd_device.control = lcd_control;
  290. _lcd_device.read  = RT_NULL;
  291. _lcd_device.write = RT_NULL;

  292. _lcd_device.user_data = &ssd1963_ops;
  293.     GPIO_INIT();
  294.     FSMC_LCD_Init();
  295.     LCD_INIT();
  296.     lcd_clear();

  297.     /* register graphic device driver */
  298. rt_device_register(&_lcd_device, "lcd",
  299.            RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);
  300. }
 楼主| sunmeat 发表于 2015-1-22 09:18 | 显示全部楼层
这个文件中,直接被调用的只有一个函数:void rt_hw_lcd_init(void),执行完成后,在系统中注册了名为“lcd”的设备。
  1.    _lcd_device.type  = RT_Device_Class_Graphic;
  2.    _lcd_device.init  = lcd_init;
  3.    _lcd_device.open  = lcd_open;
  4.    _lcd_device.close = lcd_close;
  5.    _lcd_device.control = lcd_control;
  6.    _lcd_device.read  = RT_NULL;
  7.    _lcd_device.write = RT_NULL;
 楼主| sunmeat 发表于 2015-1-22 09:18 | 显示全部楼层
这些是一个标准设备必须的函数,作为LCD显示设备,这里只有control是有用的,其它实际上是个空函数。
  1. struct rt_device_graphic_ops ssd1963_ops =
  2. {
  3.          lcd_set_pixel,
  4.          lcd_get_pixel,
  5.          lcd_draw_hline,
  6.          lcd_draw_vline,
  7.          lcd_blit_line
  8. };

  9. void rt_hw_lcd_init(void)
  10. {

  11.          …………

  12.          _lcd_device.user_data = &ssd1963_ops;
  13. …………
 楼主| sunmeat 发表于 2015-1-22 09:19 | 显示全部楼层
d)      测试程序
测试程序分两个,一个是底层硬件画图函数测试,一个是RTGUI API测试。
lcd_hw_test.c
  1. #include <rtthread.h>

  2. extern const unsigned char* icon;

  3. void lcd_hw_test(){
  4.     char pixel[] = {0x00, 0xf8};
  5.     int width, height = 59, i=5;
  6.     unsigned char* p;
  7.     char tmp[] = {0xff, 0xff};

  8.     rt_device_t drv = rt_device_find("lcd");
  9.     struct rt_device_graphic_ops* ops = ((struct rt_device_graphic_ops *)(drv->user_data));

  10.     // hline
  11.     while(i--)
  12.     {
  13.         ops->draw_hline(pixel, 0, 480, 50 + i);
  14.     }

  15.     // vline
  16.     i = 5;
  17.     while(i--)
  18.     {
  19.         ops->draw_vline(pixel, 80 + i, 0, 272);
  20.     }

  21.     // draw icon
  22.     p = (unsigned char*)&icon;
  23.     while(height--){
  24.         ops->blit_line((char*)p, 200, 180 - height, 59);
  25.         p += 59 * 2;
  26.     }
  27.    
  28.     // copy icon
  29.     width = height = 59;
  30.     while(height--)
  31.     {
  32.         while(width--)
  33.         {
  34.             ops->get_pixel(tmp, 200 + width, 180 - height);
  35.             ops->set_pixel(tmp, 290 + width,  180 - height);
  36.         }
  37.         width = 59;
  38.     }
  39. }
 楼主| sunmeat 发表于 2015-1-22 09:20 | 显示全部楼层
lcd_gui_test.c
  1. #include <rtthread.h>

  2. extern const unsigned char* icon;

  3. void lcd_hw_test(){
  4.     char pixel[] = {0x00, 0xf8};
  5.     int width, height = 59, i=5;
  6.     unsigned char* p;
  7.     char tmp[] = {0xff, 0xff};

  8.     rt_device_t drv = rt_device_find("lcd");
  9.     struct rt_device_graphic_ops* ops = ((struct rt_device_graphic_ops *)(drv->user_data));

  10.     // hline
  11.     while(i--)
  12.     {
  13.         ops->draw_hline(pixel, 0, 480, 50 + i);
  14.     }

  15.     // vline
  16.     i = 5;
  17.     while(i--)
  18.     {
  19.         ops->draw_vline(pixel, 80 + i, 0, 272);
  20.     }

  21.     // draw icon
  22.     p = (unsigned char*)&icon;
  23.     while(height--){
  24.         ops->blit_line((char*)p, 200, 180 - height, 59);
  25.         p += 59 * 2;
  26.     }
  27.    
  28.     // copy icon
  29.     width = height = 59;
  30.     while(height--)
  31.     {
  32.         while(width--)
  33.         {
  34.             ops->get_pixel(tmp, 200 + width, 180 - height);
  35.             ops->set_pixel(tmp, 290 + width,  180 - height);
  36.         }
  37.         width = 59;
  38.     }
  39. }
 楼主| sunmeat 发表于 2015-1-22 09:24 | 显示全部楼层
d)      测试程序
测试程序分两个,一个是底层硬件画图函数测试,一个是RTGUI API测试。
lcd_hw_test.c
  1. #include <rtthread.h>

  2. extern const unsigned char* icon;

  3. void lcd_hw_test(){
  4.     char pixel[] = {0x00, 0xf8};
  5.     int width, height = 59, i=5;
  6.     unsigned char* p;
  7.     char tmp[] = {0xff, 0xff};

  8.     rt_device_t drv = rt_device_find("lcd");
  9.     struct rt_device_graphic_ops* ops = ((struct rt_device_graphic_ops *)(drv->user_data));

  10.     // hline
  11.     while(i--)
  12.     {
  13.         ops->draw_hline(pixel, 0, 480, 50 + i);
  14.     }

  15.     // vline
  16.     i = 5;
  17.     while(i--)
  18.     {
  19.         ops->draw_vline(pixel, 80 + i, 0, 272);
  20.     }

  21.     // draw icon
  22.     p = (unsigned char*)&icon;
  23.     while(height--){
  24.         ops->blit_line((char*)p, 200, 180 - height, 59);
  25.         p += 59 * 2;
  26.     }
  27.    
  28.     // copy icon
  29.     width = height = 59;
  30.     while(height--)
  31.     {
  32.         while(width--)
  33.         {
  34.             ops->get_pixel(tmp, 200 + width, 180 - height);
  35.             ops->set_pixel(tmp, 290 + width,  180 - height);
  36.         }
  37.         width = 59;
  38.     }
  39. }
 楼主| sunmeat 发表于 2015-1-22 09:25 | 显示全部楼层
lcd_gui_test.c
代码很大,存入文档.rar (5.32 KB, 下载次数: 4)
这两个测试文件的显示内容是一样的。
显示一条5个像素宽的横条与竖条,以及一个图标,再复制一份同样的图标。通过这些来测试基本的五个函数有没有按预期效果显示。
 楼主| sunmeat 发表于 2015-1-22 09:26 | 显示全部楼层
在application.c中添加测试代码:(L55-L59)
图像 078.png
 楼主| sunmeat 发表于 2015-1-22 09:26 | 显示全部楼层
编译,下载,可以看到测试结果:
图像 079.png
 楼主| sunmeat 发表于 2015-1-22 09:27 | 显示全部楼层
e)模拟器运行RTGUI
模拟器在目录bsp\simulator下,在开始之前,请阅读目录下的readme.txt。
使用命令:scons --target=vs –s 来创建Visaul C++ 2005的项目文件。
打开生成的project.vcproj。
图像 080.png
 楼主| sunmeat 发表于 2015-1-22 09:28 | 显示全部楼层
将lcd_gui_test.c加入,再在application.c中添加测试代码(默认是运行贪吃蛇游戏);
图像 081.png
 楼主| sunmeat 发表于 2015-1-22 09:28 | 显示全部楼层
修改project -> Drivers -> sdl_fb.c,让屏幕分辨率与开发板的一致。
运行后,就可以看到效果了(注:可能因调用低层代码,窗口没刷新,用其它窗口盖一下,再挪开,就可以看到上图了)
yinhaix 发表于 2015-6-2 17:36 | 显示全部楼层
vivilzb1985 发表于 2015-6-8 19:39 | 显示全部楼层
sunmeat 发表于 2015-1-22 09:14
打开cmd窗口,进入上面解压缩目录,运行下面的命令:
svn checkout http://rt-thread.googlecode.com/svn/t ...

这个资料非常给力的,介绍也很详细。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

208

主题

2132

帖子

13

粉丝
快速回复 在线客服 返回列表 返回顶部