cancel
Showing results for 
Search instead for 
Did you mean: 

REPOST: Controlling LEDs on STM32F769 discovery board

TouchGFX Community Question repost - Johnson Tie -  July 23 2018

I just received a new STM32F769 discovery board and could program the GUI using TouchGFX Designer.

But I could not work out a way to control the LEDs on the board. Here are my steps. 

  • I placed a toggle button and added an interaction to run a new virtual function: updateLed.
  • I selected "generate code".
  • I modified mainview.cpp (the screen was called "main"):
  • In mainView::setupScreen(), I called BSP_LED_Init(LED_GREEN);
  • In mainView::updateLed(), I controlled the LED according to the button.

if (toggleButton1.getState()) {

      BSP_LED_On(LED_GREEN);

   }

   else {

      BSP_LED_Off(LED_GREEN);

   }

This step is similar to the post in https://touchgfx.zendesk.com/hc/en-us/community/posts/208798869-Compiling-LED-project-in-VS.

After deploying to the board (using gcc), when I pressed the button, the red LED (LD1) was on momentarily. When I released the button, the LED was on again momentarily. I expected the green LED to be on when the button was pressed and off when it was pressed again. The button image was changed correctly.

I also tried the method used in PoolDemoHWInt in https://touchgfx.zendesk.com/hc/en-us/articles/205074561-Connecting-the-UI-to-your-system. But I got the same result.

Any help would be appreciated.

Thanks

EDIT 1:

I decided to add HAL_Delay(2000); after BSP_LED_On and BSP_LED_Off. It turned out the LED kind of worked. After turning on (or off) for 2 seconds, the green LED became dim again. Somehow, the green LED's default state was dimmed - is the pin already used by a signal (PWM, CLK)?

When I changed from LED_GREEN to LED_RED, LED1 or LED2, it did not make any difference. It was always the green LED that was activated.

TouchGFX Community Answer repost - Flemming Gram Christensen - July 23 2018

Can you check the file GPIO.cpp. Maybe the LED1 is used for something else also. In case, then just comment out the turn on/off lines in GPIO.cpp

0 REPLIES 0