/Model.cpp Secret
Created
October 16, 2020 15:25
ISSUE WITH SENDING DATA BY UART TO VIEW
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* USER CODE BEGIN Header */ | |
/** | |
****************************************************************************** | |
* @file : main.c | |
* @brief : Main program body | |
****************************************************************************** | |
* @attention | |
* | |
* <h2><center>© Copyright (c) 2020 STMicroelectronics. | |
* All rights reserved.</center></h2> | |
* | |
* This software component is licensed by ST under Ultimate Liberty license | |
* SLA0044, the "License"; You may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at: | |
* www.st.com/SLA0044 | |
* | |
****************************************************************************** | |
*/ | |
/* USER CODE END Header */ | |
/* Includes ------------------------------------------------------------------*/ | |
#include "main.h" | |
#include "cmsis_os2.h" | |
#include "app_touchgfx.h" | |
/* Private includes ----------------------------------------------------------*/ | |
/* USER CODE BEGIN Includes */ | |
#include "../Components/otm8009a/otm8009a.h" | |
#include "stm32469i_discovery_sdram.h" | |
#include "stm32469i_discovery_qspi.h" | |
#include "PollingRoutines.h" | |
/* USER CODE END Includes */ | |
/* Private typedef -----------------------------------------------------------*/ | |
/* USER CODE BEGIN PTD */ | |
/* USER CODE END PTD */ | |
/* Private define ------------------------------------------------------------*/ | |
/* USER CODE BEGIN PD */ | |
/* DISPLAY */ | |
#define LCD_ORIENTATION_LANDSCAPE 0x01 | |
/* USER CODE END PD */ | |
/* Private macro -------------------------------------------------------------*/ | |
/* USER CODE BEGIN PM */ | |
/* USER CODE END PM */ | |
/* Private variables ---------------------------------------------------------*/ | |
CRC_HandleTypeDef hcrc; | |
DMA2D_HandleTypeDef hdma2d; | |
DSI_HandleTypeDef hdsi; | |
I2C_HandleTypeDef hi2c1; | |
LTDC_HandleTypeDef hltdc; | |
QSPI_HandleTypeDef hqspi; | |
SPI_HandleTypeDef hspi2; | |
UART_HandleTypeDef huart6; | |
SDRAM_HandleTypeDef hsdram1; | |
/* Definitions for TouchGFXTask */ | |
osThreadId_t TouchGFXTaskHandle; | |
const osThreadAttr_t TouchGFXTask_attributes = { | |
.name = "TouchGFXTask", | |
.priority = (osPriority_t) osPriorityNormal, | |
.stack_size = 2048 * 4 | |
}; | |
/* Definitions for TaskUartMsg */ | |
osThreadId_t TaskUartMsgHandle; | |
const osThreadAttr_t TaskUartMsg_attributes = { | |
.name = "TaskUartMsg", | |
.priority = (osPriority_t) osPriorityNormal, | |
.stack_size = 128 * 4 | |
}; | |
/* Definitions for binarySemUartMsg */ | |
osSemaphoreId_t binarySemUartMsgHandle; | |
const osSemaphoreAttr_t binarySemUartMsg_attributes = { | |
.name = "binarySemUartMsg" | |
}; | |
/* USER CODE BEGIN PV */ | |
/* USER CODE END PV */ | |
/* Private function prototypes -----------------------------------------------*/ | |
void SystemClock_Config(void); | |
static void MX_GPIO_Init(void); | |
static void MX_CRC_Init(void); | |
static void MX_DMA2D_Init(void); | |
static void MX_DSIHOST_DSI_Init(void); | |
static void MX_FMC_Init(void); | |
static void MX_LTDC_Init(void); | |
static void MX_QUADSPI_Init(void); | |
static void MX_I2C1_Init(void); | |
static void MX_SPI2_Init(void); | |
static void MX_USART6_UART_Init(void); | |
void TouchGFX_Task(void *argument); | |
void StartTaskUartMsg(void *argument); | |
/* USER CODE BEGIN PFP */ | |
/* USER CODE END PFP */ | |
/* Private user code ---------------------------------------------------------*/ | |
/* USER CODE BEGIN 0 */ | |
/* USER CODE END 0 */ | |
/** | |
* @brief The application entry point. | |
* @retval int | |
*/ | |
int main(void) | |
{ | |
/* USER CODE BEGIN 1 */ | |
/* USER CODE END 1 */ | |
/* MCU Configuration--------------------------------------------------------*/ | |
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ | |
HAL_Init(); | |
/* USER CODE BEGIN Init */ | |
/* USER CODE END Init */ | |
/* Configure the system clock */ | |
SystemClock_Config(); | |
/* USER CODE BEGIN SysInit */ | |
/* USER CODE END SysInit */ | |
/* Initialize all configured peripherals */ | |
MX_GPIO_Init(); | |
MX_CRC_Init(); | |
MX_DMA2D_Init(); | |
MX_DSIHOST_DSI_Init(); | |
MX_FMC_Init(); | |
MX_LTDC_Init(); | |
MX_QUADSPI_Init(); | |
MX_I2C1_Init(); | |
MX_SPI2_Init(); | |
MX_USART6_UART_Init(); | |
MX_TouchGFX_Init(); | |
/* USER CODE BEGIN 2 */ | |
/* USER CODE END 2 */ | |
/* Init scheduler */ | |
osKernelInitialize(); | |
/* USER CODE BEGIN RTOS_MUTEX */ | |
/* add mutexes, ... */ | |
/* USER CODE END RTOS_MUTEX */ | |
/* Create the semaphores(s) */ | |
/* creation of binarySemUartMsg */ | |
binarySemUartMsgHandle = osSemaphoreNew(1, 1, &binarySemUartMsg_attributes); | |
/* USER CODE BEGIN RTOS_SEMAPHORES */ | |
/* add semaphores, ... */ | |
/* USER CODE END RTOS_SEMAPHORES */ | |
/* USER CODE BEGIN RTOS_TIMERS */ | |
/* start timers, add new ones, ... */ | |
/* USER CODE END RTOS_TIMERS */ | |
/* USER CODE BEGIN RTOS_QUEUES */ | |
/* add queues, ... */ | |
/* USER CODE END RTOS_QUEUES */ | |
/* Create the thread(s) */ | |
/* creation of TouchGFXTask */ | |
TouchGFXTaskHandle = osThreadNew(TouchGFX_Task, NULL, &TouchGFXTask_attributes); | |
/* creation of TaskUartMsg */ | |
TaskUartMsgHandle = osThreadNew(StartTaskUartMsg, NULL, &TaskUartMsg_attributes); | |
/* USER CODE BEGIN RTOS_THREADS */ | |
/* add threads, ... */ | |
/* USER CODE END RTOS_THREADS */ | |
/* Start scheduler */ | |
osKernelStart(); | |
/* We should never get here as control is now taken by the scheduler */ | |
/* Infinite loop */ | |
/* USER CODE BEGIN WHILE */ | |
while (1) | |
{ | |
/* USER CODE END WHILE */ | |
/* USER CODE BEGIN 3 */ | |
/* | |
HAL_GPIO_WritePin(SPI2_SEL_GPIO_Port, SPI2_SEL_Pin, RESET); | |
HAL_SPI_Receive(&hspi2, buffer, 2, 100); | |
HAL_GPIO_WritePin(SPI2_SEL_GPIO_Port, SPI2_SEL_Pin, SET); | |
uint16_t buffer2 = (buffer[0] << 8) | (buffer[1] & 0xff); | |
buffer2 = buffer2 << 1; | |
buffer2 = buffer2 >> (16-12); | |
HAL_Delay(2000); | |
*/ | |
} | |
/* USER CODE END 3 */ | |
} | |
/** | |
* @brief System Clock Configuration | |
* @retval None | |
*/ | |
void SystemClock_Config(void) | |
{ | |
RCC_OscInitTypeDef RCC_OscInitStruct = {0}; | |
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; | |
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; | |
/** Configure the main internal regulator output voltage | |
*/ | |
__HAL_RCC_PWR_CLK_ENABLE(); | |
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); | |
/** Initializes the CPU, AHB and APB busses clocks | |
*/ | |
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; | |
RCC_OscInitStruct.HSEState = RCC_HSE_ON; | |
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; | |
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; | |
RCC_OscInitStruct.PLL.PLLM = 8; | |
RCC_OscInitStruct.PLL.PLLN = 360; | |
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; | |
RCC_OscInitStruct.PLL.PLLQ = 4; | |
RCC_OscInitStruct.PLL.PLLR = 6; | |
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/** Activate the Over-Drive mode | |
*/ | |
if (HAL_PWREx_EnableOverDrive() != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/** Initializes the CPU, AHB and APB busses clocks | |
*/ | |
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK | |
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; | |
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; | |
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | |
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; | |
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; | |
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; | |
PeriphClkInitStruct.PLLSAI.PLLSAIN = 417; | |
PeriphClkInitStruct.PLLSAI.PLLSAIR = 5; | |
PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2; | |
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
} | |
/** | |
* @brief CRC Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_CRC_Init(void) | |
{ | |
/* USER CODE BEGIN CRC_Init 0 */ | |
/* USER CODE END CRC_Init 0 */ | |
/* USER CODE BEGIN CRC_Init 1 */ | |
/* USER CODE END CRC_Init 1 */ | |
hcrc.Instance = CRC; | |
if (HAL_CRC_Init(&hcrc) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN CRC_Init 2 */ | |
/* USER CODE END CRC_Init 2 */ | |
} | |
/** | |
* @brief DMA2D Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_DMA2D_Init(void) | |
{ | |
/* USER CODE BEGIN DMA2D_Init 0 */ | |
/* USER CODE END DMA2D_Init 0 */ | |
/* USER CODE BEGIN DMA2D_Init 1 */ | |
/* USER CODE END DMA2D_Init 1 */ | |
hdma2d.Instance = DMA2D; | |
hdma2d.Init.Mode = DMA2D_M2M; | |
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888; | |
hdma2d.Init.OutputOffset = 0; | |
hdma2d.LayerCfg[1].InputOffset = 0; | |
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888; | |
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; | |
hdma2d.LayerCfg[1].InputAlpha = 0; | |
if (HAL_DMA2D_Init(&hdma2d) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
if (HAL_DMA2D_ConfigLayer(&hdma2d, 1) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN DMA2D_Init 2 */ | |
/* USER CODE END DMA2D_Init 2 */ | |
} | |
/** | |
* @brief DSIHOST Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_DSIHOST_DSI_Init(void) | |
{ | |
/* USER CODE BEGIN DSIHOST_Init 0 */ | |
/* Activate XRES active low */ | |
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_RESET); | |
HAL_Delay(20); /* wait 20 ms */ | |
/* Desactivate XRES */ | |
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_SET); | |
/* Wait for 10ms after releasing XRES before sending commands */ | |
HAL_Delay(10); | |
/* USER CODE END DSIHOST_Init 0 */ | |
DSI_PLLInitTypeDef PLLInit = {0}; | |
DSI_HOST_TimeoutTypeDef HostTimeouts = {0}; | |
DSI_PHY_TimerTypeDef PhyTimings = {0}; | |
DSI_LPCmdTypeDef LPCmd = {0}; | |
DSI_CmdCfgTypeDef CmdCfg = {0}; | |
/* USER CODE BEGIN DSIHOST_Init 1 */ | |
/* USER CODE END DSIHOST_Init 1 */ | |
hdsi.Instance = DSI; | |
hdsi.Init.AutomaticClockLaneControl = DSI_AUTO_CLK_LANE_CTRL_DISABLE; | |
hdsi.Init.TXEscapeCkdiv = 4; | |
hdsi.Init.NumberOfLanes = DSI_TWO_DATA_LANES; | |
PLLInit.PLLNDIV = 125; | |
PLLInit.PLLIDF = DSI_PLL_IN_DIV2; | |
PLLInit.PLLODF = DSI_PLL_OUT_DIV1; | |
if (HAL_DSI_Init(&hdsi, &PLLInit) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
HostTimeouts.TimeoutCkdiv = 1; | |
HostTimeouts.HighSpeedTransmissionTimeout = 0; | |
HostTimeouts.LowPowerReceptionTimeout = 0; | |
HostTimeouts.HighSpeedReadTimeout = 0; | |
HostTimeouts.LowPowerReadTimeout = 0; | |
HostTimeouts.HighSpeedWriteTimeout = 0; | |
HostTimeouts.HighSpeedWritePrespMode = DSI_HS_PM_DISABLE; | |
HostTimeouts.LowPowerWriteTimeout = 0; | |
HostTimeouts.BTATimeout = 0; | |
if (HAL_DSI_ConfigHostTimeouts(&hdsi, &HostTimeouts) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
PhyTimings.ClockLaneHS2LPTime = 28; | |
PhyTimings.ClockLaneLP2HSTime = 33; | |
PhyTimings.DataLaneHS2LPTime = 15; | |
PhyTimings.DataLaneLP2HSTime = 25; | |
PhyTimings.DataLaneMaxReadTime = 0; | |
PhyTimings.StopWaitTime = 0; | |
if (HAL_DSI_ConfigPhyTimer(&hdsi, &PhyTimings) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
if (HAL_DSI_ConfigFlowControl(&hdsi, DSI_FLOW_CONTROL_BTA) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
if (HAL_DSI_SetLowPowerRXFilter(&hdsi, 10000) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
if (HAL_DSI_ConfigErrorMonitor(&hdsi, HAL_DSI_ERROR_NONE) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_ENABLE; | |
LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_ENABLE; | |
LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_ENABLE; | |
LPCmd.LPGenShortReadNoP = DSI_LP_GSR0P_ENABLE; | |
LPCmd.LPGenShortReadOneP = DSI_LP_GSR1P_ENABLE; | |
LPCmd.LPGenShortReadTwoP = DSI_LP_GSR2P_ENABLE; | |
LPCmd.LPGenLongWrite = DSI_LP_GLW_ENABLE; | |
LPCmd.LPDcsShortWriteNoP = DSI_LP_DSW0P_ENABLE; | |
LPCmd.LPDcsShortWriteOneP = DSI_LP_DSW1P_ENABLE; | |
LPCmd.LPDcsShortReadNoP = DSI_LP_DSR0P_ENABLE; | |
LPCmd.LPDcsLongWrite = DSI_LP_DLW_ENABLE; | |
LPCmd.LPMaxReadPacket = DSI_LP_MRDP_ENABLE; | |
LPCmd.AcknowledgeRequest = DSI_ACKNOWLEDGE_ENABLE; | |
if (HAL_DSI_ConfigCommand(&hdsi, &LPCmd) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
CmdCfg.VirtualChannelID = 0; | |
CmdCfg.ColorCoding = DSI_RGB888; | |
CmdCfg.CommandSize = 448; | |
CmdCfg.TearingEffectSource = DSI_TE_EXTERNAL; | |
CmdCfg.TearingEffectPolarity = DSI_TE_RISING_EDGE; | |
CmdCfg.HSPolarity = DSI_HSYNC_ACTIVE_LOW; | |
CmdCfg.VSPolarity = DSI_VSYNC_ACTIVE_LOW; | |
CmdCfg.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH; | |
CmdCfg.VSyncPol = DSI_VSYNC_FALLING; | |
CmdCfg.AutomaticRefresh = DSI_AR_DISABLE; | |
CmdCfg.TEAcknowledgeRequest = DSI_TE_ACKNOWLEDGE_ENABLE; | |
if (HAL_DSI_ConfigAdaptedCommandMode(&hdsi, &CmdCfg) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
if (HAL_DSI_SetGenericVCID(&hdsi, 0) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN DSIHOST_Init 2 */ | |
/* USER CODE END DSIHOST_Init 2 */ | |
} | |
/** | |
* @brief I2C1 Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_I2C1_Init(void) | |
{ | |
/* USER CODE BEGIN I2C1_Init 0 */ | |
/* USER CODE END I2C1_Init 0 */ | |
/* USER CODE BEGIN I2C1_Init 1 */ | |
/* USER CODE END I2C1_Init 1 */ | |
hi2c1.Instance = I2C1; | |
hi2c1.Init.ClockSpeed = 400000; | |
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2; | |
hi2c1.Init.OwnAddress1 = 0; | |
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; | |
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; | |
hi2c1.Init.OwnAddress2 = 0; | |
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; | |
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; | |
if (HAL_I2C_Init(&hi2c1) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN I2C1_Init 2 */ | |
HAL_I2C_DeInit(&hi2c1); | |
/* USER CODE END I2C1_Init 2 */ | |
} | |
/** | |
* @brief LTDC Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_LTDC_Init(void) | |
{ | |
/* USER CODE BEGIN LTDC_Init 0 */ | |
/* USER CODE END LTDC_Init 0 */ | |
LTDC_LayerCfgTypeDef pLayerCfg = {0}; | |
/* USER CODE BEGIN LTDC_Init 1 */ | |
/* USER CODE END LTDC_Init 1 */ | |
hltdc.Instance = LTDC; | |
hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL; | |
hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL; | |
hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL; | |
hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC; | |
hltdc.Init.HorizontalSync = 1; | |
hltdc.Init.VerticalSync = 1; | |
hltdc.Init.AccumulatedHBP = 2; | |
hltdc.Init.AccumulatedVBP = 2; | |
hltdc.Init.AccumulatedActiveW = 450; | |
hltdc.Init.AccumulatedActiveH = 482; | |
hltdc.Init.TotalWidth = 451; | |
hltdc.Init.TotalHeigh = 483; | |
hltdc.Init.Backcolor.Blue = 0; | |
hltdc.Init.Backcolor.Green = 0; | |
hltdc.Init.Backcolor.Red = 0; | |
if (HAL_LTDC_Init(&hltdc) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
pLayerCfg.WindowX0 = 0; | |
pLayerCfg.WindowX1 = 448; | |
pLayerCfg.WindowY0 = 0; | |
pLayerCfg.WindowY1 = 480; | |
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB888; | |
pLayerCfg.Alpha = 255; | |
pLayerCfg.Alpha0 = 0; | |
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA; | |
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA; | |
pLayerCfg.FBStartAdress = 0xC0000000; | |
pLayerCfg.ImageWidth = 448; | |
pLayerCfg.ImageHeight = 480; | |
pLayerCfg.Backcolor.Blue = 0; | |
pLayerCfg.Backcolor.Green = 0; | |
pLayerCfg.Backcolor.Red = 0; | |
if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN LTDC_Init 2 */ | |
__HAL_LTDC_DISABLE(&hltdc); | |
DSI_LPCmdTypeDef LPCmd; | |
HAL_DSI_Start(&hdsi); | |
OTM8009A_Init(OTM8009A_FORMAT_RGB888, LCD_ORIENTATION_LANDSCAPE); | |
HAL_DSI_ShortWrite(&hdsi, 0, DSI_DCS_SHORT_PKT_WRITE_P1, OTM8009A_CMD_DISPOFF, 0x00); | |
LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_DISABLE; | |
LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_DISABLE; | |
LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_DISABLE; | |
LPCmd.LPGenShortReadNoP = DSI_LP_GSR0P_DISABLE; | |
LPCmd.LPGenShortReadOneP = DSI_LP_GSR1P_DISABLE; | |
LPCmd.LPGenShortReadTwoP = DSI_LP_GSR2P_DISABLE; | |
LPCmd.LPGenLongWrite = DSI_LP_GLW_DISABLE; | |
LPCmd.LPDcsShortWriteNoP = DSI_LP_DSW0P_DISABLE; | |
LPCmd.LPDcsShortWriteOneP = DSI_LP_DSW1P_DISABLE; | |
LPCmd.LPDcsShortReadNoP = DSI_LP_DSR0P_DISABLE; | |
LPCmd.LPDcsLongWrite = DSI_LP_DLW_DISABLE; | |
HAL_DSI_ConfigCommand(&hdsi, &LPCmd); | |
HAL_LTDC_SetPitch(&hltdc, 800, 0); | |
__HAL_LTDC_ENABLE(&hltdc); | |
/* USER CODE END LTDC_Init 2 */ | |
} | |
/** | |
* @brief QUADSPI Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_QUADSPI_Init(void) | |
{ | |
/* USER CODE BEGIN QUADSPI_Init 0 */ | |
/* USER CODE END QUADSPI_Init 0 */ | |
/* USER CODE BEGIN QUADSPI_Init 1 */ | |
/* USER CODE END QUADSPI_Init 1 */ | |
/* QUADSPI parameter configuration*/ | |
hqspi.Instance = QUADSPI; | |
hqspi.Init.ClockPrescaler = 1; | |
hqspi.Init.FifoThreshold = 1; | |
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE; | |
hqspi.Init.FlashSize = 27; | |
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_5_CYCLE; | |
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0; | |
hqspi.Init.FlashID = QSPI_FLASH_ID_1; | |
hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE; | |
if (HAL_QSPI_Init(&hqspi) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN QUADSPI_Init 2 */ | |
BSP_QSPI_DeInit(); | |
if(BSP_QSPI_Init() != QSPI_OK) | |
{ | |
Error_Handler(); | |
} | |
if(BSP_QSPI_EnableMemoryMappedMode() != QSPI_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE END QUADSPI_Init 2 */ | |
} | |
/** | |
* @brief SPI2 Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_SPI2_Init(void) | |
{ | |
/* USER CODE BEGIN SPI2_Init 0 */ | |
/* USER CODE END SPI2_Init 0 */ | |
/* USER CODE BEGIN SPI2_Init 1 */ | |
/* USER CODE END SPI2_Init 1 */ | |
/* SPI2 parameter configuration*/ | |
hspi2.Instance = SPI2; | |
hspi2.Init.Mode = SPI_MODE_MASTER; | |
hspi2.Init.Direction = SPI_DIRECTION_2LINES; | |
hspi2.Init.DataSize = SPI_DATASIZE_8BIT; | |
hspi2.Init.CLKPolarity = SPI_POLARITY_LOW; | |
hspi2.Init.CLKPhase = SPI_PHASE_1EDGE; | |
hspi2.Init.NSS = SPI_NSS_SOFT; | |
hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2; | |
hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB; | |
hspi2.Init.TIMode = SPI_TIMODE_DISABLE; | |
hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; | |
hspi2.Init.CRCPolynomial = 10; | |
if (HAL_SPI_Init(&hspi2) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN SPI2_Init 2 */ | |
/* USER CODE END SPI2_Init 2 */ | |
} | |
/** | |
* @brief USART6 Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_USART6_UART_Init(void) | |
{ | |
/* USER CODE BEGIN USART6_Init 0 */ | |
/* USER CODE END USART6_Init 0 */ | |
/* USER CODE BEGIN USART6_Init 1 */ | |
/* USER CODE END USART6_Init 1 */ | |
huart6.Instance = USART6; | |
huart6.Init.BaudRate = 115200; | |
huart6.Init.WordLength = UART_WORDLENGTH_8B; | |
huart6.Init.StopBits = UART_STOPBITS_1; | |
huart6.Init.Parity = UART_PARITY_NONE; | |
huart6.Init.Mode = UART_MODE_TX_RX; | |
huart6.Init.HwFlowCtl = UART_HWCONTROL_NONE; | |
huart6.Init.OverSampling = UART_OVERSAMPLING_16; | |
if (HAL_UART_Init(&huart6) != HAL_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE BEGIN USART6_Init 2 */ | |
/* USER CODE END USART6_Init 2 */ | |
} | |
/* FMC initialization function */ | |
static void MX_FMC_Init(void) | |
{ | |
/* USER CODE BEGIN FMC_Init 0 */ | |
/* USER CODE END FMC_Init 0 */ | |
FMC_SDRAM_TimingTypeDef SdramTiming = {0}; | |
/* USER CODE BEGIN FMC_Init 1 */ | |
/* USER CODE END FMC_Init 1 */ | |
/** Perform the SDRAM1 memory initialization sequence | |
*/ | |
hsdram1.Instance = FMC_SDRAM_DEVICE; | |
/* hsdram1.Init */ | |
hsdram1.Init.SDBank = FMC_SDRAM_BANK1; | |
hsdram1.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_8; | |
hsdram1.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_12; | |
hsdram1.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_32; | |
hsdram1.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4; | |
hsdram1.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_3; | |
hsdram1.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE; | |
hsdram1.Init.SDClockPeriod = FMC_SDRAM_CLOCK_DISABLE; | |
hsdram1.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE; | |
hsdram1.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_2; | |
/* SdramTiming */ | |
SdramTiming.LoadToActiveDelay = 2; | |
SdramTiming.ExitSelfRefreshDelay = 7; | |
SdramTiming.SelfRefreshTime = 4; | |
SdramTiming.RowCycleDelay = 7; | |
SdramTiming.WriteRecoveryTime = 3; | |
SdramTiming.RPDelay = 2; | |
SdramTiming.RCDDelay = 2; | |
if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK) | |
{ | |
Error_Handler( ); | |
} | |
/* USER CODE BEGIN FMC_Init 2 */ | |
BSP_SDRAM_DeInit(); | |
if(BSP_SDRAM_Init() != SDRAM_OK) | |
{ | |
Error_Handler(); | |
} | |
/* USER CODE END FMC_Init 2 */ | |
} | |
/** | |
* @brief GPIO Initialization Function | |
* @param None | |
* @retval None | |
*/ | |
static void MX_GPIO_Init(void) | |
{ | |
GPIO_InitTypeDef GPIO_InitStruct = {0}; | |
/* GPIO Ports Clock Enable */ | |
__HAL_RCC_GPIOG_CLK_ENABLE(); | |
__HAL_RCC_GPIOE_CLK_ENABLE(); | |
__HAL_RCC_GPIOB_CLK_ENABLE(); | |
__HAL_RCC_GPIOD_CLK_ENABLE(); | |
__HAL_RCC_GPIOI_CLK_ENABLE(); | |
__HAL_RCC_GPIOF_CLK_ENABLE(); | |
__HAL_RCC_GPIOK_CLK_ENABLE(); | |
__HAL_RCC_GPIOH_CLK_ENABLE(); | |
__HAL_RCC_GPIOC_CLK_ENABLE(); | |
__HAL_RCC_GPIOJ_CLK_ENABLE(); | |
/*Configure GPIO pin Output Level */ | |
HAL_GPIO_WritePin(GPIOG, SPI2_SEL_Pin|VSYNC_FREQ_Pin, GPIO_PIN_RESET); | |
/*Configure GPIO pin Output Level */ | |
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_SET); | |
/*Configure GPIO pin Output Level */ | |
HAL_GPIO_WritePin(RENDER_TIME_GPIO_Port, RENDER_TIME_Pin, GPIO_PIN_RESET); | |
/*Configure GPIO pin Output Level */ | |
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_RESET); | |
/*Configure GPIO pin : SPI2_SEL_Pin */ | |
GPIO_InitStruct.Pin = SPI2_SEL_Pin; | |
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
GPIO_InitStruct.Pull = GPIO_NOPULL; | |
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | |
HAL_GPIO_Init(SPI2_SEL_GPIO_Port, &GPIO_InitStruct); | |
/*Configure GPIO pin : PK3 */ | |
GPIO_InitStruct.Pin = GPIO_PIN_3; | |
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; | |
GPIO_InitStruct.Pull = GPIO_NOPULL; | |
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; | |
HAL_GPIO_Init(GPIOK, &GPIO_InitStruct); | |
/*Configure GPIO pin : RENDER_TIME_Pin */ | |
GPIO_InitStruct.Pin = RENDER_TIME_Pin; | |
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
GPIO_InitStruct.Pull = GPIO_NOPULL; | |
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; | |
HAL_GPIO_Init(RENDER_TIME_GPIO_Port, &GPIO_InitStruct); | |
/*Configure GPIO pin : VSYNC_FREQ_Pin */ | |
GPIO_InitStruct.Pin = VSYNC_FREQ_Pin; | |
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; | |
GPIO_InitStruct.Pull = GPIO_NOPULL; | |
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; | |
HAL_GPIO_Init(VSYNC_FREQ_GPIO_Port, &GPIO_InitStruct); | |
/*Configure GPIO pin : PH7 */ | |
GPIO_InitStruct.Pin = GPIO_PIN_7; | |
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; | |
GPIO_InitStruct.Pull = GPIO_NOPULL; | |
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; | |
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); | |
} | |
/* USER CODE BEGIN 4 */ | |
/* USER CODE END 4 */ | |
/* USER CODE BEGIN Header_TouchGFX_Task */ | |
/** | |
* @brief Function implementing the TouchGFXTask thread. | |
* @param argument: Not used | |
* @retval None | |
*/ | |
/* USER CODE END Header_TouchGFX_Task */ | |
__weak void TouchGFX_Task(void *argument) | |
{ | |
/* USER CODE BEGIN 5 */ | |
/* Infinite loop */ | |
for(;;) | |
{ | |
osDelay(1); | |
} | |
/* USER CODE END 5 */ | |
} | |
/* USER CODE BEGIN Header_StartTaskUartMsg */ | |
/** | |
* @brief Function implementing the TaskUartMsg thread. | |
* @param argument: Not used | |
* @retval None | |
*/ | |
/* USER CODE END Header_StartTaskUartMsg */ | |
void StartTaskUartMsg(void *argument) | |
{ | |
/* USER CODE BEGIN StartTaskUartMsg */ | |
PollingInit(); | |
/* Infinite loop */ | |
for(;;) | |
{ | |
PollingRoutine(); | |
osDelay(1); | |
} | |
/* USER CODE END StartTaskUartMsg */ | |
} | |
/** | |
* @brief Period elapsed callback in non blocking mode | |
* @note This function is called when TIM6 interrupt took place, inside | |
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment | |
* a global variable "uwTick" used as application time base. | |
* @param htim : TIM handle | |
* @retval None | |
*/ | |
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) | |
{ | |
/* USER CODE BEGIN Callback 0 */ | |
/* USER CODE END Callback 0 */ | |
if (htim->Instance == TIM6) { | |
HAL_IncTick(); | |
} | |
/* USER CODE BEGIN Callback 1 */ | |
/* USER CODE END Callback 1 */ | |
} | |
/** | |
* @brief This function is executed in case of error occurrence. | |
* @retval None | |
*/ | |
void Error_Handler(void) | |
{ | |
/* USER CODE BEGIN Error_Handler_Debug */ | |
/* User can add his own implementation to report the HAL error return state */ | |
/* USER CODE END Error_Handler_Debug */ | |
} | |
#ifdef USE_FULL_ASSERT | |
/** | |
* @brief Reports the name of the source file and the source line number | |
* where the assert_param error has occurred. | |
* @param file: pointer to the source file name | |
* @param line: assert_param error line source number | |
* @retval None | |
*/ | |
void assert_failed(uint8_t *file, uint32_t line) | |
{ | |
/* USER CODE BEGIN 6 */ | |
/* User can add his own implementation to report the file name and line number, | |
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ | |
/* USER CODE END 6 */ | |
} | |
#endif /* USE_FULL_ASSERT */ | |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gui/model/Model.hpp> | |
#include <gui/model/ModelListener.hpp> | |
#include "cmsis_os2.h" | |
#include "semphr.h" | |
extern osSemaphoreId_t binarySemUartMsgHandle; | |
//extern osStatus_t val; | |
Model::Model() : modelListener(0) | |
{ | |
//if(xSemaphoreTake(binarySemUartMsgHandle, ( TickType_t ) 10) == pdTRUE | |
} | |
void Model::tick() | |
{ | |
if(binarySemUartMsgHandle != NULL){ | |
//val = osSemaphoreAcquire(binarySemUartMsgHandle, (TickType_t) 10); | |
//if(val == osOK){ | |
//if(xSemaphoreTake(binarySemUartMsgHandle, ( TickType_t ) 10) == pdTRUE){ | |
if(osSemaphoreAcquire(binarySemUartMsgHandle, (TickType_t ) 10) == osOK){ | |
uartMsgRdy(); | |
} | |
//osSemaphoreRelease(binarySemUartMsgHandle); | |
//} | |
} | |
} | |
void Model::uartMsgRdy(){ | |
modelListener->uartMsgRdy(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MODEL_HPP | |
#define MODEL_HPP | |
#include <cmsis_os.h> | |
class ModelListener; | |
class Model | |
{ | |
public: | |
Model(); | |
void bind(ModelListener* listener) | |
{ | |
modelListener = listener; | |
} | |
void tick(); | |
void uartMsgRdy(); | |
protected: | |
ModelListener* modelListener; | |
}; | |
#endif // MODEL_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MODELLISTENER_HPP | |
#define MODELLISTENER_HPP | |
#include <gui/model/Model.hpp> | |
class ModelListener | |
{ | |
public: | |
ModelListener() : model(0) {} | |
virtual ~ModelListener() {} | |
virtual void uartMsgRdy() {} | |
void bind(Model* m) | |
{ | |
model = m; | |
} | |
protected: | |
Model* model; | |
}; | |
#endif // MODELLISTENER_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "main.h" | |
#include "PollingRoutines.h" | |
#include "string.h" | |
#include "cmsis_os2.h" | |
//#include "semphr.h" | |
extern UART_HandleTypeDef huart6; | |
extern osSemaphoreId binarySemUartMsgHandle; | |
uint8_t uartmsgBuf[UART_BUF_SIZE]; | |
uint8_t uartMsgData[2]; | |
uint8_t msgIndex = 0; | |
uint8_t msgRdyFlag = 0; | |
//osStatus_t val; | |
void PollingInit(){ | |
//enable interrupt | |
HAL_UART_Receive_IT(&huart6, &uartMsgData, 1); | |
} | |
void PollingRoutine(){ | |
if(msgRdyFlag == 1){ | |
//val = osOK; | |
//uartMsgSizeTransmit = sprintf(uartMsgTransmitData, "Odebrano: %d", uartMsgData); | |
osSemaphoreRelease(binarySemUartMsgHandle); | |
//HAL_UART_Transmit_IT(&huart6, &uartMsgData, uartmsgBuf); | |
//osSemaphoreAcquire(binarySemUartMsgHandle, (TickType_t) 10); | |
//xSemaphoreGive(binarySemUartMsgHandle); | |
msgRdyFlag = 0; | |
} | |
} | |
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart6){ | |
if(msgIndex == 0){ | |
memset(&uartmsgBuf, 0, sizeof(uartmsgBuf)); | |
} | |
if(uartMsgData[0] != 13){ | |
uartmsgBuf[msgIndex++] = uartMsgData[0]; | |
} | |
else | |
{ | |
uartmsgBuf[msgIndex] = uartMsgData[0]; | |
msgIndex = 0; | |
msgRdyFlag = 1; | |
} | |
//enable interrupts again | |
HAL_UART_Receive_IT(&huart6, &uartMsgData, 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef INC_POLLINGROUTINES_H_ | |
#define INC_POLLINGROUTINES_H_ | |
#ifdef __cplusplus | |
extern "C"{ | |
#endif | |
#define UART_BUF_SIZE 16 | |
void PollingInit(); | |
void PollingRoutine(); | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gui/testspi_screen/TestSpiView.hpp> | |
#include <gui/testspi_screen/TestSpiPresenter.hpp> | |
TestSpiPresenter::TestSpiPresenter(TestSpiView& v) | |
: view(v) | |
{ | |
} | |
void TestSpiPresenter::activate() | |
{ | |
} | |
void TestSpiPresenter::deactivate() | |
{ | |
} | |
void TestSpiPresenter::uartMsgRdy(){ | |
view.uartMsgRdy(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TESTSPIPRESENTER_HPP | |
#define TESTSPIPRESENTER_HPP | |
#include <gui/model/ModelListener.hpp> | |
#include <mvp/Presenter.hpp> | |
using namespace touchgfx; | |
class TestSpiView; | |
class TestSpiPresenter : public touchgfx::Presenter, public ModelListener | |
{ | |
public: | |
TestSpiPresenter(TestSpiView& v); | |
/** | |
* The activate function is called automatically when this screen is "switched in" | |
* (ie. made active). Initialization logic can be placed here. | |
*/ | |
virtual void activate(); | |
/** | |
* The deactivate function is called automatically when this screen is "switched out" | |
* (ie. made inactive). Teardown functionality can be placed here. | |
*/ | |
virtual void deactivate(); | |
virtual ~TestSpiPresenter() {}; | |
virtual void uartMsgRdy(); | |
private: | |
TestSpiPresenter(); | |
TestSpiView& view; | |
}; | |
#endif // TESTSPIPRESENTER_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gui/testspi_screen/TestSpiView.hpp> | |
#include "string.h" | |
#include "PollingRoutines.h" | |
extern uint8_t uartmsgBuf[UART_BUF_SIZE]; | |
TestSpiView::TestSpiView() | |
{ | |
} | |
void TestSpiView::setupScreen() | |
{ | |
TestSpiViewBase::setupScreen(); | |
} | |
void TestSpiView::tearDownScreen() | |
{ | |
TestSpiViewBase::tearDownScreen(); | |
} | |
void TestSpiView::uartMsgRdy(){ | |
if(uartmsgBuf[0] == 0) return; | |
memset(&textAreaSpiBuffer, 0 , TEXTAREASPI_SIZE); | |
Unicode::strncpy(textAreaSpiBuffer, (char *) uartmsgBuf, TEXTAREASPI_SIZE - 1); | |
//textAreaSpiBuffer[16] = "\0"; | |
textAreaSpi.invalidate(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef TESTSPIVIEW_HPP | |
#define TESTSPIVIEW_HPP | |
#include <gui_generated/testspi_screen/TestSpiViewBase.hpp> | |
#include <gui/testspi_screen/TestSpiPresenter.hpp> | |
class TestSpiView : public TestSpiViewBase | |
{ | |
public: | |
TestSpiView(); | |
virtual ~TestSpiView() {} | |
virtual void setupScreen(); | |
virtual void tearDownScreen(); | |
virtual void uartMsgRdy(); | |
protected: | |
}; | |
#endif // TESTSPIVIEW_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************************/ | |
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/ | |
/*********************************************************************************/ | |
#include <gui_generated/testspi_screen/TestSpiViewBase.hpp> | |
#include <touchgfx/Color.hpp> | |
#include "BitmapDatabase.hpp" | |
#include <texts/TextKeysAndLanguages.hpp> | |
TestSpiViewBase::TestSpiViewBase() : | |
buttonCallback(this, &TestSpiViewBase::buttonCallbackHandler) | |
{ | |
__background.setPosition(0, 0, 800, 480); | |
__background.setColor(touchgfx::Color::getColorFrom24BitRGB(0, 0, 0)); | |
image1.setXY(0, 0); | |
image1.setBitmap(touchgfx::Bitmap(BITMAP_BG_ID)); | |
box1.setPosition(144, 170, 533, 140); | |
box1.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255)); | |
textAreaSpi.setXY(154, 228); | |
textAreaSpi.setColor(touchgfx::Color::getColorFrom24BitRGB(0, 0, 0)); | |
textAreaSpi.setLinespacing(0); | |
textAreaSpiBuffer[0] = 0; | |
textAreaSpi.setWildcard(textAreaSpiBuffer); | |
textAreaSpi.resizeToCurrentText(); | |
textAreaSpi.setTypedText(touchgfx::TypedText(T_SINGLEUSEID13)); | |
container1.setPosition(0, 0, 800, 60); | |
digitalClock1.setPosition(700, 0, 100, 25); | |
digitalClock1.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255)); | |
digitalClock1.setTypedText(touchgfx::TypedText(T_SINGLEUSEID15)); | |
digitalClock1.displayLeadingZeroForHourIndicator(true); | |
digitalClock1.setDisplayMode(touchgfx::DigitalClock::DISPLAY_24_HOUR); | |
digitalClock1.setTime24Hour(10, 10, 0); | |
container1.add(digitalClock1); | |
buttonReturn.setXY(0, 0); | |
buttonReturn.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_ICON_BUTTON_ID), touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_ICON_BUTTON_ID)); | |
buttonReturn.setLabelText(touchgfx::TypedText(T_SINGLEUSEID16)); | |
buttonReturn.setLabelColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255)); | |
buttonReturn.setLabelColorPressed(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255)); | |
buttonReturn.setAction(buttonCallback); | |
container1.add(buttonReturn); | |
add(__background); | |
add(image1); | |
add(box1); | |
add(textAreaSpi); | |
add(container1); | |
} | |
void TestSpiViewBase::setupScreen() | |
{ | |
} | |
void TestSpiViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src) | |
{ | |
if (&src == &buttonReturn) | |
{ | |
//Interaction1 | |
//When buttonReturn clicked change screen to ChoosenScreen | |
//Go to ChoosenScreen with no screen transition | |
application().gotoChoosenScreenScreenNoTransition(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************************/ | |
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/ | |
/*********************************************************************************/ | |
#ifndef TESTSPIVIEWBASE_HPP | |
#define TESTSPIVIEWBASE_HPP | |
#include <gui/common/FrontendApplication.hpp> | |
#include <mvp/View.hpp> | |
#include <gui/testspi_screen/TestSpiPresenter.hpp> | |
#include <touchgfx/widgets/Box.hpp> | |
#include <touchgfx/widgets/Image.hpp> | |
#include <touchgfx/widgets/TextAreaWithWildcard.hpp> | |
#include <touchgfx/containers/Container.hpp> | |
#include <touchgfx/containers/clock/DigitalClock.hpp> | |
#include <touchgfx/widgets/ButtonWithLabel.hpp> | |
class TestSpiViewBase : public touchgfx::View<TestSpiPresenter> | |
{ | |
public: | |
TestSpiViewBase(); | |
virtual ~TestSpiViewBase() {} | |
virtual void setupScreen(); | |
protected: | |
FrontendApplication& application() { | |
return *static_cast<FrontendApplication*>(touchgfx::Application::getInstance()); | |
} | |
/* | |
* Member Declarations | |
*/ | |
touchgfx::Box __background; | |
touchgfx::Image image1; | |
touchgfx::Box box1; | |
touchgfx::TextAreaWithOneWildcard textAreaSpi; | |
touchgfx::Container container1; | |
touchgfx::DigitalClock digitalClock1; | |
touchgfx::ButtonWithLabel buttonReturn; | |
/* | |
* Wildcard Buffers | |
*/ | |
static const uint16_t TEXTAREASPI_SIZE = 17; | |
touchgfx::Unicode::UnicodeChar textAreaSpiBuffer[TEXTAREASPI_SIZE]; | |
private: | |
/* | |
* Callback Declarations | |
*/ | |
touchgfx::Callback<TestSpiViewBase, const touchgfx::AbstractButton&> buttonCallback; | |
/* | |
* Callback Handler Declarations | |
*/ | |
void buttonCallbackHandler(const touchgfx::AbstractButton& src); | |
}; | |
#endif // TESTSPIVIEWBASE_HPP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment