Hi guys
I want to write a function that can be used in the main program and/or in interrupt. So my question is, can I write the function once, but only inline the function in interrupt?
I want to write a function that can be used in the main program and/or in interrupt. So my question is, can I write the function once, but only inline the function in interrupt?
Code:
uint8_t foo(uint8_t data);
uint8_t foo(uint8_t data){
// do stuff
}
void main(void){
while(1){
foo(data); // do not inline here
// other stuff
}
}
INTERRUPT_ISR(void){
if(ISR_FLAG){
inline foo(data); // inline here
}
}