How to call a function that uses a function pointer argument from Simulink?
27 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to load the following C code function as the C -Caller in the simulink.
There is no build error, but I can't find the function in the Function name.
I think, it can't recognize Void (*func) (CONST IF_AppDiagStatus_t), one of the argument of the function. (Use of function pointer)
Is there a way to solve this?
********************************************************************************************************************************************
void IF_AppDiagSetFuncForGetDiagStatus(void(*func)(CONST IF_AppDiagStatus_t), CONST App_ID_e appID)
{
if (appID < APP_ID_END)
{
appDiagGetFunc[appID].getDiagStatusFunc = func;
}
}
2 Commenti
Risposte (1)
Benjamin Thompson
il 21 Gen 2024
Simulink only supports certain data types as inputs to blocks: integers, double, single, busses, enumerations, or arrays of those basic types. How would Simulink know how to pass a memory address pointer to your block as an input? If your C code defines an array of C functions in appDiagGetFunc, can your block use an integer input for appID? Then Simulink can pass an integer to the C Caller block to select which function in appDiagGetFunc to call.
2 Commenti
Benjamin Thompson
il 27 Gen 2024
If your question has been answered please accept it. If you would like more help with the problem please provide more information and the Community can suggest different approaches.
Vedere anche
Categorie
Scopri di più su Nonlinear Operators in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!