From: sjlongland Date: Thu, 24 Sep 2015 08:11:49 +0000 (+0000) Subject: sm1000_main: Use tone generator module for TONE mode. X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=c5bad810f474a67bb59f4efce14fa29ab1a3eeae;p=freetel-svn-tracking.git sm1000_main: Use tone generator module for TONE mode. This replaces the old aSine array (now part of the tone module) with calls to make a continuous tone. git-svn-id: https://svn.code.sf.net/p/freetel/code@2358 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/stm32/src/sm1000_main.c b/codec2-dev/stm32/src/sm1000_main.c index 3287c4a9..a9c8f975 100644 --- a/codec2-dev/stm32/src/sm1000_main.c +++ b/codec2-dev/stm32/src/sm1000_main.c @@ -63,25 +63,13 @@ typedef struct { unsigned int downTicker = 0; unsigned int announceTicker = 0; +struct tone_gen_t tone_gen; struct sfx_player_t sfx_player; struct morse_player_t morse_player; void SysTick_Handler(void); void iterate_select_state_machine(SWITCH_STATE *ss); -#define SINE_SAMPLES 32 - -/* 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[] = { - -16, 6384, 12528, 18192, 23200, 27232, 30256, 32128, - 32752, 32128, 30256, 27232, 23152, 18192, 12528, 6384, - -16, -6416, -12560, -18224, -23184, -27264, -30288, -32160, - -32768, -32160, -30288, -27264, -23184, -18224, -12560, -6416 -}; - int main(void) { struct freedv *f; SWITCH_STATE ss; @@ -118,6 +106,8 @@ int main(void) { morse_player.dit_time = 60; /* 20 WPM */ morse_player.msg = NULL; + tone_reset(&tone_gen, 0, 0); + /* play a start-up tune. */ sfx_play(&sfx_player, sound_startup); @@ -194,10 +184,19 @@ int main(void) { dac1_write(dac16k, n_samples_16k); } if (ss.mode == TONE) { - short buf[SINE_SAMPLES]; - for(i=0; i n_samples_16k) + len = n_samples_16k; + for(i=0; i