⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpt.c

📁 zigbee 飞思卡尔 音频传输 基于ucos的所有源码
💻 C
字号:
#include "tab_cpt.h"
void initial_cpt(int, int *, int *);
int cpt_enter = 0;
int burst_duration=0;
int silent_duration=0;

//add by michael chen
extern int index_cpt;

int cpt()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
{
  int i;
  int cpt_out;

  //comment by michael chen
  //int index_cpt = 3;		//for dial tone, index=0
							//for audio ringback, index=1
							//for busy tone, index=2
							//for reoder tone, index=3
if(cpt_enter == 0)
{
	
     SIN_TAB[0] = 0x22BE8F87;     //350Hz
     SIN_TAB[1] = 0x2B5BC3A0;		//440Hz		
     SIN_TAB[2] = 0x2F1EB491;		//480Hz
     SIN_TAB[3] = 0x3BE51FC8;
	TONES_TAB[0] = 0x7B31BBB2;
	TONES_TAB[1] = 0;
	TONES_TAB[2] = 0;
    TONES_TAB[3] = 0x786EC7F2;
	TONES_TAB[4] = 0;
	TONES_TAB[5] = 0;
	TONES_TAB[6] = 0x7702EA77;
	TONES_TAB[7] = 0;
	TONES_TAB[8] = 0;
	TONES_TAB[9] = 0x711F3B6F;
	TONES_TAB[10] = 0;
	TONES_TAB[11] = 0;
    amplitude[0] = 0xF5895457;		//-13dBm
	amplitude[1] = 0xFAC17C0A;		//-19dBm
	amplitude[2] = 0xFD0D0C4E;		//-24dBm
	offset_dial[0] = 0;				//dial tone offset in amplitude
	offset_dial[1] = 0;  			//350Hz offset in SIN_TAB
	offset_dial[2] = 4;  			//440Hz offset in SIN_TAB
	offset_dial[3] = 8;				//350Hz offset(y(-2)) in TONES_TAB
	offset_dial[4] = 20;				//440Hz offset(y(-2)) in TONES_TAB
	offset_dial[5] = 0;
	offset_dial[6] = 12;
	 	   				
    offset_ringback[0] = 4;			//ringback tone offset in amplitude
	offset_ringback[1] = 4;			//440Hz offset in SIN_TAB
	offset_ringback[2] = 8;			//480Hz offset in SIN_TAB
	offset_ringback[3] = 20;			//440Hz offset(y(-2)) in TONES_TAB
	offset_ringback[4] = 32;			//480Hz offset(y(-2)) in TONES_TAB
	offset_ringback[5] = 12;
	offset_ringback[6] = 24;
	
	offset_busy_reorder[0]=8;		//busy and reorder tone offset in amplitude
	offset_busy_reorder[1]=8;		//480Hz offset in SIN_TAB
	offset_busy_reorder[2]=12;		//620Hz offset in SIN_TAB
	offset_busy_reorder[3]=32;		//480Hz offset(y(-2)) in TONES_TAB
	offset_busy_reorder[4]=44;		//620Hz offset(y(-2)) in TONES_TAB
	offset_busy_reorder[5]=24;
	offset_busy_reorder[6]=36;
	initial_cpt(index_cpt, &burst_duration, &silent_duration);
	cpt_enter = 1;
}
/*	for (i = 0;i<12;i++)
		printf("TONES_TAB[%d] is %ld\n",i,TONES_TAB[i]);*/
	
	cpt_out = CPT_Generator(index_cpt, &burst_duration, &silent_duration);


  // 	printf("burst_duration is %d    silent_duration is %d   %d\n",burst_duration,silent_duration,cpt_out);

	if((burst_duration==0)&&(silent_duration==0))	
		initial_cpt(index_cpt, &burst_duration, &silent_duration);	
	return cpt_out;
	
}	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -