Skip to content

Instantly share code, notes, and snippets.

@CNG
Created February 27, 2016 02:56
Show Gist options
  • Save CNG/951d378ce7376c7f5039 to your computer and use it in GitHub Desktop.
Save CNG/951d378ce7376c7f5039 to your computer and use it in GitHub Desktop.
volatile int bufn,obufn;
uint16_t buf[5][128];
q15_t out[640];
q15_t outsq[1280];
void ADC_Handler(){
int f=ADC->ADC_ISR;
if (f&(1<<27)){
bufn=(bufn+1);if(bufn==5)bufn=0;
ADC->ADC_RNPR=(uint32_t)buf[bufn];
ADC->ADC_RNCR=128;
}
}
void loop(){
while(obufn==bufn);
obufn=bufn;
int bb=bufn+1;if(bb==5)bb=0;
uint16_t *q=buf[0]+128*bb;
for(int j=0;j<512;j++){
int t=(*q++)-2048;
if(q==(buf[0]+640))q=buf[0];
out[j]=t<<4;
}
// ...
}
@CNG
Copy link
Author

CNG commented Apr 20, 2017

I forgot if I linked to this from anywhere or if I can delete this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment