From: drowe67 Date: Sun, 31 Aug 2014 04:05:57 +0000 (+0000) Subject: PTT main loop working X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=534ecb1832e3be90d33fbae324f059c1c374c7b9;p=freetel-svn-tracking.git PTT main loop working git-svn-id: https://svn.code.sf.net/p/freetel/code@1821 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/stm32/src/sm1000_main.c b/codec2-dev/stm32/src/sm1000_main.c index 7639ce27..9683172a 100644 --- a/codec2-dev/stm32/src/sm1000_main.c +++ b/codec2-dev/stm32/src/sm1000_main.c @@ -45,7 +45,7 @@ int main(void) { /* init all the drivers for various peripherals */ - //sm1000_leds_switches_init(); + sm1000_leds_switches_init(); dac_open(4*DAC_BUF_SZ); adc_open(4*ADC_BUF_SZ); f = freedv_open(FREEDV_MODE_1600); @@ -58,15 +58,10 @@ int main(void) { TODO: [ ] UT analog interfaces from file IO [ ] UTs for simultaneous tx & rx on analog interfaces - [ ] measure CPU load of various parts with a blinky - [ ] ADC and DAC drivers - [ ] rate conversion [ ] detect program assert type errors with a blinky [ ] timer tick function to measure 10ms-ish type times [ ] switch debouncing? [ ] light led with bit errors - [ ] 16 to 8 kHz rate conversion - [ ] change freedv_api interface to float[] */ /* clear filter memories */ @@ -78,13 +73,13 @@ int main(void) { while(1) { - if (0) { + if (switch_ptt()) { /* Transmit -------------------------------------------------------------------------*/ /* ADC2 is the SM1000 microphone, DAC1 is the modulator signal we send to radio tx */ - if (adc1_read(&adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES_16K) == 0) { + if (adc2_read(&adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES_16K) == 0) { GPIOE->ODR = (1 << 3); fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], FREEDV_NSAMPLES); @@ -95,9 +90,9 @@ int main(void) { fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], FREEDV_NSAMPLES); - dac2_write(dac16k, FREEDV_NSAMPLES_16K); + dac1_write(dac16k, FREEDV_NSAMPLES_16K); - //led_ptt(1); led_rt(0); led_err(0); + led_ptt(1); led_rt(0); led_err(0); GPIOE->ODR &= ~(1 << 3); } @@ -120,7 +115,7 @@ int main(void) { // dac8k[FDMDV_OS_TAPS_8K+i] = adc8k[i]; fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], nout); dac2_write(dac16k, 2*nout); - //led_ptt(0); led_rt(f->fdmdv_stats.sync); led_err(f->total_bit_errors); + led_ptt(0); led_rt(f->fdmdv_stats.sync); led_err(f->total_bit_errors); GPIOE->ODR &= ~(1 << 3); }