Skip to main content
Damien Ratazy
Associate III
December 15, 2019
Question

STM32F7508-DISCO simple GPIO ?

  • December 15, 2019
  • 3 replies
  • 1080 views

Hi,

I'm really struggling to implement easily a GPIO function, even with the tutorials provided.

I'm trying to use the GPIO class set (GPIO_ID id), but how ?

It's not very well documented, there are no examples provided.

https://www.touchgfx.com/documentation/html/classtouchgfx_1_1_g_p_i_o.html

I'm trying to set a GPIO pin (I1) to HIGH via the press of the button called "button_pi1" on my UI.

I'm calling a new virtual function called "toggle_gpio".

Here is the code generated in screen1viewBase.cpp :

/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/screen1_screen/screen1ViewBase.hpp>
#include <touchgfx/Color.hpp>
#include "BitmapDatabase.hpp"
#include <texts/TextKeysAndLanguages.hpp>
 
screen1ViewBase::screen1ViewBase() :
 buttonCallback(this, &screen1ViewBase::buttonCallbackHandler)
{
 bg.setPosition(0, 0, 480, 272);
 bg.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
 
 button_pi1.setXY(60, 15);
 button_pi1.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_LARGE_ID), touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_LARGE_PRESSED_ID));
 button_pi1.setLabelText(touchgfx::TypedText(T_SINGLEUSEID2));
 button_pi1.setLabelColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
 button_pi1.setLabelColorPressed(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
 button_pi1.setAction(buttonCallback);
 
 add(bg);
 add(button_pi1);
}
 
void screen1ViewBase::setupScreen()
{
 
}
 
void screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
 if (&src == &button_pi1)
 {
 //toggle_gpio
 //When button_pi1 clicked call virtual function
 //Call toggle_gpio
 toggle_gpio();
 }
}

This topic has been closed for replies.

3 replies

Damien Ratazy
Associate III
December 17, 2019

Here a screenshot of TouchGFX designer :

0690X00000BuhkmQAB.png

ssara.19
Visitor II
November 26, 2021

I also have the same issue. I didn't get any documents or code for how to write gpio in touchgfx. how to use touchgfx gpio::set, clear. please provide some examples

hasa.1
Visitor II
April 23, 2022

I failed to neglect this request! This become a 3rd celebration hosted webinar and what was offered there may be used for our upcoming hosted STM32H7 Dual Core webinar on on to use the 30-06 ammo, which have to be recorded as well. Click here to sign up...