Пример #1
0
int main(void)
{
//init:
    DAC_DeInit();
	init_GPIOA();
    init_GPIOC();
    init_GPIOD();
    init_DMA1();
    init_DMA2();
    init_TIM2();
    init_TIM3();
    init_TIM4();
    init_TIM6();
    init_ADC3();
	init_DAC();
	init_filter(&ap_1);
	init_filter(&ap_2);
	init_filter(&ap_3);
	init_filter(&ap_4);
	ap_filter_coefs(&ap_1);
	ap_filter_coefs(&ap_2);
	ap_filter_coefs(&ap_3);
	ap_filter_coefs(&ap_4);
    ADC_SoftwareStartConv(ADC3);
    while (1)
    {
		counter++;
    }
}
Пример #2
0
//====================================================================
// MAIN FUNCTION
//====================================================================
void main (void){
	init_LCD();
	init_GPIO();
	//Get operating CLK freq
	RCC_ClocksTypeDef CLK;
	RCC_GetClocksFreq(&CLK);
	sysclock= (CLK.SYSCLK_Frequency)/((float)(pow(10,6)));
	//Sys clocks in MHz
	sprintf(lcdstring,"CLK %d MHz",sysclock);
	lcd_putstring(lcdstring);
	lcd_command(LINE_TWO);
	lcd_putstring("Servo Step Test, SW0");
	//Init procedure waits for SW0
	while(GPIO_ReadInputData(GPIOA)&GPIO_IDR_0){}
	lcd_command(CLEAR);
	init_ADC();
	init_EXTI();
	init_USART1();
	init_TIM2();
	init_TIM3();
	init_TIM14();
	init_TIM17();
	for(;;){
		while(TIM3OC2<=3800){
			TIM3OC2++;
			TIM_SetCompare2(TIM3,TIM3OC2);
			for(int x=0;x<=255;x++){
				for(int y=0;y<=255;y++){}
			}
		}
		lcd_command(CURSOR_HOME);
		sprintf(lcdstring,"ADC:%d     ",(int) ADCval);
		lcd_putstring(lcdstring);
		lcd_command(LINE_TWO);
		sprintf(lcdstring,"TIM:%d     ",(int) TIM2->CCR3);//TIMcmp);
		//TIM_SetCompare2(TIM3,(int)(64000*((0.9+1.1*ADCval/2047.0)/20.0)));
		lcd_putstring(lcdstring);
	}
}											// End of main
Пример #3
0
int main(void)
{
	WWDG_SetPrescaler(WWDG_Prescaler_8);
//init:
	for(k=0; k<VECSIZE; k++) //initialize output vector
	{
		DAC1ConvertedValue[k] = 0;
		DAC2ConvertedValue[k] = 0;
	}

//	init_filter(&ap_1);
//	init_filter(&ap_2);
//	init_filter(&ap_3);
//	init_filter(&ap_4);
	for(k = 0; k<nfilters; k++)
	{
		//init_filter(&filters[k]);
	}

//	ap_filter_coefs(&ap_1);
//	ap_filter_coefs(&ap_2);
//	ap_filter_coefs(&ap_3);
//	ap_filter_coefs(&ap_4);
	for(k = 0; k<nfilters; k++)
	{
		//ap_filter_coefs(&filters[k]);
	}
	for(k = 0; k<VECSIZE; k++)
	{
		vector_a[k] = 0.0;
		vector_b[k] = 0.0;
	}

	noise.add = 3;
	noise.mod = gsize;
	noise.mul = 1;
	noise.out = 0;

	noise2.add = 3;
	noise2.mod = gsize;
	noise2.mul = 1;
	noise2.out = 0;

	noise3.add = 3;
	noise3.mod = gsize;
	noise3.mul = 1;
	noise3.out = 0;

	saw.add = 1.0/800;
	saw.mul = 1;
	saw.out = 0;
	saw.prev_add = 0;
	saw.slew = 0.994;

    melody.add = 1.0/10000;
	melody.mul = 1;
	melody.out = 0;
	melody.prev_add = 0;
	melody.slew = 0.9994;

    harmony.add = 1.0/10000;
	harmony.mul = 1;
	harmony.out = 0;
	harmony.prev_add = 0;
	harmony.slew = 0.9994;

    drone.add = 1.0/10000;
	drone.mul = 1;
	drone.out = 0;
	drone.prev_add = 0;
	drone.slew = 0.999994;

    dronelo.add = 1.0/10000;
	dronelo.mul = 1;
	dronelo.out = 0;
	dronelo.prev_add = 0;
	dronelo.slew = 0.99994;


	for(k = 0; k<(nfilters*5); k++) //repeat coefs nfilters times
	{
		coefTable[k] = coef_single[(k%5)];
	}
	arm_biquad_cascade_df2T_init_f32(
			&S1,
			nfilters,
			&coefTable,
			&biquadState);

    DAC_DeInit();
	init_GPIOA();
    init_GPIOC();
    init_GPIOD();
    init_DMA1();
    init_DMA2();
    init_TIM2();
    init_TIM3();
    init_TIM4();
    init_TIM6();
    init_ADC3();
	init_DAC();
    ADC_SoftwareStartConv(ADC3);
    while (1)
    {
		counter++;
    }
}