-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nema: Use NemaGFX Renderer #1
base: master
Are you sure you want to change the base?
Changes from 12 commits
7504cc8
ac24702
fae3178
c80b905
0aa2793
8afddb3
8ef8d2d
5e4c20b
249d374
ec0f6f7
4b0cbd0
59fb631
df3a610
dbf468c
a2e4b57
6163fe3
f1c2232
740e25d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2023 STMicroelectronics. | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
|
@@ -19,6 +19,7 @@ | |
/* USER CODE END Header */ | ||
/* Includes ------------------------------------------------------------------*/ | ||
#include "dma2d.h" | ||
#include "lvgl/lvgl.h" | ||
|
||
/* USER CODE BEGIN 0 */ | ||
|
||
|
@@ -39,12 +40,20 @@ void MX_DMA2D_Init(void) | |
/* USER CODE END DMA2D_Init 1 */ | ||
hdma2d.Instance = DMA2D; | ||
hdma2d.Init.Mode = DMA2D_M2M; | ||
hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565; | ||
hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565; /* LCD is RGB565 */ | ||
hdma2d.Init.OutputOffset = 0; | ||
hdma2d.Init.BytesSwap = DMA2D_BYTES_REGULAR; | ||
hdma2d.Init.LineOffsetMode = DMA2D_LOM_PIXELS; | ||
hdma2d.LayerCfg[1].InputOffset = 0; | ||
#if LV_COLOR_DEPTH == 32 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we editing a generated file? If so, can we change this setting in an LVGL file later? |
||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888; | ||
#elif LV_COLOR_DEPTH == 24 | ||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB888; | ||
#elif LV_COLOR_DEPTH == 16 | ||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565; | ||
#elif LV_COLOR_DEPTH == 8 | ||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_L8; | ||
#endif | ||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; | ||
hdma2d.LayerCfg[1].InputAlpha = 0; | ||
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA; | ||
|
@@ -57,6 +66,26 @@ void MX_DMA2D_Init(void) | |
{ | ||
Error_Handler(); | ||
} | ||
|
||
#if LV_COLOR_DEPTH == 8 | ||
uint8_t clut[256 * 3]; /* assuming the stack is large enough */ | ||
for(uint32_t i = 0; i < 256; i++) { | ||
clut[i * 3] = i; | ||
clut[i * 3 + 1] = i; | ||
clut[i * 3 + 2] = i; | ||
} | ||
DMA2D_CLUTCfgTypeDef clut_cfg = {.pCLUT=(uint32_t *)clut, | ||
.CLUTColorMode=DMA2D_CCM_RGB888, | ||
.Size=0xff}; | ||
if (HAL_DMA2D_CLUTStartLoad(&hdma2d, &clut_cfg, 1) != HAL_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
if (HAL_DMA2D_PollForTransfer(&hdma2d, HAL_MAX_DELAY) != HAL_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
#endif | ||
/* USER CODE BEGIN DMA2D_Init 2 */ | ||
|
||
/* USER CODE END DMA2D_Init 2 */ | ||
|
@@ -73,8 +102,10 @@ void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* dma2dHandle) | |
/* USER CODE END DMA2D_MspInit 0 */ | ||
/* DMA2D clock enable */ | ||
__HAL_RCC_DMA2D_CLK_ENABLE(); | ||
__HAL_RCC_DMA2D_FORCE_RESET(); | ||
__HAL_RCC_DMA2D_RELEASE_RESET(); | ||
|
||
/* DMA2D interrupt Init */ | ||
/* Enable DMA2D global Interrupt */ | ||
HAL_NVIC_SetPriority(DMA2D_IRQn, 5, 0); | ||
HAL_NVIC_EnableIRQ(DMA2D_IRQn); | ||
/* USER CODE BEGIN DMA2D_MspInit 1 */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2023 STMicroelectronics. | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
|
@@ -42,6 +42,8 @@ | |
PC15-OSC32_OUT (PC15) ------> RCC_OSC32_OUT | ||
PA13 (JTMS/SWDIO) ------> DEBUG_JTMS-SWDIO | ||
PA10 ------> USB_OTG_HS_ID | ||
PB3 (JTDO/TRACESWO) ------> DEBUG_JTDO-SWO | ||
PA9 ------> USB_OTG_HS_VBUS | ||
PH0-OSC_IN (PH0) ------> RCC_OSC_IN | ||
*/ | ||
void MX_GPIO_Init(void) | ||
|
@@ -67,12 +69,21 @@ void MX_GPIO_Init(void) | |
/*Configure GPIO pin Output Level */ | ||
HAL_GPIO_WritePin(CTP_RST_GPIO_Port, CTP_RST_Pin, GPIO_PIN_RESET); | ||
|
||
/*Configure GPIO pin Output Level */ | ||
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_6, GPIO_PIN_RESET); | ||
|
||
/*Configure GPIO pin Output Level */ | ||
HAL_GPIO_WritePin(GPIOG, USB_PWR_EN_Pin|R_CS_Pin, GPIO_PIN_RESET); | ||
|
||
/*Configure GPIO pin Output Level */ | ||
HAL_GPIO_WritePin(R_RST_GPIO_Port, R_RST_Pin, GPIO_PIN_RESET); | ||
|
||
/*Configure GPIO pin : PA15 */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be reverted. |
||
GPIO_InitStruct.Pin = GPIO_PIN_15; | ||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PA8 */ | ||
GPIO_InitStruct.Pin = GPIO_PIN_8; | ||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; | ||
|
@@ -81,6 +92,12 @@ void MX_GPIO_Init(void) | |
GPIO_InitStruct.Alternate = GPIO_AF0_MCO; | ||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PH3 */ | ||
GPIO_InitStruct.Pin = GPIO_PIN_3; | ||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PtPin */ | ||
GPIO_InitStruct.Pin = LCD_DISP_RESET_Pin; | ||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | ||
|
@@ -102,6 +119,19 @@ void MX_GPIO_Init(void) | |
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | ||
HAL_GPIO_Init(CTP_RST_GPIO_Port, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pins : PJPin PJPin */ | ||
// GPIO_InitStruct.Pin = USR_BTN_1_Pin|USB_OVERCURRENT_Pin; | ||
// GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | ||
// GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
// HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PI6 */ | ||
GPIO_InitStruct.Pin = GPIO_PIN_6; | ||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | ||
HAL_GPIO_Init(GPIOI, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PA10 */ | ||
GPIO_InitStruct.Pin = GPIO_PIN_10; | ||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; | ||
|
@@ -116,36 +146,38 @@ void MX_GPIO_Init(void) | |
GPIO_InitStruct.Pull = GPIO_PULLUP; | ||
HAL_GPIO_Init(CTP_INT_GPIO_Port, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PA9 */ | ||
GPIO_InitStruct.Pin = GPIO_PIN_9; | ||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pins : PGPin PGPin */ | ||
GPIO_InitStruct.Pin = USB_PWR_EN_Pin|R_CS_Pin; | ||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | ||
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PtPin */ | ||
GPIO_InitStruct.Pin = USB_OVERCURRENT_Pin; | ||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
HAL_GPIO_Init(USB_OVERCURRENT_GPIO_Port, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PtPin */ | ||
GPIO_InitStruct.Pin = R_RST_Pin; | ||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | ||
GPIO_InitStruct.Pull = GPIO_PULLDOWN; | ||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | ||
HAL_GPIO_Init(R_RST_GPIO_Port, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PH11 */ | ||
GPIO_InitStruct.Pin = GPIO_PIN_11; | ||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); | ||
|
||
/*Configure GPIO pin : PtPin */ | ||
GPIO_InitStruct.Pin = R_INT_Pin; | ||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
HAL_GPIO_Init(R_INT_GPIO_Port, &GPIO_InitStruct); | ||
|
||
/* EXTI interrupt init*/ | ||
HAL_NVIC_SetPriority(EXTI6_IRQn, 5, 0); | ||
HAL_NVIC_EnableIRQ(EXTI6_IRQn); | ||
|
||
} | ||
|
||
/* USER CODE BEGIN 2 */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2023 STMicroelectronics. | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
|
@@ -246,23 +246,16 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* i2cHandle) | |
|
||
__HAL_RCC_GPIOB_CLK_ENABLE(); | ||
/**I2C4 GPIO Configuration | ||
PB7 ------> I2C4_SDA | ||
PB6 ------> I2C4_SCL | ||
PB11 ------> I2C4_SDA | ||
*/ | ||
GPIO_InitStruct.Pin = GPIO_PIN_6; | ||
GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_6; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be reverted. |
||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; | ||
GPIO_InitStruct.Alternate = GPIO_AF5_I2C4; | ||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); | ||
|
||
GPIO_InitStruct.Pin = GPIO_PIN_11; | ||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; | ||
GPIO_InitStruct.Pull = GPIO_NOPULL; | ||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; | ||
GPIO_InitStruct.Alternate = GPIO_AF3_I2C4; | ||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); | ||
|
||
/* I2C4 clock enable */ | ||
__HAL_RCC_I2C4_CLK_ENABLE(); | ||
/* USER CODE BEGIN I2C4_MspInit 1 */ | ||
|
@@ -323,12 +316,12 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef* i2cHandle) | |
__HAL_RCC_I2C4_CLK_DISABLE(); | ||
|
||
/**I2C4 GPIO Configuration | ||
PB7 ------> I2C4_SDA | ||
PB6 ------> I2C4_SCL | ||
PB11 ------> I2C4_SDA | ||
*/ | ||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6); | ||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7); | ||
|
||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_11); | ||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6); | ||
|
||
/* USER CODE BEGIN I2C4_MspDeInit 1 */ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be reverted.