[ create a new paste ] login | about

Link: http://codepad.org/NRs4EKxs    [ raw code | output | fork ]

C, pasted on Aug 19:
arm_cfft_radix2_instance_q15 fftInstance;
static u32 curInputCursor=0;
static u32 dataIsReady = 0; /**< Флаг для начала преобразования фурье */
static q15_t input [2048]; /**< входной массив данных */
static q15_t output [1024]; /**< выходной массив данных */

/** @brief прерывание по таймеру с частотой 1024 Гц */
extern "C" void timerInterrupt (void)
{
	input[curInputCursor++]=uhADCxConvertedValue; /**< Набираю 1024 замера */
	if (curInputCursor>=1024) 
	{
		curInputCursor = 0;
		dataIsReady = 1; /**< Флаг, сигнализирующий, что выборка готова */
		HAL_TIM_Base_DeInit(&htim1); /**< Как только набралось отключаю таймер, чтобы остановить забор замеров */
	}
	invertLed(); /**< Инвертирую ногу, чтобы на осциллографе проверить действительно ли частота дискретизации 1024 Гц (да, именно так) */
}

/** @brief задача, которая занимается преобразованием фурье */
static void fftTask (void *p) 
{
	q15_t maxValue;				/* Max FFT value is stored here */
	uint32_t maxIndex;				/* Index in Output array where max value is */

	while(1)
	{
		if (dataIsReady)
		{
			dataIsReady = 0;

			arm_cfft_radix2_init_q15 (&fftInstance, 1024, 0, 1);
			arm_cfft_radix2_q15(&fftInstance, input);
			arm_cmplx_mag_q15 (input, output, 1024);
			u32 index;
			saveFft();
			timInit(); /**< Снова запускаю таймер для подготовки следующих 1024 замеров */
		}
		vTaskDelay(5000);
	}
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Line 1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fftInstance'
Line 2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'curInputCursor'
Line 3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'dataIsReady'
Line 4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'input'
Line 5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'output'
Line 8: error: expected identifier or '(' before string constant
In function 'fftTask':
Line 23: error: 'q15_t' undeclared (first use in this function)
Line 23: error: (Each undeclared identifier is reported only once
Line 23: error: for each function it appears in.)
Line 23: error: expected ';' before 'maxValue'
Line 24: error: 'uint32_t' undeclared (first use in this function)
Line 24: error: expected ';' before 'maxIndex'
Line 28: error: 'dataIsReady' undeclared (first use in this function)
Line 32: error: 'fftInstance' undeclared (first use in this function)
Line 33: error: 'input' undeclared (first use in this function)
Line 34: error: 'output' undeclared (first use in this function)
Line 35: error: 'u32' undeclared (first use in this function)
Line 35: error: expected ';' before 'index'


Create a new paste based on this one


Comments: