Hello @sana1 ,
To summarize, you have a STM32 running a TouchGFX application connected to a car through a FDCAN bus. You want to send a message/notification to the car when a button is pressed on your TouchGFX application.
To do so you first need to fetch the action in TouchGFX, transfer it to your main.c (STM32 application) and then send it through your FDCAN bus.
I can help you on the first part (sending from TouchGFX application to main.c).
However, I cannot help you on using your FDCAN bus as I do not know how it works and I have no experience with it.
To send a notification or data from a TouchGFX application to the main.c you need to use the MVP design. Find an article about it here : MVP design
Basically, what you have to do is to fetch the action (this can be done by using an interaction calling a new virtual function in your screen :

This way, a virtual function is called whenever you click that toggle button.
You then have to implement that function in your screen1view.hpp and screen1view.cpp and you have to propagate the notification to the model (screen1view.ccp => screen1presenter.cpp => model.cpp).
Then, from the model.cpp, you can include your main.h and be able to call any function from your main.
You just have to create a function in your main to send your message by calling your function to send data through your FDCAN bus which should look something like :
sendDataToCar("BSI RAPIDE ID 0xB6 period 50ms 00 00 0F A0 00 00 00 50");
Here are some resources that could help you :
- TouchGFX tutorial 3 to understand how to communicate with the MVP : TouchGFX tutorial 3
- TouchGFX technical video guide playlist : playlist youtube TouchGFX
- official TouchGFX (old version) guide on how to control hardware through GUI : control led from GUI (this is basically what you want to do)
- third party TouchGFX guide send data to main.c : send Data from UI to MCU (this is basically what you want to do)
You should have all you need there. I hope this helps you.
If this message solves your issue, I invite you to select it as "best answer".
Regards,