From: baobrien Date: Thu, 23 Jun 2016 01:23:57 +0000 (+0000) Subject: Started work on test util to dump adc samps over USB X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=de3b684a4a00062f05d26fb3eea451fc137803cd;p=freetel-svn-tracking.git Started work on test util to dump adc samps over USB git-svn-id: https://svn.code.sf.net/p/freetel/code@2830 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/stm32/src/sm2000_adc_dump.c b/codec2-dev/stm32/src/sm2000_adc_dump.c new file mode 100644 index 00000000..f08fb9ca --- /dev/null +++ b/codec2-dev/stm32/src/sm2000_adc_dump.c @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: sm2000_stw.c + AUTHOR......: David Rowe + DATE CREATED: June 2016 + + Test program to support SM2000 "set to work" - tetsing and bring up. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2016 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. This program is + distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see . +*/ + +#include +#include "new_i2c.h" +#include "si53xx.h" +#include "debugblinky.h" +#include "sm1000_leds_switches.h" +#include "stm32f4_dac.h" +#include "stm32f4_adc.h" +#include "stm32f4_usb_vcp.h" + +#define SINE_SAMPLES 24 + +/* 32 sample sine wave which at Fs=16kHz will be 500Hz. Note samples + are 16 bit 2's complement, the DAC driver convertsto 12 bit + unsigned. */ + +short aSine[] = { + 5000, -2500, -2500, 5000, -2500, -2500, + 5000, -2500, -2500, 5000, -2500, -2500, + 5000, -2500, -2500, 5000, -2500, -2500, + 5000, -2500, -2500, 5000, -2500, -2500 +}; +short zeros[SINE_SAMPLES]; + +int main(void) { + int ret, ptt, i; + uint64_t freq_in_Hz_times_100; + + for(i=0; i