由于我之前已经使用RA6M3接过原子的4.3寸屏,所以很多参数可以照搬,但有部分参数是需要参考原子的例程:
Output|
timing|Horizontal total cycles 1165
Output|Timing|Horizontal active video cycles 1024
Output|Timing|Horizontal back porch cycles 140
Output|Timing|Horizontal sync signal cycles 1
Output|Timing|Horizontal sync signal polarity Low active
Output|Timing|Vertical total lines 621
Output|Timing|Vertical active video lines 600
Output|Timing|Vertical back porch lines 20
Output|Timing|Vertical sync signal lines 1
Output|Timing|Vertical sync signal polarity Low active
Output|Timing|Data Enable Signal Polarity High active
Output|Timing|Sync edge Falling edge
Output|Format|Color format 16bits RGB565
Output|Format|Color order RGB
Output|Format|Endian Little endian
由于原子的7寸屏是1024*600的分辨率,RA8D1芯片内部SRAM是不够存放显存缓存的,必须要放在外部的SDRAM:
Input|Graphics Layer 1|Framebuffer|Framebuffer name fb_background
Input|Graphics Layer 1|Framebuffer|Section for framebuffer allocation .sdram
TCON功能脚和HSYNC VSYNC等控制引脚也没有一一对应关系,都是通过分配实现的:
TCON|Hsync pin select LCD_TCON1
TCON|Vsync pin select LCD_TCON0
TCON|Data enable (DE) pin select LCD_TCON3
TCON|Panel clock source Internal clock (GLCDCLK)
TCON|Panel clock division ratio 1/8
SDRAM配置则直接照搬RTT工程即可:
显示屏驱动代码:
- #define LCD_WIDTH 1024
- #define LCD_HEIGHT 600
- uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0];
- void ra_bsp_lcd_clear(uint16_t color)
- {
- for (uint32_t i = 0; i < (LCD_WIDTH * LCD_HEIGHT); i++)
- {
- lcd_current_working_buffer[i] = color;
- }
- }
- void bsp_lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color)
- {
- lcd_current_working_buffer[(y * LCD_WIDTH) + x] = color;
- }
- void lcd_fill_rectangle(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t pixcolor)
- {
- uint16_t cycle_y, x_offset = 0;
- for (cycle_y = y_start; cycle_y <= y_end;)
- {
- for (x_offset = 0; x_start + x_offset <= x_end; x_offset++)
- {
- bsp_lcd_draw_pixel(x_start + x_offset, cycle_y, pixcolor);
- }
- cycle_y++;
- }
- }
复制代码
SDRAM驱动代码:
显示效果: