| 203 | } |
| 204 | |
| 205 | void rt_hw_dc_init(void) |
| 206 | { |
| 207 | rt_device_t dc = rt_malloc(sizeof(struct rt_device)); |
| 208 | if (dc == RT_NULL) |
| 209 | { |
| 210 | rt_kprintf("dc == RT_NULL\n"); |
| 211 | return; /* no memory yet */ |
| 212 | } |
| 213 | |
| 214 | _dc_info.bits_per_pixel = 16; |
| 215 | _dc_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P; |
| 216 | _dc_info.framebuffer = (rt_uint8_t*)HW_FB_ADDR; |
| 217 | _dc_info.width = FB_XSIZE; |
| 218 | _dc_info.height = FB_YSIZE; |
| 219 | |
| 220 | /* init device structure */ |
| 221 | dc->type = RT_Device_Class_Graphic; |
| 222 | dc->init = rt_dc_init; |
| 223 | dc->open = RT_NULL; |
| 224 | dc->close = RT_NULL; |
| 225 | dc->control = rt_dc_control; |
| 226 | dc->user_data = (void*)&_dc_info; |
| 227 | |
| 228 | /* register Display Controller device to RT-Thread */ |
| 229 | rt_device_register(dc, "dc", RT_DEVICE_FLAG_RDWR); |
| 230 | } |
no test coverage detected