cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746G-DISCO, FreeRTOS, TouchFGX

AD�?b
Senior

If I call the function with the button from the STM32F746G-DISCO screen, e.g. a counter, do I have to use FreeRTOS to display the value of the counter on the screen?

1 ACCEPTED SOLUTION

Accepted Solutions

In that case just follow the instructions in the pinned post in this forum, there's information on that. Generally:

1) Fetch the value from your other RTOS task inside Model::tick()

2) implement a function in the modelListener interface to handle this value (temperatureUpdated(uint8_t _temp))

3) Notify active presenter of this new value: modelListener->temperatureUpdated(val)

4) Implement that function in your presenter.

5) Call something on the view to update the temperature, maybe text area.

/Martin

View solution in original post

10 REPLIES 10
Martin KJELDSEN
Chief III

You do not have to use an RTOS. I'm not 100% sure what you mean by "if i call the function with the button".

Generally: The Model class (Model.cpp) is the heart of a TouchGFX application. This is where you will interface with e.g. OS message queues to get values from other tasks, or you could simply sample a GPIO port directly inside Model::tick() if you wanted. A Model knows about a ModelListener (as modelListener). Use this interface to propagate values to your active screen.

modelListener->temperatureUpdated(temp);

Please see the pinned post/sticky on integrating hardware with your UI.

If you're generating this value yourself you can also simply use the same interface

/Martin

Hi Martin

Thank you.

There is a button on the STM32F746-DISCO desktop. It calls the pulse counting function. I want to display the number of pulses.

I have in main.cpp

struct {

   uint32_t duty; // obroty silników

   uint8_t count_poster; // okno

   uint8_t posters; // ile okien

   uint16_t time; // czas postoju

} my_var;

in Model.hpp

uint8_t getmy_var.count_poster() const {return currentmy.var_count_poster;}

   void tick();

protected:

uint8_t currentmy_var.count_poster;

why syntax error?

I'm not sure what you mean by "desktop", hmm.

Where are you counting these pulses?

/Martin

"desktop" - screen STM32F746G-DISCO.

The pulses are counted in the program's main.c file in the second RTOS task. I want to display the number of pulses.

In that case just follow the instructions in the pinned post in this forum, there's information on that. Generally:

1) Fetch the value from your other RTOS task inside Model::tick()

2) implement a function in the modelListener interface to handle this value (temperatureUpdated(uint8_t _temp))

3) Notify active presenter of this new value: modelListener->temperatureUpdated(val)

4) Implement that function in your presenter.

5) Call something on the view to update the temperature, maybe text area.

/Martin

Hello

Thank you for the advice. It works.

How to make it work step by step in the reverse direction from the screen to the variable in the system?

I analyzed "Tutorial 3".

The clock works except reducing the hours on the screen 1?

The view has a pointer to the presenter, the presenter has a pointer to the model

View:
presenter->updateValue(value);
 
Presenter:
model->saveValue(value);

I have such a mistake:

C:/STM32CubeIDE/workspace_1.1.0/poster/Debug/../TouchGFX/gui/src/second_screen/SecondPresenter.cpp:21: undefined reference to `Model::GetNumberPosters()'

How and where to fix it?

In Model.hpp I have:

uint8_t GetNumberPosters();

In Model.cpp I have:

uint8_t GetNumberPosters() {

   return bufnumberposters;

}