Embedded System Programming Implements Following Code Kind Buffer Xbuff Explain Main Funct Q34240803
Embedded System Programming
What implements the following code and which kind of buffer isxbuff ?
(Explain the main functionalities of the code, no need toexplain every line.)
#define BUFFSIZE 11
double FIR( double x)
{
static double b[BUFFSIZE] ={ -0.0048,0.0032, 0.0413, -0.0133, -0.2896
0.5195, -0.2896, -0.0133, 0.0413,0.0032, -0.0048};
static double xbuff[BUFFSIZE] ;
static double* bottom_p= xbuff;
static double* fill_p= xbuff;
static double* read_p= xbuff ;
static double* top_p= bottom_p +(BUFFSIZE -1);
int i;
double y = 0;
*fill_p=x;
read_p=fill_p;
if (++fill_p> top_p){
fill_p= bottom_p;
}
for (i=0; i< BUFFSIZE; i++){
y = y + b[i] *(*read_p);
if ((++read_p) > top_p)
read_p=bottom_p;
}
return y;
}