Created
February 27, 2016 02:56
-
-
Save CNG/951d378ce7376c7f5039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I forgot if I linked to this from anywhere or if I can delete this.