Hello Ranieri!
ESP32-specific code cannot execute on STM32. Generic C code can be integrated in a PLECS model using the C-script block. This is an advanced block that is difficult to use.
Reading signals from a quadrature encoder should necessitate only the QEP block from the STM32 Target Support Package, and not additional code ported from an ESP32. Is this post related to your previous post ( Encoder with stm32 - #14 by Ranieri.Mazzini )? If that is the case, it would probably best to schedule a web meeting to investigate the issue.