When two modules communicate, changing alloctionPriority can change the initialization order of the two modules.
Module A uses the MOD argument to get the pointer of module B.
At present, module B has been initialized, but the pointer of module B cannot be obtained in the constructor function of module A. The obtained value is 0.
But after a while, I can obtain the value of this pointer。Can you tell me how to get pointers to other modules in the constructor function or when calling the 'set' function with the mask value 0xFFFFFFFF?
Thanks !
2:40pm
Hello Yong,
You can add a module in your MATLAB code with add_module() function for example:-
add_module(SYS, delaymsec_module('Delay', 50));
Then you should be able to access the variable of this newly added module. In the set function if you want to ensure that the variable is called during initialization the Mask 0xFFFFFFF is used. If you want to update only when there is a change in the variable during run time then the 'special mask' from the header file needs to be used. you can also use to allocate memory in the constructor using the same S->Delay pointer.
For example:-
switch(mask)
{
case 0xFFFFFFFF:
delay = S->Delay;
func_set_delay(delay);
case MASK_YourModule_Delay:
delay = S->Delay;
func_set_delay(delay);
case 0x00000000:
break;
default:
;
}