Added GPU init to lv_init

Changed blend buffer attr to more general LV_DMA_ATTR
Added define for CMSIS header
Fixed bug with turning on peripheral clock
This commit is contained in:
andrew
2020-06-05 14:04:52 +01:00
parent cd9f34076e
commit bb5c6437ff
4 changed files with 20 additions and 3 deletions

View File

@@ -38,6 +38,10 @@
#include LV_THEME_DEFAULT_INCLUDE
#if LV_USE_GPU_STM32_DMA2D
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#endif
/*********************
* DEFINES
*********************/
@@ -139,6 +143,11 @@ void lv_init(void)
_lv_group_init();
#endif
#if LV_USE_GPU_STM32_DMA2D
/*Initialize DMA2D GPU*/
lv_gpu_stm32_dma2d_init();
#endif
_lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(lv_style_trans_t));
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));

View File

@@ -338,7 +338,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
else {
#if LV_USE_GPU
if(disp->driver.gpu_blend_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) {
LV_BLEND_BUF_ATTR static lv_color_t blend_buf[LV_HOR_RES_MAX];
LV_DMA_ATTR static lv_color_t blend_buf[LV_HOR_RES_MAX];
for(x = 0; x < draw_area_w ; x++) blend_buf[x].full = color.full;
for(y = draw_area->y1; y <= draw_area->y2; y++) {
@@ -353,7 +353,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
#if LV_USE_GPU_STM32_DMA2D
if(lv_area_get_size(draw_area) >= 240) {
/* blend_buf MUST be in DMA accessible RAM (depending on linker this isn't always the case - CCMRAM) */
LV_BLEND_BUF_ATTR static lv_color_t blend_buf[LV_HOR_RES_MAX] = {0};
LV_DMA_ATTR static lv_color_t blend_buf[LV_HOR_RES_MAX] = {0};
if(blend_buf[0].full != color.full) lv_color_fill(blend_buf, color, LV_HOR_RES_MAX);
lv_coord_t line_h = LV_HOR_RES_MAX / draw_area_w;

View File

@@ -11,7 +11,7 @@
#if LV_USE_GPU_STM32_DMA2D
#include "stm32f429xx.h"
#include LV_CPU_DMA2D_CMSIS_INCLUDE
/*********************
* DEFINES
@@ -64,6 +64,9 @@ void lv_gpu_stm32_dma2d_init(void)
/* Enable DMA2D clock */
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
/* Delay after setting peripheral clock */
volatile uint32_t temp = RCC->AHB1ENR;
/* set output colour mode */
DMA2D->OPFCCR = DMA2D_COLOR_FORMAT;
}

View File

@@ -34,6 +34,11 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/
/**
* Turn on the peripheral and set output color mode, this only needs to be done once
*/
void lv_gpu_stm32_dma2d_init(void);
/**
* Fill an area in the buffer with a color
* @param buf a buffer which should be filled