cancel
Showing results for 
Search instead for 
Did you mean: 

Send variable from screen1View.cpp to Model.cpp

OBorz.1
Associate II

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!

22 REPLIES 22
OBorz.1
Associate II

Could you please tell me a working solution?

I am only trying to program Pong on the STM32429I-EVAL1. I want to control the racket with the joystick on the board. The pressing of the joystick shall be recognized by an interrupt. This joystick is connected to the processor via I²C. I am new on the mircocontroller area and therefore do not know my way around. Any help would be very valuable.

Many thanks in advance.

MM..1
Chief II

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
 
 }

OBorz.1
Associate II

I have implemented the code, but I can't get it to work. I implemented it in the while loop in the "int main(void)" function. But the state is not queried every time, or does not change when the joystick is pressed.

Is there no way to use the interrupt without aborts? I have invested a lot of time in it, so I don't want to throw it out. It works a few times, but aborts. I don't know what to do here.