purduesigbots / liblvgl

2 stars 4 forks source link

PROS 4 Implementation Details #4

Closed WillXuCodes closed 1 year ago

WillXuCodes commented 2 years ago

Steps to do this:

static void liblvgl_display_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color) {
    screen_copy_area(area->x1, area->y1, area->x2, area->y2, (uint32_t*)color, area->x2 - area->x1 + 1);
    lv_flush_ready();
}

static bool liblvgl_read_touch(lv_indev_drv_t* _, lv_indev_data_t* data) {
    screen_touch_status_s_t touch_data = screen_touch_status();

    switch (touch_data.touch_status) {
        case E_TOUCH_PRESSED:
        case E_TOUCH_HELD:
            data->state = LV_INDEV_STATE_PR;
            break;
        case E_TOUCH_RELEASED:
            data->state = LV_INDEV_STATE_REL;
            break;
    }
    // return last (x,y) pos in all cases https://doc.littlevgl.com/#Porting and
    // purduesigbots/pros#79
    data->point.x = touch_data.x;
    data->point.y = touch_data.y;
    return false;
}
WillXuCodes commented 1 year ago

redundant to a different issue (too lazy to grab number)