2020-12-17 04:07 AM
Hello,
I would like to send the value of a parameter from screen1View.cpp to Model.cpp.
Is there any way to do this?
I work with TouchGFX 4.14 and STM32429-Eval
Thanks!
Solved! Go to Solution.
2020-12-22 06:42 AM
When you are newbie, star twith simple think and irq use later. Working solution is config I2C in main and too in main create function to pool read state on joystick, no based on interrupt .
// recomm 400kHz I2C
#define I2CREADTIMEOUT 4
uint8_t joystik_GET_state(void)
{
uint8_t joystik_state[] = {0xFF};
HAL_I2C_Mem_Read(&hi2c1, 0x84, 0x0B, I2C_MEMADD_SIZE_8BIT, joystik_state, 1, I2CREADTIMEOUT);
return joystik_state[0];
}
in model tick
if (joystik_GET_state() &MASKBIT )
{
static_cast<FrontendApplication*>(Application::getInstance())->handleKeyEvent(88); // keycode from gui interaction
}
2020-12-17 04:34 AM
What do you mean by parameter? Do you mean a variable? If so define that in main.h for example as extern, then define it completely in main, and then include the header file.
2020-12-17 09:09 AM
Thanks for the quick replies.
Yes, I mean a variable.
Is it also possible to send the variable directly from screen1View to main.c?
I have already implemented the reverse way. From main.c to Model.cpp using xQueueSendFromISR
2020-12-17 09:26 AM
All peaple read and use complicated example on TouchGFX. Sending is hard multithread processing, in simple project you can use memory shared variables.
UNDERSTAND uintx_t var;
When is properly used can be changed or read on any place. Nothing sending is required.
But in handletick you need if for compare and detect changing this var .
if(lastvavr!=var) do change on screen.
2020-12-17 10:45 PM
I'm sorry I don't understand this way.
Do you have an example?
2020-12-18 03:05 AM
2020-12-20 07:28 AM
it works. Thank you very much!
2020-12-20 08:53 AM
Queues is good for situation, when you dont have reference value is displayed or not, or when exist big amount to display and make if for every is complicated.
Then you wait for queue event and then change display once per event. switch case or if is here same , but executed only on event received.
2020-12-20 11:12 PM
Hello OBorz.1,
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre
2020-12-21 12:23 AM
Hello,
I have no data to send.
With the queue I want to set a sign that something moves in the display.
Correct: I press the joystick button of the STM32429I-EVAL1 down and a bar in the display should move down.