C for Dumby, how to pass a variable to a response handler


I would like to pass an additional variable to a response handler. I have achieved this with a global variable which is sort-of uncool!? eg

s16 ATresponseH(adl_atResponse_t *paras){
int r;


I would like to do like this… I changed the syntax to the way it seems logical to me but this does not work

s16 ATresponseH(adl_atResponse_t *paras,u8 x){
int r;


How to do this properly?


Why do you think that the global variable is “uncool” :question:

It is the classic way to pass information between the “main” loop and an interrupt handler in microcontroller systems…

Instead of making the variable global, you could provide “getter” and “setter” functions, if you prefer…

Specifically for sending an additional parameter to an AT Command’s Response Handler, there is an API function which provides an additional “context” parameter…


Uncool … well I come from using micros with memory constraints, so for efficiency of memory use better to use locals? 2 bytes Irrelevant here really I guess!
What is the API function for passing additional information? Thanks


So you should be familiar with using globals to communicate between your ISRs and your “main loop”, then?

Yes - but clearly useless for communication between modules!