I have some c-methods that should be called from XC, but due to speed they also needs to be inlined in the code.
Everything works if I skip the the static e.g. only inline, (and the methods doesn't get inlined)
But adding static inline in the c-file makes the compiler complain:
Undefined reference to 'my method'
How should the static and the inline, (or do I need extern) look like in the c-file and the corresponding h-file, so it can be called from XC ?
Since I only need one LCD buffer inte the entire code, I use the short method without sending the reference/pointer to the buffer with the call to the methods.
Code: Select all
/*
* Buf.c
*
*/
#include "LCD_Comp_Def.h"
static int BUF0[LCD_WIDTH_PX];
static int BUF1[LCD_WIDTH_PX];
void init_Buf(void){
int y;
for(y=0;y<LCD_WIDTH_PX;y++){
BUF0[y]=0;
BUF1[y]=0;
}
}
static inline int PULL(unsigned page,unsigned y){
if(page)
return BUF1[y];
else
return BUF0[y];
}
static inline void PUSH(unsigned page,unsigned y, int val){
if(page)
BUF1[y]=val;
else
BUF0[y]=val;
}