Пример #1
0
// -----------------------------------------------------------------------------
// CMccCodecRed::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CMccCodecRed::ConstructL()
    {
    iSdpName.Copy( KRedSdpName );

    iFmtpAttr = HBufC8::NewL( 1 );
    TPtr8 ptr = iFmtpAttr->Des();
    ptr.Append( KNullDesC );
    
    SetSamplingFreq( KRedSamplingFreq );
    EnableVAD( EFalse );
    SetMaxPTime( KRedMaxPTime ); // recommended "limit" 200ms
    SetPTime( KRedPTime ); // default 20ms 
    SetPayloadType( KDefaultRedPT );  
    
    iFourCC = KMccFourCCIdRed;
    iCodecMode = ENothing;
    
    iPayloadFormatEncoder = KImplUidRedPayloadFormatEncode;
    iPayloadFormatDecoder = KImplUidRedPayloadFormatDecode;
    }
Пример #2
0
// -----------------------------------------------------------------------------
// CMCCCodecILBC::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CMCCCodecILBC::ConstructL()
    {
    __INTERFACE( "CMCCCodecILBC::ConstructL()" )
     
    SetSdpName( KILBCSdpName );
    iKeepAliveData.Copy( KiLBCKeepAlivePayload30ms ); 
    
    SetSamplingFreq( KIlbcSampleRate );
    iHwFrameTime = KIlbcHwFrameTime; // default 30ms    
    SetBitrate( KIlbcBitrate30 ); // 30ms framesize used as default
    EnableVAD( EFalse );
    SetPayloadType( KDefaultIlbcPT );
    SetMaxPTime( KIlbcMaxPTime );
    SetPTime( KIlbcPTime );
        
    iFourCC = KMccFourCCIdILBC;
    iCodecMode = ENothing;
    
    iPayloadFormatEncoder = KImplUidiLBCPayloadFormatEncode;
    iPayloadFormatDecoder = KImplUidiLBCPayloadFormatDecode;
    }
Пример #3
0
void main()
{
	unsigned char c;

	Init_Device();

	CheckSRAMs();

	LED=0;
	adc_select=3;
	ADC0ConfigEven=ADC0ConfigOdd=0;		// adc0 gain and channel selection for every even sample and every odd sample
	ADC1ConfigEven=ADC1ConfigOdd=0;
	DAC0_mode=0;
	handshake=1;
	dac_increment=1;
	dac_amplitude=255;
	dac_offset=0;
	fifo_size=128;	// default number of samples in a block

	RTS=0;

	while (1)
	{
		while (SInOut()!='@');
		c=SInOut();
		if (c=='I')
		{
			SendID();
		}
		else if (c=='x')	// switch reference voltage and resistors
		{
			c=SInOut();
			SW0 = !(c&1);	// 1: 10k resistor connected to input, 0: input floating
			SW1 = !(c&2);
			SW2 = !(c&4);
			SW3 = !(c&8);
			PULL = !(c&16);	// 1: pull up to Vref, 0: pull down to GND
		}
		else if (c=='t')	// set trigger polarity
		{
			c=SInOut();
			TRIGINV = c&1;
		}
		else if (c=='b')	// set fifo block size (number of samples in a block
		{
			fifo_size=SInOut();
		}
		else if (c=='c')	// configure continuous sampling mode
		{
			ADC0ConfigEven=SInOut();
			ADC1ConfigEven=SInOut();
			ADC0ConfigOdd=SInOut();
			ADC1ConfigOdd=SInOut();
		}
		else if (c=='S') // start sampling, ESC exits
		{
			ContSampling();
		}
		else if (c=='s') // start sampling, ESC exits
		{
			unsigned long n;

			n = SInOut();
			n = (n << 8)+SInOut();
			n = (n << 8)+SInOut();
			SetSamplingFreq(n);
			n = SInOut();
			n = (n << 8)+SInOut();
			HiSpeedSampling(n);
//			SamplingToSRAM(SInOut());
		}
		else if (c=='A') // select ADCs
		{
			adc_select = SInOut() & 3;
		}
		else if (c=='1') // set range, current, channel
		{
			c=SInOut();
			SetPGA0(c);
		}
		else if (c=='2') // set range, current, channel
		{
			c=SInOut();
			SetPGA1(c);
		}
		else if (c=='M') // measure channels
		{
			c=SInOut();
			if (c<1) c=1;
			Convert(c); // make a single conversion and send data to PC
			SOut(adc1data >> 8);	// channel 0 or 1
			SOut(adc1data);
			SOut(adc0data >> 8);	// channel 2 or 3
			SOut(adc0data);
		}
		else if (c=='f') // set freq
Пример #4
0
void main()
{
	unsigned char c;

	Init_Device();

	CheckSRAMs();

	adc_select=3;
	ADCConfigEven=ADCConfigOdd=0;		// adc0 gain and channel selection for every even sample and every odd sample
	DAC0_mode=0;
	handshake=1;
	dac_increment=1;
	dac_amplitude=255;
	dac_offset=0;
	fifo_size=128;	// default number of samples in a block

//fifo_size=4;	// default number of samples in a block
//SetSamplingFreq(100);

	for(c=0; c<3; c++)	// flash the power LED three times to indicate booting
	{
		LED=0;	Delay_ms(200);
		LED=1;	Delay_ms(200);
	}
	LED=0;


	RTS=0;




	while (1)
	{
		while (SInOut()!='@');
		c=SInOut();
		if (c=='I')
		{
			SendID();
		}
		else if (c=='x')	// switch reference voltage and resistors
		{
		}
		else if (c=='t')	// set trigger polarity
		{
		}
		else if (c=='b')	// set fifo block size (number of samples in a block
		{
			fifo_size=SInOut();
		}
		else if (c=='c')	// configure continuous sampling mode
		{
			c=SInOut();
			ADCConfigEven = ((c & 1) << 4) | ((c & 2) << 2);
			c=SInOut();
			ADCConfigEven =  ((c & 1) << 5) | ((c & 2) << 5);
			c=SInOut();
			ADCConfigOdd = ((c & 1) << 4) | ((c & 2) << 2);
			c=SInOut();
			ADCConfigOdd =  ((c & 1) << 5) | ((c & 2) << 5);
		}
		else if (c=='S') // start sampling, ESC exits
		{
			ContSampling();
		}
		else if (c=='s') // start sampling, ESC exits
		{
			unsigned long n;

			n = SInOut();
			n = (n << 8)+SInOut();
			n = (n << 8)+SInOut();
			SetSamplingFreq(n);
			n = SInOut();
			n = (n << 8)+SInOut();
			HiSpeedSampling(n);
		}
		else if (c=='A') // select ADCs
		{
			adc_select = SInOut() & 3;
		}
		else if (c=='1') // set channel
		{
			c=SInOut();
			MUX1A0 = c & 1;
			MUX1A1 = c & 2;
		}
		else if (c=='2') // setchannel
		{
			c=SInOut();
			MUX2A0 = c & 1;
			MUX2A1 = c & 2;
		}
		else if (c=='M') // measure channels
		{
			c=SInOut();
			if (c<1) c=1;
			Convert(c); // make a single conversion and send data to PC
			SOut(adc1data >> 8);	// channel 0 or 1
			SOut(adc1data);
			SOut(adc0data >> 8);	// channel 2 or 3
			SOut(adc0data);
		}
		else if (c=='f') // set freq