void dsp_process_init(int cpu_hz, int hsb_hz, int pba_hz, int pbb_hz) { // Initialize TPA6130 tpa6130_init(); // Initialize DAC that send audio to TPA6130 tpa6130_dac_start(DAC_SAMPLING_RATE, DAC_NUM_CHANNELS, DAC_BITS_PER_SAMPLE, DAC_SWAP_CHANNELS, audio_callback, AUDIO_DAC_RELOAD_CB, FOSC0); tpa6130_set_volume(0x20); tpa6130_get_volume(); signal_source_init(&signal1_generator, 433, 20000); signal_source_init(&signal2_generator, 2000, 10000); current_stereo_out_buf = stereo_out_buf1; signal_in_buf = signal_pre_filter_buf + FIR_NUM_COEF; filter_restore_default(); /* Fill the initial buffer for the hamming window with ones. This buffer * will then be multiplied by the hamming window. */ dsp16_gen_step(fft_window, BUFFER_LENGTH, DSP16_Q(1.), DSP16_Q(1.), 0); dsp16_win_hamm(fft_window, fft_window, BUFFER_LENGTH); /* Run the interrupt handler manually once to start the ABDAC */ dac_reload_callback(); }
void audio_callback(U32 arg) { if( arg == AUDIO_DAC_OUT_OF_SAMPLE_CB ) { dac_overrun_callback(); } else if( arg == AUDIO_DAC_RELOAD_CB ) { dac_reload_callback(); } else if( arg == AUDIO_ADC_OUT_OF_SAMPLE_CB ) { } else if( arg == AUDIO_ADC_RELOAD_CB ) { } }
void master_callback(uint32_t arg) { if( arg == AUDIO_DAC_OUT_OF_SAMPLE_CB ) { dac_overrun_callback(); } else if( arg == AUDIO_DAC_RELOAD_CB ) { dac_reload_callback(); } else if( arg == AUDIO_ADC_OUT_OF_SAMPLE_CB ) { adc_underrun_callback();; } else if( arg == AUDIO_ADC_RELOAD_CB ) { adc_reload_callback();; } }