完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我用的中景园st7789 240x240的屏幕,canvas总是截掉80个像素的图片,我画一个图形放在0,0只显示一部分,然后canvas坐标慢慢往下(默认坐标系下y增加)就显示得越来越多。我并没有用任何变换。
请问这会是我代码的问题吗? void init_display(QueueHandle_t *msg_queue) { queue = msg_queue; esp_err_t ret = ESP_OK; spi_config_t bus_conf = { .miso_io_num = SPI2_MISO, .mosi_io_num = SPI2_MOSI, .sclk_io_num = SPI2_SCK, .max_transfer_sz = 2 * 240 * 240 + 10, }; spi_bus_handle_t s_spi2_bus_handle = spi_bus_create(SPI2_HOST, &bus_conf); scr_interface_spi_config_t spi_lcd_cfg = { .spi_bus = s_spi2_bus_handle, .pin_num_cs = LCD_SPI_CS_PIN, .pin_num_dc = LCD_SPI_DC_PIN, .clk_freq = LCD_SPI_CLOCK_FREQ, .swap_data = true, }; scr_interface_driver_t *iface_drv; scr_interface_create(SCREEN_IFACE_SPI, &spi_lcd_cfg, &iface_drv); ret = scr_find_driver(SCREEN_CONTROLLER_ST7789, &g_lcd); if (ESP_OK != ret) { ESP_LOGE(TAG, "screen find failed"); return; } scr_controller_config_t lcd_cfg = { .interface_drv = iface_drv, .pin_num_rst = LCD_SPI_RESET_PIN, .pin_num_bckl = LCD_SPI_BL_PIN, .rst_active_level = 0, .bckl_active_level = 1, .offset_hor = 0, .offset_ver = 0, .width = 240, .height = 240, .rotate = SCR_DIR_LRTB, }; ret = g_lcd.init(&lcd_cfg); if (ESP_OK != ret) { ESP_LOGE(TAG, "screen initialize failed"); return; } g_lcd.get_info(&g_lcd_info); ESP_LOGI(TAG, "Screen name:%s | width:%d | height:%d", g_lcd_info.name, g_lcd_info.width, g_lcd_info.height); lvgl_init(&g_lcd, NULL); lv_style_t bg_style; lv_style_init(&bg_style); lv_style_set_bg_color(&bg_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_add_style(lv_scr_act(), LV_OBJ_PART_MAIN, &bg_style); create_canvas(); // main_page(); } void create_canvas() { canvas = lv_canvas_create(lv_scr_act(), NULL); lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR); lv_obj_align(canvas, NULL, LV_ALIGN_IN_TOP_LEFT,0, 40); lv_canvas_fill_bg(canvas, LV_COLOR_BLACK, LV_OPA_COVER); lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); rect_dsc.radius = 40; rect_dsc.bg_opa = LV_OPA_TRANSP; rect_dsc.border_width = 2; rect_dsc.border_opa = LV_OPA_90; rect_dsc.border_color = LV_COLOR_MAKE(0x00, 0xFF, 0x00); lv_canvas_draw_rect(canvas, 0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, &rect_dsc); } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
542浏览 6评论
454浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
434浏览 5评论
436浏览 4评论
409浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 14:40 , Processed in 0.676915 second(s), Total 45, Slave 38 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号