void ISR_AIC() { wave=mono_read_16Bit(); if(wave>0){ wave=-wave; } mono_write_16Bit(wave); }
void non_circ_FIR() { int i; double y=0; for(i=0;i<N;i++){ //loop through the array and perform convolution y+=x[i]*coefs[i]; } mono_write_16Bit((short)y);//write to output port }
void direct_form_2_transposed() { int i; double xin; xin=(double)mono_read_16Bit();//read input buf[0]=b[0]*xin+buf[1];//generate output for(i=1;i<N;i++){ buf[i]=xin*b[i]-buf[0]*a[i]+buf[i+1]; } buf[N]=xin*b[N]-buf[0]*a[N];//perform MAC on the last buffer mono_write_16Bit((short)buf[0]); }
void ISR_AIC() { int i; y=0; root->n=mono_read_16Bit(); for(i=N;i>0;i--){ root=root->next; y+=(root->n)*coefs[i-1]; } root=root->next; mono_write_16Bit((short)y); }
void direct_form_2() { int i; double yout=0; buf[0]=(double)mono_read_16Bit(); //read input for(i=N;i>0;i--){ //perform filter buf[0]-=buf[i]*a[i]; yout+=buf[i]*b[i]; buf[i]=buf[i-1]; } yout+=buf[0]*b[0]; mono_write_16Bit((short)yout);//output filter result }
void ISR_AIC(void) { short sample; /* Read and write the ADC and DAC using inbuffer and outbuffer */ sample = mono_read_16Bit(); inbuffer[io_ptr] = ((float)sample)*ingain; /* write new output data */ mono_write_16Bit((int)(outbuffer[io_ptr]*outgain)); /* update io_ptr and check for buffer wraparound */ if (++io_ptr >= CIRCBUF) io_ptr=0; }
void ISR_AIC(void) { /* * Since we have to write a 16 bit value, we cast to `short`, since there is no half * precision floating point number type in C. However, since our sample will be between * -1 and 1, casting to a short would mean we would only ever get the values 0, 1 and * -1. So, we scale the value up by 2^15-1 (since 2^15 would cause overflow and * incorrect output) before casting to ensure we don't lose information in the cast. */ float shifted_sample = sinegen()*32767; sample = (short)fabs(shifted_sample); mono_write_16Bit(sample); }
void ISR_AIC(void) { short sample; float scale = 11585; sample = mono_read_16Bit(); /* add new data to input buffer and scale so that 1v ~= 1.0 */ input[index] = ((float)sample)/scale; /* write new output data */ mono_write_16Bit((short)(output[index]*scale)); /* update index and check for full buffer */ if (++index == BUFFLEN) index=0; }
void ISR_AIC(void){ double output = IIRFilter(mono_read_16Bit()); mono_write_16Bit((Int16) output); }
void ISR_AIC(void){ double sample = 0, output = 0; sample = mono_read_16Bit(); // read circ_FIR_DP(&X_PTR, b, &sample, &output, N); mono_write_16Bit((Int16) output); }
void ISR_AIC() { mono_write_16Bit(mono_read_16Bit()); }