AnsweredAssumed Answered

STM32F429I DISCO LCD Help

Question asked by botha.antonie on Dec 17, 2015
Latest reply on Dec 17, 2015 by botha.antonie
Hi Guys.

I recently picked up the above-mentioned evaluation board.
I am currently using TrueStudio.

I want to display text strings on the on-board LCD.
I have been trying to butcher one of the examples to include and use "stm32f429i_discovery_lcd.h" library but without any success.

I seem to run into all kinds of issues when trying to compile.

Does anyone have an example regarding which files should be included and in which sequence do I initialize to display text on the screen?

This is what I currently have, but not yet compiling.

I will update as soon as I have something that compiles.

Help would be greatly appreciated..
Thanks!
AJBotha

001./**
002.  ******************************************************************************
003.  * @file    EXTI_Example/main.c
004.  * @author  MCD Application Team
005.  * @version V1.0.0
006.  * @date    20-September-2013
007.  * @brief   This example shows how to configure external interrupt lines.
008.  ******************************************************************************
009.  * @attention
010.  *
011.  * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
012.  *
013.  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
014.  * You may not use this file except in compliance with the License.
015.  * You may obtain a copy of the License at:
016.  *
018.  *
019.  * Unless required by applicable law or agreed to in writing, software
020.  * distributed under the License is distributed on an "AS IS" BASIS,
021.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
022.  * See the License for the specific language governing permissions and
023.  * limitations under the License.
024.  *
025.  ******************************************************************************
026.  */
027./* Includes ------------------------------------------------------------------*/
028.#include "main.h"
029.#include "stm32f429i_discovery_lcd.h"
030.#include "fonts.h"
031. 
032./** @addtogroup STM32F429I_DISCOVERY_Examples
033.  * @{
034.  */
035. 
036./** @addtogroup EXTI_Example
037.  * @{
038.  */
039. 
040./* Private typedef -----------------------------------------------------------*/
041.EXTI_InitTypeDef   EXTI_InitStructure;
042./* Private define ------------------------------------------------------------*/
043./* Private macro -------------------------------------------------------------*/
044.__IO uint32_t TimingDelay;
045./* Private variables ---------------------------------------------------------*/
046./* Private function prototypes -----------------------------------------------*/
047.static void EXTILine0_Config(void);
048.static void EXTILine13_Config(void);
049./* Private functions ---------------------------------------------------------*/
050. 
051./**
052.  * @brief  Main program
053.  * @param  None
054.  * @retval None
055.  */
056.int main(void)
057.{
058.  /*!< At this stage the microcontroller clock setting is already configured,
059.  this is done through SystemInit() function which is called from startup
060.  files (startup_stm32f429_439xx.s) before to branch to application main.
061.  To reconfigure the default setting of SystemInit() function, refer to
062.  system_stm32f4xx.c file
063.  */
064. 
065.  RCC_ClocksTypeDef RCC_Clocks;
066.  /* SysTick end of count event each 1ms */
067.  RCC_GetClocksFreq(&RCC_Clocks);
068.  SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
069.   
070. 
071.  BSP_LCD_Init();
072.  BSP_LCD_LayerDefaultInit(0, (uint32_t) LCD_FRAME_BUFFER);
073.  BSP_LCD_SelectLayer(0);
074.  BSP_LCD_SetLayerVisible(0,ENABLE);
075.  BSP_LCD_DisplayOn();
076. 
077.  BSP_LCD_Clear(LCD_COLOR_RED);
078.  BSP_LCD_DisplayChar(1,1,0x41);
079.  BSP_LCD_DisplayStringAt(2,2, (uint8_t *) "Hello!", CENTER_MODE);
080. 
081. 
082. 
083.  LCD_SetLayer(0);
084.  LCD_DisplayOn();
085.  LCD_SetTextColor(5-6-5);
086.  LCD_DisplayStringLine(2, (uint8_t *)"Test Display");
087. 
088. 
089.  /* Initialize LEDs mounted on EVAL board */
090.  STM_EVAL_LEDInit(LED3);
091.  STM_EVAL_LEDInit(LED4);
092.   
093.  /* Put LED3 on */
094.  STM_EVAL_LEDOn(LED3);
095.   
096.  /* Configure EXTI Line0 (connected to PA0 pin) in interrupt mode */
097.  EXTILine0_Config();
098.   
099.  /* Configure EXTI Line13 (connected to PC13 pin) in interrupt mode */
100.  EXTILine13_Config();
101.   
102.  while (1)
103.  {
104.    /* Generate software interrupt: simulate a falling edge applied on EXTI0 line */
105.    EXTI_GenerateSWInterrupt(EXTI_Line13);
106.     
107.    Delay(500);
108.  }
109.}
110. 
111./**
112.  * @brief  Configures EXTI Line0 (connected to PA0 pin) in interrupt mode
113.  * @param  None
114.  * @retval None
115.  */
116.static void EXTILine0_Config(void)
117.{
118.  EXTI_InitTypeDef   EXTI_InitStructure;
119.  GPIO_InitTypeDef   GPIO_InitStructure;
120.  NVIC_InitTypeDef   NVIC_InitStructure;
121. 
122.  /* Enable GPIOA clock */
123.  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
124.  /* Enable SYSCFG clock */
125.  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
126.   
127.  /* Configure PA0 pin as input floating */
128.  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
129.  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
130.  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
131.  GPIO_Init(GPIOA, &GPIO_InitStructure);
132. 
133.  /* Connect EXTI Line0 to PA0 pin */
134.  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);
135. 
136.  /* Configure EXTI Line0 */
137.  EXTI_InitStructure.EXTI_Line = EXTI_Line0;
138.  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
139.  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 
140.  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
141.  EXTI_Init(&EXTI_InitStructure);
142. 
143.  /* Enable and set EXTI Line0 Interrupt to the lowest priority */
144.  NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
145.  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
146.  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
147.  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
148.  NVIC_Init(&NVIC_InitStructure);
149.}
150. 
151./**
152.  * @brief  Configures EXTI Line15 (connected to PG15 pin) in interrupt mode
153.  * @param  None
154.  * @retval None
155.  */
156.static void EXTILine13_Config(void)
157.{
158.  EXTI_InitTypeDef   EXTI_InitStructure;
159.  GPIO_InitTypeDef   GPIO_InitStructure;
160.  NVIC_InitTypeDef   NVIC_InitStructure;
161. 
162.  /* Enable GPIOC clock */
163.  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
164.   
165.  /* Enable SYSCFG clock */
166.  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
167.   
168.  /* Configure PC13 pin as input floating */
169.  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
170.  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
171.  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
172.  GPIO_Init(GPIOC, &GPIO_InitStructure);
173. 
174.  /* Connect EXTI Line15 to PC13 pin */
175.  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource13);
176. 
177.  /* Configure EXTI Line13 */
178.  EXTI_InitStructure.EXTI_Line = EXTI_Line13;
179.  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
180.  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
181.  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
182.  EXTI_Init(&EXTI_InitStructure);
183. 
184.  /* Enable and set EXTI15_10 Interrupt to the lowest priority */
185.  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
186.  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
187.  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
188.  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
189. 
190.  NVIC_Init(&NVIC_InitStructure);
191.}
192. 
193./**
194.  * @brief  Inserts a delay time.
195.  * @param  nTime: specifies the delay time length, in 10 ms.
196.  * @retval None
197.  */
198.void Delay(__IO uint32_t nTime)
199.{
200.  TimingDelay = nTime;
201. 
202.  while(TimingDelay != 0);
203.}
204. 
205./**
206.  * @brief  Decrements the TimingDelay variable.
207.  * @param  None
208.  * @retval None
209.  */
210.void TimingDelay_Decrement(void)
211.{
212.  if (TimingDelay != 0x00)
213.  {
214.    TimingDelay--;
215.  }
216.}
217. 
218.#ifdef  USE_FULL_ASSERT
219. 
220./**
221.  * @brief  Reports the name of the source file and the source line number
222.  *         where the assert_param error has occurred.
223.  * @param  file: pointer to the source file name
224.  * @param  line: assert_param error line source number
225.  * @retval None
226.  */
227.void assert_failed(uint8_t* file, uint32_t line)
228.{
229.  /* User can add his own implementation to report the file name and line number,
230.     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
231. 
232.  /* Infinite loop */
233.  while (1)
234.  {
235.  }
236.}
237.#endif
238. 
239./**
240.  * @}
241.  */
242. 
243./**
244.  * @}
245.  */
246. 
247./************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Outcomes