| 211 | } |
| 212 | |
| 213 | void rt_hw_dc_init(void) |
| 214 | { |
| 215 | rt_device_t dc = rt_malloc(sizeof(struct rt_device)); |
| 216 | if (dc == RT_NULL) |
| 217 | { |
| 218 | rt_kprintf("dc == RT_NULL\n"); |
| 219 | return; /* no memory yet */ |
| 220 | } |
| 221 | |
| 222 | _dc_info.bits_per_pixel = 16; |
| 223 | _dc_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565; |
| 224 | _dc_info.framebuffer = (rt_uint8_t*)HW_FB_ADDR; |
| 225 | _dc_info.width = FB_XSIZE; |
| 226 | _dc_info.height = FB_YSIZE; |
| 227 | |
| 228 | /* init device structure */ |
| 229 | dc->type = RT_Device_Class_Graphic; |
| 230 | dc->init = rt_dc_init; |
| 231 | dc->open = RT_NULL; |
| 232 | dc->close = RT_NULL; |
| 233 | dc->control = rt_dc_control; |
| 234 | dc->user_data = (void*)&_dc_info; |
| 235 | |
| 236 | /* register Display Controller device to RT-Thread */ |
| 237 | rt_device_register(dc, "dc", RT_DEVICE_FLAG_RDWR); |
| 238 | |
| 239 | rt_device_init(dc); |
| 240 | } |
| 241 | |
| 242 | #include <rtgui/driver.h> |
| 243 | #include "display_controller.h" |
no test coverage detected