STEmWin with Touch Screen on STM32F746G Dicovery – Bonus -Part 6

In this part of tutorial we will use touch in STEmWin using GUIBuilder to design our user interface.

For quite some time since last part of tutorial it has been bugging me how to use nice shiny buttons from STEmWin and touch support for them. Well I must say it finally worked and below is my process of making it work.

I used GUIBuilder to desing simple layout with two buttons and a label:

Here is link to FramewinDLG.c so that you can have the same file as I do.

I made additional folder inside our project to host GUIBuilder.exe and our design file:

In here we need to put GUIBuilder.exe from CubeMX Repository and our FramewinDLG.c. And don’t forget to include this folder in our project:

 

We need to include this file (FramewinDLG.c) in main.c so that we can display our “beautiful” design:

We also need to add variable for touch screen so that our program can communicate with STEmWin:

We need some function which will update touch data and send it to STEmWin:

For touch data inside our program we define another variable:

Somewhere inside initialization of our hardware we also need to initialize our green LED:

At the end of main function we need to add functions for updating touch data and our screen:

And finally we add code at the end of main.c:

It looks simple now, but it took me quite a few hours to finnaly get it to work.

Enjoy until next time!

Slemi

 

P.S.: If you found this helpful, I would appreciate clicking on Ad on the right side to give me a little “motivation”. 🙂

2 thoughts on “STEmWin with Touch Screen on STM32F746G Dicovery – Bonus -Part 6

  1. Hi There,

    Thank you for this example. You helped me a lot.
    If I want to read the Arduino analog pin 0 with your code what do I need to do ?>

    • You need to look at this article, where need to change line 1054 from:
      sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
      to
      sConfig.Channel = 0;
      and also you need to change main function from:
      GUI_Clear();
      GUI_SetFont(&GUI_FontComic24B_1);
      GUI_SetColor(GUI_ORANGE);
      GUI_GotoXY(200, 100);
      GUI_DispFloatFix(temp, 4, 1);
      GUI_DispString(“\xb0”);
      GUI_DispString(“C”);

      to:
      GUI_Clear();
      GUI_SetFont(&GUI_FontComic24B_1);
      GUI_SetColor(GUI_ORANGE);
      GUI_GotoXY(200, 100);
      GUI_DispDec(rawValue, 8);
      //GUI_DispFloatFix(temp, 4, 1);
      //GUI_DispString(“\xb0”);
      //GUI_DispString(“C”);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.