This commit is contained in:
刘可亮
2025-10-21 13:59:50 +08:00
parent 33c375efac
commit 3e10f578d3
7070 changed files with 998841 additions and 1402535 deletions

View File

@@ -18,6 +18,12 @@
static uint16_t g_touch_angle = 0;
static uint8_t g_touch_dynamic_enable = 0;
static uint8_t g_osd_enable = 0;
/* Dynamic Crop Width */
static rt_int32_t g_width = 0;
/* Dynamic Crop Height */
static rt_int32_t g_height = 0;
/* Dynamic Crop Switch */
static rt_uint8_t g_crop_enable = 0;
static void aic_set_dynamic_touch_rotation(uint16_t angle)
{
@@ -45,6 +51,20 @@ static uint8_t aic_get_osd_rotation_flag(uint8_t flag)
return g_osd_enable;
}
static void aic_touch_set_dynamic_crop(rt_int32_t width, rt_int32_t height, rt_uint8_t enable)
{
g_width = width;
g_height = height;
g_crop_enable = enable;
}
static void aic_touch_get_dynamic_crop(rt_int32_t *width, rt_int32_t *height, rt_uint8_t *enable)
{
*width = g_width;
*height = g_height;
*enable = g_crop_enable;
}
/* ISR for touch interrupt */
void rt_hw_touch_isr(rt_touch_t touch)
{
@@ -249,6 +269,24 @@ static rt_err_t rt_touch_control(rt_device_t dev, int cmd, void *args)
else
result = -RT_EINVAL;
break;
case RT_TOUCH_CTRL_SET_DYNAMIC_CROP:
if (args) {
struct rt_touch_crop_info *crop_info = (struct rt_touch_crop_info *)args;
aic_touch_set_dynamic_crop(crop_info->width, crop_info->height, crop_info->enable);
} else {
result = -RT_EINVAL;
}
break;
case RT_TOUCH_CTRL_GET_DYNAMIC_CROP:
if (args) {
struct rt_touch_crop_info *crop_info = (struct rt_touch_crop_info *)args;
aic_touch_get_dynamic_crop(&crop_info->width, &crop_info->height, &crop_info->enable);
} else {
result = -RT_EINVAL;
}
break;
case RT_TOUCH_CTRL_DISABLE_INT:
rt_touch_irq_disable(touch);