36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
|
#include "otm8009a_lcd.h"
|
||
|
|
||
|
#include "otm8009a_lcd_lvgl_impl.h"
|
||
|
|
||
|
void _otm_lcd_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) {
|
||
|
otm_t *lcd = disp_drv->user_data;
|
||
|
otm_lcd_upload(lcd, area->x1, area->x2, area->y1, area->y2, (uint16_t *)color_p);
|
||
|
lv_disp_flush_ready(disp_drv);
|
||
|
}
|
||
|
|
||
|
void _otm_lcd_set_px_cb(lv_disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w,
|
||
|
lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) {
|
||
|
otm_t *lcd = disp_drv->user_data;
|
||
|
uint8_t * pixel_ptr;
|
||
|
if(lcd->color_format == OTM_RGB888) {
|
||
|
pixel_ptr = buf + (buf_w * y + x) * 3;
|
||
|
}
|
||
|
else {
|
||
|
pixel_ptr = buf + (buf_w * y + x) * 2;
|
||
|
}
|
||
|
if(x % 2 == 0) {
|
||
|
*(pixel_ptr) = color.ch.green;
|
||
|
*(pixel_ptr + 1) =color.ch.red;
|
||
|
*(pixel_ptr + 3) = color.ch.blue;
|
||
|
}
|
||
|
else {
|
||
|
*(pixel_ptr - 1) = color.ch.red;
|
||
|
*(pixel_ptr + 1) = color.ch.blue;
|
||
|
*(pixel_ptr + 2) = color.ch.green;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void _otm_lcd_rounder_cb(lv_disp_drv_t *disp_drv, lv_area_t *area) {
|
||
|
area->x1 &= ~0x01;
|
||
|
area->x2 |= 0x01;
|
||
|
}
|