|
@@ -90,16 +90,31 @@ static rt_err_t rt_dc_control(rt_device_t dev, int cmd, void *args)
|
|
|
}
|
|
|
return RT_EOK;
|
|
|
}
|
|
|
+
|
|
|
+#ifdef RT_USING_DEVICE_OPS
|
|
|
+const static struct rt_device_ops dc_ops =
|
|
|
+{
|
|
|
+ rt_dc_init,
|
|
|
+ RT_NULL,
|
|
|
+ RT_NULL,
|
|
|
+ RT_NULL,
|
|
|
+ RT_NULL,
|
|
|
+ rt_dc_control
|
|
|
+};
|
|
|
+#endif
|
|
|
+
|
|
|
static void rt_hw_dc_register(struct phytium_dc_bus *dc_control_bus, const char *name, rt_uint32_t flag, void *data)
|
|
|
{
|
|
|
RT_ASSERT(dc_control_bus != RT_NULL);
|
|
|
struct rt_device *dc;
|
|
|
dc = &(dc_control_bus->parent);
|
|
|
dc->type = RT_Device_Class_Graphic;
|
|
|
+#ifdef RT_USING_DEVICE_OPS
|
|
|
+ dc->ops = &dc_ops;
|
|
|
+#else
|
|
|
dc->init = rt_dc_init;
|
|
|
- dc->open = RT_NULL;
|
|
|
- dc->close = RT_NULL;
|
|
|
dc->control = rt_dc_control;
|
|
|
+#endif
|
|
|
dc->user_data = data;
|
|
|
/* register Display Controller device to RT-Thread */
|
|
|
rt_device_register(dc, "dc", RT_DEVICE_FLAG_RDWR);
|
|
@@ -145,4 +160,3 @@ int rt_hw_dc_init(void)
|
|
|
}
|
|
|
|
|
|
INIT_DEVICE_EXPORT(rt_hw_dc_init);
|
|
|
-
|