How to implement interrupt (or task) inside While Loop in *.CPP file without void loop()

I have this code running in STM32F469 DISCO KIT: https://github.com/neuberfran/discovery7/blob/main/applications/lvgl/demo/ui/ui_events.cpp

The lib SmartDrive Makes the motor run for 5 seconds (by default). When I want to stop the motor before that time, I click the stop button it works ok. Or else the motor stops by itself in 5s

But, when I want the motor to run for more than 5 seconds I need to put this routine: smd.Run_Unlimited(SmartDrive_Motor_ID_1, SmartDrive_Dir_Reverse, 90); in While - Loop.

At that moment my issue enters because I am not able to stop the motor through the code below. Does anyone have any tips on how to resolve this? Would I have to use interrupt? Would I have to use another task? How to use?

New ui_events.cpp File with issue:

#include <Arduino.h>
#include "ui.h"
#include <SmartDrive.h>

SmartDrive smd = SmartDrive(SmartDrive_DefaultAddress);

bool STOP01 =  true;
#define STOP02  0

void run01right(lv_event_t * e)
{
    // Your code here
    while (STOP01)
    {
    smd.Run_Unlimited(SmartDrive_Motor_ID_1, SmartDrive_Dir_Reverse, 90);
    }
    STOP01 = true;
}


void stopmotor01(lv_event_t * e)
{
    // Your code here
    STOP01 = false;
    smd.StopMotor(SmartDrive_Motor_ID_1, SmartDrive_Action_Brake);
    STOP01 = true;

}

void run01left(lv_event_t * e)
{
    // Your code here
    while (STOP01)
    {
    smd.Run_Unlimited(SmartDrive_Motor_ID_1, SmartDrive_Dir_Forward, 90);
    }
    STOP01 = true;
}

Note : As the First photo below, it is not possible to implement void loop in this case.

How is it related to LVGL?

@kisvegabor https://github.com/neuberfran/discovery7/blob/main/packages/LVGL-v8.3.1/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino

I’ve tried several things (enabled logging in RT-Thread OS, etc…etc…) and I can’t see the Logs of this LVGL_Arduino.ino in my Console. Why ?

Note: I have two lv_conf.h im my project:

I still can’t see how it is an LVGL (GUI) related issue, to do something asynchronously while you are running a blocking loop.

It seems like it’s a question for Arduino or RT-Thread.