├── Readme.md ├── STM32F4_QCopter_20130617 ├── Libraries │ ├── CMSIS │ │ ├── BasicMathFunctions │ │ │ ├── arm_abs_f32.c │ │ │ ├── arm_abs_q15.c │ │ │ ├── arm_abs_q31.c │ │ │ ├── arm_abs_q7.c │ │ │ ├── arm_add_f32.c │ │ │ ├── arm_add_q15.c │ │ │ ├── arm_add_q31.c │ │ │ ├── arm_add_q7.c │ │ │ ├── arm_dot_prod_f32.c │ │ │ ├── arm_dot_prod_q15.c │ │ │ ├── arm_dot_prod_q31.c │ │ │ ├── arm_dot_prod_q7.c │ │ │ ├── arm_mult_f32.c │ │ │ ├── arm_mult_q15.c │ │ │ ├── arm_mult_q31.c │ │ │ ├── arm_mult_q7.c │ │ │ ├── arm_negate_f32.c │ │ │ ├── arm_negate_q15.c │ │ │ ├── arm_negate_q31.c │ │ │ ├── arm_negate_q7.c │ │ │ ├── arm_offset_f32.c │ │ │ ├── arm_offset_q15.c │ │ │ ├── arm_offset_q31.c │ │ │ ├── arm_offset_q7.c │ │ │ ├── arm_scale_f32.c │ │ │ ├── arm_scale_q15.c │ │ │ ├── arm_scale_q31.c │ │ │ ├── arm_scale_q7.c │ │ │ ├── arm_shift_q15.c │ │ │ ├── arm_shift_q31.c │ │ │ ├── arm_shift_q7.c │ │ │ ├── arm_sub_f32.c │ │ │ ├── arm_sub_q15.c │ │ │ ├── arm_sub_q31.c │ │ │ └── arm_sub_q7.c │ │ ├── CommonTables │ │ │ └── arm_common_tables.c │ │ ├── ComplexMathFunctions │ │ │ ├── arm_cmplx_conj_f32.c │ │ │ ├── arm_cmplx_conj_q15.c │ │ │ ├── arm_cmplx_conj_q31.c │ │ │ ├── arm_cmplx_dot_prod_f32.c │ │ │ ├── arm_cmplx_dot_prod_q15.c │ │ │ ├── arm_cmplx_dot_prod_q31.c │ │ │ ├── arm_cmplx_mag_f32.c │ │ │ ├── arm_cmplx_mag_q15.c │ │ │ ├── arm_cmplx_mag_q31.c │ │ │ ├── arm_cmplx_mag_squared_f32.c │ │ │ ├── arm_cmplx_mag_squared_q15.c │ │ │ ├── arm_cmplx_mag_squared_q31.c │ │ │ ├── arm_cmplx_mult_cmplx_f32.c │ │ │ ├── arm_cmplx_mult_cmplx_q15.c │ │ │ ├── arm_cmplx_mult_cmplx_q31.c │ │ │ ├── arm_cmplx_mult_real_f32.c │ │ │ ├── arm_cmplx_mult_real_q15.c │ │ │ └── arm_cmplx_mult_real_q31.c │ │ ├── ControllerFunctions │ │ │ ├── arm_pid_init_f32.c │ │ │ ├── arm_pid_init_q15.c │ │ │ ├── arm_pid_init_q31.c │ │ │ ├── arm_pid_reset_f32.c │ │ │ ├── arm_pid_reset_q15.c │ │ │ ├── arm_pid_reset_q31.c │ │ │ ├── arm_sin_cos_f32.c │ │ │ └── arm_sin_cos_q31.c │ │ ├── FastMathFunctions │ │ │ ├── arm_cos_f32.c │ │ │ ├── arm_cos_q15.c │ │ │ ├── arm_cos_q31.c │ │ │ ├── arm_sin_f32.c │ │ │ ├── arm_sin_q15.c │ │ │ ├── arm_sin_q31.c │ │ │ ├── arm_sqrt_q15.c │ │ │ └── arm_sqrt_q31.c │ │ ├── FilteringFunctions │ │ │ ├── arm_biquad_cascade_df1_32x64_init_q31.c │ │ │ ├── arm_biquad_cascade_df1_32x64_q31.c │ │ │ ├── arm_biquad_cascade_df1_f32.c │ │ │ ├── arm_biquad_cascade_df1_fast_q15.c │ │ │ ├── arm_biquad_cascade_df1_fast_q31.c │ │ │ ├── arm_biquad_cascade_df1_init_f32.c │ │ │ ├── arm_biquad_cascade_df1_init_q15.c │ │ │ ├── arm_biquad_cascade_df1_init_q31.c │ │ │ ├── arm_biquad_cascade_df1_q15.c │ │ │ ├── arm_biquad_cascade_df1_q31.c │ │ │ ├── arm_biquad_cascade_df2T_f32.c │ │ │ ├── arm_biquad_cascade_df2T_init_f32.c │ │ │ ├── arm_conv_f32.c │ │ │ ├── arm_conv_fast_opt_q15.c │ │ │ ├── arm_conv_fast_q15.c │ │ │ ├── arm_conv_fast_q31.c │ │ │ ├── arm_conv_opt_q15.c │ │ │ ├── arm_conv_opt_q7.c │ │ │ ├── arm_conv_partial_f32.c │ │ │ ├── arm_conv_partial_fast_opt_q15.c │ │ │ ├── arm_conv_partial_fast_q15.c │ │ │ ├── arm_conv_partial_fast_q31.c │ │ │ ├── arm_conv_partial_opt_q15.c │ │ │ ├── arm_conv_partial_opt_q7.c │ │ │ ├── arm_conv_partial_q15.c │ │ │ ├── arm_conv_partial_q31.c │ │ │ ├── arm_conv_partial_q7.c │ │ │ ├── arm_conv_q15.c │ │ │ ├── arm_conv_q31.c │ │ │ ├── arm_conv_q7.c │ │ │ ├── arm_correlate_f32.c │ │ │ ├── arm_correlate_fast_opt_q15.c │ │ │ ├── arm_correlate_fast_q15.c │ │ │ ├── arm_correlate_fast_q31.c │ │ │ ├── arm_correlate_opt_q15.c │ │ │ ├── arm_correlate_opt_q7.c │ │ │ ├── arm_correlate_q15.c │ │ │ ├── arm_correlate_q31.c │ │ │ ├── arm_correlate_q7.c │ │ │ ├── arm_fir_decimate_f32.c │ │ │ ├── arm_fir_decimate_fast_q15.c │ │ │ ├── arm_fir_decimate_fast_q31.c │ │ │ ├── arm_fir_decimate_init_f32.c │ │ │ ├── arm_fir_decimate_init_q15.c │ │ │ ├── arm_fir_decimate_init_q31.c │ │ │ ├── arm_fir_decimate_q15.c │ │ │ ├── arm_fir_decimate_q31.c │ │ │ ├── arm_fir_f32.c │ │ │ ├── arm_fir_fast_q15.c │ │ │ ├── arm_fir_fast_q31.c │ │ │ ├── arm_fir_init_f32.c │ │ │ ├── arm_fir_init_q15.c │ │ │ ├── arm_fir_init_q31.c │ │ │ ├── arm_fir_init_q7.c │ │ │ ├── arm_fir_interpolate_f32.c │ │ │ ├── arm_fir_interpolate_init_f32.c │ │ │ ├── arm_fir_interpolate_init_q15.c │ │ │ ├── arm_fir_interpolate_init_q31.c │ │ │ ├── arm_fir_interpolate_q15.c │ │ │ ├── arm_fir_interpolate_q31.c │ │ │ ├── arm_fir_lattice_f32.c │ │ │ ├── arm_fir_lattice_init_f32.c │ │ │ ├── arm_fir_lattice_init_q15.c │ │ │ ├── arm_fir_lattice_init_q31.c │ │ │ ├── arm_fir_lattice_q15.c │ │ │ ├── arm_fir_lattice_q31.c │ │ │ ├── arm_fir_q15.c │ │ │ ├── arm_fir_q31.c │ │ │ ├── arm_fir_q7.c │ │ │ ├── arm_fir_sparse_f32.c │ │ │ ├── arm_fir_sparse_init_f32.c │ │ │ ├── arm_fir_sparse_init_q15.c │ │ │ ├── arm_fir_sparse_init_q31.c │ │ │ ├── arm_fir_sparse_init_q7.c │ │ │ ├── arm_fir_sparse_q15.c │ │ │ ├── arm_fir_sparse_q31.c │ │ │ ├── arm_fir_sparse_q7.c │ │ │ ├── arm_iir_lattice_f32.c │ │ │ ├── arm_iir_lattice_init_f32.c │ │ │ ├── arm_iir_lattice_init_q15.c │ │ │ ├── arm_iir_lattice_init_q31.c │ │ │ ├── arm_iir_lattice_q15.c │ │ │ ├── arm_iir_lattice_q31.c │ │ │ ├── arm_lms_f32.c │ │ │ ├── arm_lms_init_f32.c │ │ │ ├── arm_lms_init_q15.c │ │ │ ├── arm_lms_init_q31.c │ │ │ ├── arm_lms_norm_f32.c │ │ │ ├── arm_lms_norm_init_f32.c │ │ │ ├── arm_lms_norm_init_q15.c │ │ │ ├── arm_lms_norm_init_q31.c │ │ │ ├── arm_lms_norm_q15.c │ │ │ ├── arm_lms_norm_q31.c │ │ │ ├── arm_lms_q15.c │ │ │ └── arm_lms_q31.c │ │ ├── MatrixFunctions │ │ │ ├── arm_mat_add_f32.c │ │ │ ├── arm_mat_add_q15.c │ │ │ ├── arm_mat_add_q31.c │ │ │ ├── arm_mat_init_f32.c │ │ │ ├── arm_mat_init_q15.c │ │ │ ├── arm_mat_init_q31.c │ │ │ ├── arm_mat_inverse_f32.c │ │ │ ├── arm_mat_mult_f32.c │ │ │ ├── arm_mat_mult_fast_q15.c │ │ │ ├── arm_mat_mult_fast_q31.c │ │ │ ├── arm_mat_mult_q15.c │ │ │ ├── arm_mat_mult_q31.c │ │ │ ├── arm_mat_scale_f32.c │ │ │ ├── arm_mat_scale_q15.c │ │ │ ├── arm_mat_scale_q31.c │ │ │ ├── arm_mat_sub_f32.c │ │ │ ├── arm_mat_sub_q15.c │ │ │ ├── arm_mat_sub_q31.c │ │ │ ├── arm_mat_trans_f32.c │ │ │ ├── arm_mat_trans_q15.c │ │ │ └── arm_mat_trans_q31.c │ │ ├── StatisticsFunctions │ │ │ ├── arm_max_f32.c │ │ │ ├── arm_max_q15.c │ │ │ ├── arm_max_q31.c │ │ │ ├── arm_max_q7.c │ │ │ ├── arm_mean_f32.c │ │ │ ├── arm_mean_q15.c │ │ │ ├── arm_mean_q31.c │ │ │ ├── arm_mean_q7.c │ │ │ ├── arm_min_f32.c │ │ │ ├── arm_min_q15.c │ │ │ ├── arm_min_q31.c │ │ │ ├── arm_min_q7.c │ │ │ ├── arm_power_f32.c │ │ │ ├── arm_power_q15.c │ │ │ ├── arm_power_q31.c │ │ │ ├── arm_power_q7.c │ │ │ ├── arm_rms_f32.c │ │ │ ├── arm_rms_q15.c │ │ │ ├── arm_rms_q31.c │ │ │ ├── arm_std_f32.c │ │ │ ├── arm_std_q15.c │ │ │ ├── arm_std_q31.c │ │ │ ├── arm_var_f32.c │ │ │ ├── arm_var_q15.c │ │ │ └── arm_var_q31.c │ │ ├── SupportFunctions │ │ │ ├── arm_copy_f32.c │ │ │ ├── arm_copy_q15.c │ │ │ ├── arm_copy_q31.c │ │ │ ├── arm_copy_q7.c │ │ │ ├── arm_fill_f32.c │ │ │ ├── arm_fill_q15.c │ │ │ ├── arm_fill_q31.c │ │ │ ├── arm_fill_q7.c │ │ │ ├── arm_float_to_q15.c │ │ │ ├── arm_float_to_q31.c │ │ │ ├── arm_float_to_q7.c │ │ │ ├── arm_q15_to_float.c │ │ │ ├── arm_q15_to_q31.c │ │ │ ├── arm_q15_to_q7.c │ │ │ ├── arm_q31_to_float.c │ │ │ ├── arm_q31_to_q15.c │ │ │ ├── arm_q31_to_q7.c │ │ │ ├── arm_q7_to_float.c │ │ │ ├── arm_q7_to_q15.c │ │ │ └── arm_q7_to_q31.c │ │ ├── TransformFunctions │ │ │ ├── arm_bitreversal.c │ │ │ ├── arm_cfft_radix2_f32.c │ │ │ ├── arm_cfft_radix2_init_f32.c │ │ │ ├── arm_cfft_radix2_init_q15.c │ │ │ ├── arm_cfft_radix2_init_q31.c │ │ │ ├── arm_cfft_radix2_q15.c │ │ │ ├── arm_cfft_radix2_q31.c │ │ │ ├── arm_cfft_radix4_f32.c │ │ │ ├── arm_cfft_radix4_init_f32.c │ │ │ ├── arm_cfft_radix4_init_q15.c │ │ │ ├── arm_cfft_radix4_init_q31.c │ │ │ ├── arm_cfft_radix4_q15.c │ │ │ ├── arm_cfft_radix4_q31.c │ │ │ ├── arm_dct4_f32.c │ │ │ ├── arm_dct4_init_f32.c │ │ │ ├── arm_dct4_init_q15.c │ │ │ ├── arm_dct4_init_q31.c │ │ │ ├── arm_dct4_q15.c │ │ │ ├── arm_dct4_q31.c │ │ │ ├── arm_rfft_f32.c │ │ │ ├── arm_rfft_init_f32.c │ │ │ ├── arm_rfft_init_q15.c │ │ │ ├── arm_rfft_init_q31.c │ │ │ ├── arm_rfft_q15.c │ │ │ └── arm_rfft_q31.c │ │ ├── arm_common_tables.h │ │ ├── arm_math.h │ │ ├── cmsis_os.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm4_simd.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_sc000.h │ │ ├── core_sc300.h │ │ ├── startup │ │ │ ├── startup_stm32f40xx.s │ │ │ └── startup_stm32f427x.s │ │ ├── stm32f4xx.h │ │ ├── system_stm32f4xx.c │ │ └── system_stm32f4xx.h │ ├── Fatfs │ │ ├── inc │ │ │ ├── diskio.h │ │ │ ├── ffconf.h │ │ │ ├── integer.h │ │ │ └── system_fatfs.h │ │ ├── readme.txt │ │ └── src │ │ │ ├── diskio.c │ │ │ ├── option │ │ │ ├── cc932.c │ │ │ ├── cc936.c │ │ │ ├── cc949.c │ │ │ ├── cc950.c │ │ │ ├── ccsbcs.c │ │ │ ├── syscall.c │ │ │ └── unicode.c │ │ │ └── system_fatfs.c │ └── STM32F4xx_StdPeriph_Driver │ │ ├── inc │ │ ├── misc.h │ │ ├── stm32f4xx_adc.h │ │ ├── stm32f4xx_can.h │ │ ├── stm32f4xx_crc.h │ │ ├── stm32f4xx_cryp.h │ │ ├── stm32f4xx_dac.h │ │ ├── stm32f4xx_dbgmcu.h │ │ ├── stm32f4xx_dcmi.h │ │ ├── stm32f4xx_dma.h │ │ ├── stm32f4xx_exti.h │ │ ├── stm32f4xx_flash.h │ │ ├── stm32f4xx_fsmc.h │ │ ├── stm32f4xx_gpio.h │ │ ├── stm32f4xx_hash.h │ │ ├── stm32f4xx_i2c.h │ │ ├── stm32f4xx_iwdg.h │ │ ├── stm32f4xx_pwr.h │ │ ├── stm32f4xx_rcc.h │ │ ├── stm32f4xx_rng.h │ │ ├── stm32f4xx_rtc.h │ │ ├── stm32f4xx_sdio.h │ │ ├── stm32f4xx_spi.h │ │ ├── stm32f4xx_syscfg.h │ │ ├── stm32f4xx_tim.h │ │ ├── stm32f4xx_usart.h │ │ └── stm32f4xx_wwdg.h │ │ └── src │ │ ├── misc.c │ │ ├── stm32f4xx_adc.c │ │ ├── stm32f4xx_can.c │ │ ├── stm32f4xx_crc.c │ │ ├── stm32f4xx_cryp.c │ │ ├── stm32f4xx_cryp_aes.c │ │ ├── stm32f4xx_cryp_des.c │ │ ├── stm32f4xx_cryp_tdes.c │ │ ├── stm32f4xx_dac.c │ │ ├── stm32f4xx_dbgmcu.c │ │ ├── stm32f4xx_dcmi.c │ │ ├── stm32f4xx_dma.c │ │ ├── stm32f4xx_exti.c │ │ ├── stm32f4xx_flash.c │ │ ├── stm32f4xx_fsmc.c │ │ ├── stm32f4xx_gpio.c │ │ ├── stm32f4xx_hash.c │ │ ├── stm32f4xx_hash_md5.c │ │ ├── stm32f4xx_hash_sha1.c │ │ ├── stm32f4xx_i2c.c │ │ ├── stm32f4xx_iwdg.c │ │ ├── stm32f4xx_pwr.c │ │ ├── stm32f4xx_rcc.c │ │ ├── stm32f4xx_rng.c │ │ ├── stm32f4xx_rtc.c │ │ ├── stm32f4xx_sdio.c │ │ ├── stm32f4xx_spi.c │ │ ├── stm32f4xx_syscfg.c │ │ ├── stm32f4xx_tim.c │ │ ├── stm32f4xx_usart.c │ │ └── stm32f4xx_wwdg.c ├── Program_Algorithm │ ├── algorithm_bubbleSort.c │ ├── algorithm_bubblesort.h │ ├── algorithm_kalman.c │ ├── algorithm_kalman.h │ ├── algorithm_mathUnit.c │ ├── algorithm_mathUnit.h │ ├── algorithm_moveAve.c │ ├── algorithm_moveAve.h │ ├── algorithm_pid.c │ ├── algorithm_pid.h │ ├── algorithm_quaternion.c │ └── algorithm_quaternion.h ├── Program_Dirver │ ├── stm32f4_adc.c │ ├── stm32f4_adc.h │ ├── stm32f4_delay.c │ ├── stm32f4_delay.h │ ├── stm32f4_i2c.c │ ├── stm32f4_i2c.h │ ├── stm32f4_sdio.c │ ├── stm32f4_sdio.h │ ├── stm32f4_spi.c │ ├── stm32f4_spi.h │ ├── stm32f4_system.c │ ├── stm32f4_system.h │ ├── stm32f4_typedef.h │ ├── stm32f4_usart.c │ └── stm32f4_usart.h ├── Program_Master │ ├── QCopter.c │ ├── QCopter.h │ ├── QCopter_it.c │ ├── lcd.c │ ├── lcd.h │ ├── module_fontlib.h │ ├── module_keyBoard.c │ ├── module_keyBoard.h │ ├── module_nrf24l01.c │ ├── module_nrf24l01.h │ ├── module_rs232.c │ ├── module_rs232.h │ ├── module_ssd1963.c │ ├── module_ssd1963.h │ ├── module_xpt2046.c │ ├── module_xpt2046.h │ ├── stm32f4xx_conf.h │ ├── system_engine3D.c │ ├── system_engine3D.h │ ├── system_waveForm.c │ ├── system_waveForm.h │ ├── system_windows.c │ ├── system_windows.h │ ├── tft_spi.c │ └── tft_spi.h ├── Program_Slave │ ├── QCopter.c │ ├── QCopter.h │ ├── QCopter_AHRS.c │ ├── QCopter_AHRS.h │ ├── QCopter_CTRL.c │ ├── QCopter_CTRL.h │ ├── QCopter_it.c │ ├── module_bmp085.c │ ├── module_bmp085.h │ ├── module_keyBoard.c │ ├── module_keyBoard.h │ ├── module_l3g4200.c │ ├── module_l3g4200.h │ ├── module_lsm303.c │ ├── module_lsm303.h │ ├── module_motor.c │ ├── module_motor.h │ ├── module_nrf24l01.c │ ├── module_nrf24l01.h │ ├── module_rs232.c │ ├── module_rs232.h │ ├── module_sensor.c │ ├── module_sensor.h │ └── stm32f4xx_conf.h ├── Project_MasterV3 │ ├── Program_STM32.uvopt │ ├── Program_STM32.uvproj │ └── Readme.txt ├── Project_SlaveV2 │ ├── Program_STM32.uvopt │ ├── Program_STM32.uvproj │ └── Readme.txt ├── STM32F4.xlsx └── Tool │ ├── AccessPort137.rar │ ├── AccessPort137 │ ├── AccessPort.exe │ ├── AccessPort.ini │ ├── Apsm.sys │ ├── Apsm_x64.sys │ ├── Language │ │ ├── apchs.ini │ │ ├── apcht.ini │ │ ├── apeng.ini │ │ └── aprus.ini │ ├── license.txt │ ├── readme_en_US.txt │ ├── readme_zh_CN.txt │ └── readme_zh_TW.txt │ ├── Img2Lcd │ ├── Img2Lcd.exe │ ├── Img2Lcd_chs.chm │ └── SSS.DLL │ ├── TFT助手.rar │ ├── VisualScope │ ├── CRC16_code.txt │ ├── VisualScope.exe │ ├── VisualScope.exe使用說明.pdf │ ├── acc.dat │ ├── config.dat │ ├── readme.txt │ ├── sample.dat │ └── 新建 文本文檔.txt │ └── putty.exe ├── 四軸飛行器_專題報告.pdf ├── 四軸飛行器_專題海報.pdf ├── 四軸飛行器_研究紀錄_20130615.pdf ├── 推導_PID控制器.pdf ├── 推導_四元數.pdf ├── 推導_橢圓擬合.pdf └── 無人飛行載具_四軸飛行器.pdf /Readme.md: -------------------------------------------------------------------------------- 1 | Quadcopter 2 | ======== 3 | * Author : [Hom](https://github.com/Hom19910422) 4 | * Update : 2013/12/07 5 | * Description : 6 | 101年的大學專題,專題成果大致可以達到平衡(不太穩),但尚無法懸停, 7 | 需要更新、更穩定的飛控版本請到 [QCopterFC](https://github.com/Hom19910422/QCopterFlightControl) 下載,這裡將不再做更新。 8 | 9 | 飛控板 10 | ======== 11 | * 控制器 STM32F405RG 64Pin 168MHz DSP FPU 12 | * 感測器 L3G4200 + LSM303 13 | * 無線傳輸 nRF24L01P + PA + LNA 14 | * 6個PWM通道 連接電調、LED、PPM 15 | * 1個UART接口 可擴充GPS模組、藍芽模組、電腦傳輸RS232 16 | 17 | 遙控器 18 | ======== 19 | * 控制器 STM32F407VG 100Pin 168MHz DSP FPU 20 | * 顯示器 4.3吋螢幕,480*242,SSD1963 21 | * 無線傳輸 nRF24L01P + PA + LNA 22 | * 儲存紀錄 SD卡,使用SDIO操作 23 | * 1個I2C接口 外擴其他裝置 24 | * 1個UART接口 可擴充GPS模組、藍芽模組、電腦傳輸RS232 25 | * DEMO Videos https://www.youtube.com/watch?v=KsObp2a2QdA 26 |

27 |
28 | 四軸飛行器
29 | 30 |

31 | 飛控板
32 | 33 |

34 | 遙控器正面
35 | 36 |

37 | 遙控器背面
38 | 39 |

40 | 螢幕主畫面
41 | 42 |

43 | 螢幕示波器
44 | 45 |

46 | 螢幕測試
47 | 48 |

49 |

50 | 創用 CC 授權條款
QuadcopterHom製作,以創用CC 姓名標示-相同方式分享 3.0 台灣 授權條款釋出。 51 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/BasicMathFunctions/arm_add_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_add_q7.c 9 | * 10 | * Description: Q7 vector addition. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupMath 40 | */ 41 | 42 | /** 43 | * @addtogroup BasicAdd 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Q7 vector addition. 49 | * @param[in] *pSrcA points to the first input vector 50 | * @param[in] *pSrcB points to the second input vector 51 | * @param[out] *pDst points to the output vector 52 | * @param[in] blockSize number of samples in each vector 53 | * @return none. 54 | * 55 | * Scaling and Overflow Behavior: 56 | * \par 57 | * The function uses saturating arithmetic. 58 | * Results outside of the allowable Q7 range [0x80 0x7F] will be saturated. 59 | */ 60 | 61 | void arm_add_q7( 62 | q7_t * pSrcA, 63 | q7_t * pSrcB, 64 | q7_t * pDst, 65 | uint32_t blockSize) 66 | { 67 | uint32_t blkCnt; /* loop counter */ 68 | 69 | #ifndef ARM_MATH_CM0 70 | 71 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 72 | 73 | 74 | /*loop Unrolling */ 75 | blkCnt = blockSize >> 2u; 76 | 77 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 78 | ** a second loop below computes the remaining 1 to 3 samples. */ 79 | while(blkCnt > 0u) 80 | { 81 | /* C = A + B */ 82 | /* Add and then store the results in the destination buffer. */ 83 | *__SIMD32(pDst)++ = __QADD8(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++); 84 | 85 | /* Decrement the loop counter */ 86 | blkCnt--; 87 | } 88 | 89 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 90 | ** No loop unrolling is used. */ 91 | blkCnt = blockSize % 0x4u; 92 | 93 | while(blkCnt > 0u) 94 | { 95 | /* C = A + B */ 96 | /* Add and then store the results in the destination buffer. */ 97 | *pDst++ = (q7_t) __SSAT(*pSrcA++ + *pSrcB++, 8); 98 | 99 | /* Decrement the loop counter */ 100 | blkCnt--; 101 | } 102 | 103 | #else 104 | 105 | /* Run the below code for Cortex-M0 */ 106 | 107 | 108 | 109 | /* Initialize blkCnt with number of samples */ 110 | blkCnt = blockSize; 111 | 112 | while(blkCnt > 0u) 113 | { 114 | /* C = A + B */ 115 | /* Add and then store the results in the destination buffer. */ 116 | *pDst++ = (q7_t) __SSAT((q15_t) * pSrcA++ + *pSrcB++, 8); 117 | 118 | /* Decrement the loop counter */ 119 | blkCnt--; 120 | } 121 | 122 | #endif /* #ifndef ARM_MATH_CM0 */ 123 | 124 | 125 | } 126 | 127 | /** 128 | * @} end of BasicAdd group 129 | */ 130 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/BasicMathFunctions/arm_negate_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_negate_q31.c 9 | * 10 | * Description: Negates Q31 vectors. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupMath 40 | */ 41 | 42 | /** 43 | * @addtogroup negate 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Negates the elements of a Q31 vector. 49 | * @param[in] *pSrc points to the input vector 50 | * @param[out] *pDst points to the output vector 51 | * @param[in] blockSize number of samples in the vector 52 | * @return none. 53 | * 54 | * Scaling and Overflow Behavior: 55 | * \par 56 | * The function uses saturating arithmetic. 57 | * The Q31 value -1 (0x80000000) will be saturated to the maximum allowable positive value 0x7FFFFFFF. 58 | */ 59 | 60 | void arm_negate_q31( 61 | q31_t * pSrc, 62 | q31_t * pDst, 63 | uint32_t blockSize) 64 | { 65 | q31_t in; /* Temporary variable */ 66 | uint32_t blkCnt; /* loop counter */ 67 | 68 | #ifndef ARM_MATH_CM0 69 | 70 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 71 | q31_t in1, in2, in3, in4; 72 | 73 | /*loop Unrolling */ 74 | blkCnt = blockSize >> 2u; 75 | 76 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 77 | ** a second loop below computes the remaining 1 to 3 samples. */ 78 | while(blkCnt > 0u) 79 | { 80 | /* C = -A */ 81 | /* Negate and then store the results in the destination buffer. */ 82 | in1 = *pSrc++; 83 | in2 = *pSrc++; 84 | in3 = *pSrc++; 85 | in4 = *pSrc++; 86 | 87 | *pDst++ = __QSUB(0, in1); 88 | *pDst++ = __QSUB(0, in2); 89 | *pDst++ = __QSUB(0, in3); 90 | *pDst++ = __QSUB(0, in4); 91 | 92 | /* Decrement the loop counter */ 93 | blkCnt--; 94 | } 95 | 96 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 97 | ** No loop unrolling is used. */ 98 | blkCnt = blockSize % 0x4u; 99 | 100 | #else 101 | 102 | /* Run the below code for Cortex-M0 */ 103 | 104 | /* Initialize blkCnt with number of samples */ 105 | blkCnt = blockSize; 106 | 107 | #endif /* #ifndef ARM_MATH_CM0 */ 108 | 109 | 110 | while(blkCnt > 0u) 111 | { 112 | /* C = -A */ 113 | /* Negate and then store the result in the destination buffer. */ 114 | in = *pSrc++; 115 | *pDst++ = (in == 0x80000000) ? 0x7fffffff : -in; 116 | 117 | /* Decrement the loop counter */ 118 | blkCnt--; 119 | } 120 | } 121 | 122 | /** 123 | * @} end of negate group 124 | */ 125 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/BasicMathFunctions/arm_negate_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_negate_q7.c 9 | * 10 | * Description: Negates Q7 vectors. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupMath 40 | */ 41 | 42 | /** 43 | * @addtogroup negate 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Negates the elements of a Q7 vector. 49 | * @param[in] *pSrc points to the input vector 50 | * @param[out] *pDst points to the output vector 51 | * @param[in] blockSize number of samples in the vector 52 | * @return none. 53 | * 54 | * Scaling and Overflow Behavior: 55 | * \par 56 | * The function uses saturating arithmetic. 57 | * The Q7 value -1 (0x80) will be saturated to the maximum allowable positive value 0x7F. 58 | */ 59 | 60 | void arm_negate_q7( 61 | q7_t * pSrc, 62 | q7_t * pDst, 63 | uint32_t blockSize) 64 | { 65 | uint32_t blkCnt; /* loop counter */ 66 | q7_t in; 67 | 68 | #ifndef ARM_MATH_CM0 69 | 70 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 71 | q31_t input; /* Input values1-4 */ 72 | q31_t zero = 0x00000000; 73 | 74 | 75 | /*loop Unrolling */ 76 | blkCnt = blockSize >> 2u; 77 | 78 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 79 | ** a second loop below computes the remaining 1 to 3 samples. */ 80 | while(blkCnt > 0u) 81 | { 82 | /* C = -A */ 83 | /* Read four inputs */ 84 | input = *__SIMD32(pSrc)++; 85 | 86 | /* Store the Negated results in the destination buffer in a single cycle by packing the results */ 87 | *__SIMD32(pDst)++ = __QSUB8(zero, input); 88 | 89 | /* Decrement the loop counter */ 90 | blkCnt--; 91 | } 92 | 93 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 94 | ** No loop unrolling is used. */ 95 | blkCnt = blockSize % 0x4u; 96 | 97 | #else 98 | 99 | /* Run the below code for Cortex-M0 */ 100 | 101 | /* Initialize blkCnt with number of samples */ 102 | blkCnt = blockSize; 103 | 104 | #endif /* #ifndef ARM_MATH_CM0 */ 105 | 106 | while(blkCnt > 0u) 107 | { 108 | /* C = -A */ 109 | /* Negate and then store the results in the destination buffer. */ \ 110 | in = *pSrc++; 111 | *pDst++ = (in == (q7_t) 0x80) ? 0x7f : -in; 112 | 113 | /* Decrement the loop counter */ 114 | blkCnt--; 115 | } 116 | } 117 | 118 | /** 119 | * @} end of negate group 120 | */ 121 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/BasicMathFunctions/arm_sub_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_sub_q7.c 9 | * 10 | * Description: Q7 vector subtraction. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupMath 40 | */ 41 | 42 | /** 43 | * @addtogroup BasicSub 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Q7 vector subtraction. 49 | * @param[in] *pSrcA points to the first input vector 50 | * @param[in] *pSrcB points to the second input vector 51 | * @param[out] *pDst points to the output vector 52 | * @param[in] blockSize number of samples in each vector 53 | * @return none. 54 | * 55 | * Scaling and Overflow Behavior: 56 | * \par 57 | * The function uses saturating arithmetic. 58 | * Results outside of the allowable Q7 range [0x80 0x7F] will be saturated. 59 | */ 60 | 61 | void arm_sub_q7( 62 | q7_t * pSrcA, 63 | q7_t * pSrcB, 64 | q7_t * pDst, 65 | uint32_t blockSize) 66 | { 67 | uint32_t blkCnt; /* loop counter */ 68 | 69 | #ifndef ARM_MATH_CM0 70 | 71 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 72 | 73 | /*loop Unrolling */ 74 | blkCnt = blockSize >> 2u; 75 | 76 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 77 | ** a second loop below computes the remaining 1 to 3 samples. */ 78 | while(blkCnt > 0u) 79 | { 80 | /* C = A - B */ 81 | /* Subtract and then store the results in the destination buffer 4 samples at a time. */ 82 | *__SIMD32(pDst)++ = __QSUB8(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++); 83 | 84 | /* Decrement the loop counter */ 85 | blkCnt--; 86 | } 87 | 88 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 89 | ** No loop unrolling is used. */ 90 | blkCnt = blockSize % 0x4u; 91 | 92 | while(blkCnt > 0u) 93 | { 94 | /* C = A - B */ 95 | /* Subtract and then store the result in the destination buffer. */ 96 | *pDst++ = __SSAT(*pSrcA++ - *pSrcB++, 8); 97 | 98 | /* Decrement the loop counter */ 99 | blkCnt--; 100 | } 101 | 102 | #else 103 | 104 | /* Run the below code for Cortex-M0 */ 105 | 106 | /* Initialize blkCnt with number of samples */ 107 | blkCnt = blockSize; 108 | 109 | while(blkCnt > 0u) 110 | { 111 | /* C = A - B */ 112 | /* Subtract and then store the result in the destination buffer. */ 113 | *pDst++ = (q7_t) __SSAT((q15_t) * pSrcA++ - *pSrcB++, 8); 114 | 115 | /* Decrement the loop counter */ 116 | blkCnt--; 117 | } 118 | 119 | #endif /* #ifndef ARM_MATH_CM0 */ 120 | 121 | 122 | } 123 | 124 | /** 125 | * @} end of BasicSub group 126 | */ 127 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/ControllerFunctions/arm_pid_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_pid_init_f32.c 9 | * 10 | * Description: Floating-point PID Control initialization function 11 | * 12 | * 13 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 14 | * 15 | * Version 1.1.0 2012/02/15 16 | * Updated with more optimizations, bug fixes and minor API changes. 17 | * 18 | * Version 1.0.10 2011/7/15 19 | * Big Endian support added and Merged M0 and M3/M4 Source code. 20 | * 21 | * Version 1.0.3 2010/11/29 22 | * Re-organized the CMSIS folders and updated documentation. 23 | * 24 | * Version 1.0.2 2010/11/11 25 | * Documentation updated. 26 | * 27 | * Version 1.0.1 2010/10/05 28 | * Production release and review comments incorporated. 29 | * 30 | * Version 1.0.0 2010/09/20 31 | * Production release and review comments incorporated. 32 | * ------------------------------------------------------------------- */ 33 | 34 | #include "arm_math.h" 35 | 36 | /** 37 | * @addtogroup PID 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @brief Initialization function for the floating-point PID Control. 43 | * @param[in,out] *S points to an instance of the PID structure. 44 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state & 1 = reset the state. 45 | * @return none. 46 | * \par Description: 47 | * \par 48 | * The resetStateFlag specifies whether to set state to zero or not. \n 49 | * The function computes the structure fields: A0, A1 A2 50 | * using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 51 | * also sets the state variables to all zeros. 52 | */ 53 | 54 | void arm_pid_init_f32( 55 | arm_pid_instance_f32 * S, 56 | int32_t resetStateFlag) 57 | { 58 | 59 | /* Derived coefficient A0 */ 60 | S->A0 = S->Kp + S->Ki + S->Kd; 61 | 62 | /* Derived coefficient A1 */ 63 | S->A1 = (-S->Kp) - ((float32_t) 2.0 * S->Kd); 64 | 65 | /* Derived coefficient A2 */ 66 | S->A2 = S->Kd; 67 | 68 | /* Check whether state needs reset or not */ 69 | if(resetStateFlag) 70 | { 71 | /* Clear the state buffer. The size will be always 3 samples */ 72 | memset(S->state, 0, 3u * sizeof(float32_t)); 73 | } 74 | 75 | } 76 | 77 | /** 78 | * @} end of PID group 79 | */ 80 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/ControllerFunctions/arm_pid_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_pid_init_q15.c 9 | * 10 | * Description: Q15 PID Control initialization function 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | 35 | /** 36 | * @addtogroup PID 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @details 42 | * @param[in,out] *S points to an instance of the Q15 PID structure. 43 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. 44 | * @return none. 45 | * \par Description: 46 | * \par 47 | * The resetStateFlag specifies whether to set state to zero or not. \n 48 | * The function computes the structure fields: A0, A1 A2 49 | * using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 50 | * also sets the state variables to all zeros. 51 | */ 52 | 53 | void arm_pid_init_q15( 54 | arm_pid_instance_q15 * S, 55 | int32_t resetStateFlag) 56 | { 57 | 58 | #ifndef ARM_MATH_CM0 59 | 60 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 61 | 62 | /* Derived coefficient A0 */ 63 | S->A0 = __QADD16(__QADD16(S->Kp, S->Ki), S->Kd); 64 | 65 | /* Derived coefficients and pack into A1 */ 66 | 67 | #ifndef ARM_MATH_BIG_ENDIAN 68 | 69 | S->A1 = __PKHBT(-__QADD16(__QADD16(S->Kd, S->Kd), S->Kp), S->Kd, 16); 70 | 71 | #else 72 | 73 | S->A1 = __PKHBT(S->Kd, -__QADD16(__QADD16(S->Kd, S->Kd), S->Kp), 16); 74 | 75 | #endif /* #ifndef ARM_MATH_BIG_ENDIAN */ 76 | 77 | /* Check whether state needs reset or not */ 78 | if(resetStateFlag) 79 | { 80 | /* Clear the state buffer. The size will be always 3 samples */ 81 | memset(S->state, 0, 3u * sizeof(q15_t)); 82 | } 83 | 84 | #else 85 | 86 | /* Run the below code for Cortex-M0 */ 87 | 88 | q31_t temp; /*to store the sum */ 89 | 90 | /* Derived coefficient A0 */ 91 | temp = S->Kp + S->Ki + S->Kd; 92 | S->A0 = (q15_t) __SSAT(temp, 16); 93 | 94 | /* Derived coefficients and pack into A1 */ 95 | temp = -(S->Kd + S->Kd + S->Kp); 96 | S->A1 = (q15_t) __SSAT(temp, 16); 97 | S->A2 = S->Kd; 98 | 99 | 100 | 101 | /* Check whether state needs reset or not */ 102 | if(resetStateFlag) 103 | { 104 | /* Clear the state buffer. The size will be always 3 samples */ 105 | memset(S->state, 0, 3u * sizeof(q15_t)); 106 | } 107 | 108 | #endif /* #ifndef ARM_MATH_CM0 */ 109 | 110 | } 111 | 112 | /** 113 | * @} end of PID group 114 | */ 115 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/ControllerFunctions/arm_pid_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_pid_init_q31.c 9 | * 10 | * Description: Q31 PID Control initialization function 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * ------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | 35 | /** 36 | * @addtogroup PID 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @brief Initialization function for the Q31 PID Control. 42 | * @param[in,out] *S points to an instance of the Q31 PID structure. 43 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. 44 | * @return none. 45 | * \par Description: 46 | * \par 47 | * The resetStateFlag specifies whether to set state to zero or not. \n 48 | * The function computes the structure fields: A0, A1 A2 49 | * using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 50 | * also sets the state variables to all zeros. 51 | */ 52 | 53 | void arm_pid_init_q31( 54 | arm_pid_instance_q31 * S, 55 | int32_t resetStateFlag) 56 | { 57 | 58 | #ifndef ARM_MATH_CM0 59 | 60 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 61 | 62 | /* Derived coefficient A0 */ 63 | S->A0 = __QADD(__QADD(S->Kp, S->Ki), S->Kd); 64 | 65 | /* Derived coefficient A1 */ 66 | S->A1 = -__QADD(__QADD(S->Kd, S->Kd), S->Kp); 67 | 68 | 69 | #else 70 | 71 | /* Run the below code for Cortex-M0 */ 72 | 73 | q31_t temp; 74 | 75 | /* Derived coefficient A0 */ 76 | temp = clip_q63_to_q31((q63_t) S->Kp + S->Ki); 77 | S->A0 = clip_q63_to_q31((q63_t) temp + S->Kd); 78 | 79 | /* Derived coefficient A1 */ 80 | temp = clip_q63_to_q31((q63_t) S->Kd + S->Kd); 81 | S->A1 = -clip_q63_to_q31((q63_t) temp + S->Kp); 82 | 83 | #endif /* #ifndef ARM_MATH_CM0 */ 84 | 85 | /* Derived coefficient A2 */ 86 | S->A2 = S->Kd; 87 | 88 | /* Check whether state needs reset or not */ 89 | if(resetStateFlag) 90 | { 91 | /* Clear the state buffer. The size will be always 3 samples */ 92 | memset(S->state, 0, 3u * sizeof(q31_t)); 93 | } 94 | 95 | } 96 | 97 | /** 98 | * @} end of PID group 99 | */ 100 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_pid_reset_f32.c 9 | * 10 | * Description: Floating-point PID Control reset function 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * ------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | 35 | /** 36 | * @addtogroup PID 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @brief Reset function for the floating-point PID Control. 42 | * @param[in] *S Instance pointer of PID control data structure. 43 | * @return none. 44 | * \par Description: 45 | * The function resets the state buffer to zeros. 46 | */ 47 | void arm_pid_reset_f32( 48 | arm_pid_instance_f32 * S) 49 | { 50 | 51 | /* Clear the state buffer. The size will be always 3 samples */ 52 | memset(S->state, 0, 3u * sizeof(float32_t)); 53 | } 54 | 55 | /** 56 | * @} end of PID group 57 | */ 58 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_pid_reset_q15.c 9 | * 10 | * Description: Q15 PID Control reset function 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | 35 | /** 36 | * @addtogroup PID 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @brief Reset function for the Q15 PID Control. 42 | * @param[in] *S Instance pointer of PID control data structure. 43 | * @return none. 44 | * \par Description: 45 | * The function resets the state buffer to zeros. 46 | */ 47 | void arm_pid_reset_q15( 48 | arm_pid_instance_q15 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3u * sizeof(q15_t)); 52 | } 53 | 54 | /** 55 | * @} end of PID group 56 | */ 57 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_pid_reset_q31.c 9 | * 10 | * Description: Q31 PID Control reset function 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * ------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | 35 | /** 36 | * @addtogroup PID 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @brief Reset function for the Q31 PID Control. 42 | * @param[in] *S Instance pointer of PID control data structure. 43 | * @return none. 44 | * \par Description: 45 | * The function resets the state buffer to zeros. 46 | */ 47 | void arm_pid_reset_q31( 48 | arm_pid_instance_q31 * S) 49 | { 50 | 51 | /* Clear the state buffer. The size will be always 3 samples */ 52 | memset(S->state, 0, 3u * sizeof(q31_t)); 53 | } 54 | 55 | /** 56 | * @} end of PID group 57 | */ 58 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_biquad_cascade_df2T_init_f32.c 9 | * 10 | * Description: Initialization function for the floating-point transposed 11 | * direct form II Biquad cascade filter. 12 | * 13 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 14 | * 15 | * Version 1.1.0 2012/02/15 16 | * Updated with more optimizations, bug fixes and minor API changes. 17 | * 18 | * Version 1.0.10 2011/7/15 19 | * Big Endian support added and Merged M0 and M3/M4 Source code. 20 | * 21 | * Version 1.0.3 2010/11/29 22 | * Re-organized the CMSIS folders and updated documentation. 23 | * 24 | * Version 1.0.2 2010/11/11 25 | * Documentation updated. 26 | * 27 | * Version 1.0.1 2010/10/05 28 | * Production release and review comments incorporated. 29 | * 30 | * Version 1.0.0 2010/09/20 31 | * Production release and review comments incorporated 32 | * 33 | * Version 0.0.7 2010/06/10 34 | * Misra-C changes done 35 | * ---------------------------------------------------------------------------*/ 36 | 37 | #include "arm_math.h" 38 | 39 | /** 40 | * @ingroup groupFilters 41 | */ 42 | 43 | /** 44 | * @addtogroup BiquadCascadeDF2T 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. 50 | * @param[in,out] *S points to an instance of the filter data structure. 51 | * @param[in] numStages number of 2nd order stages in the filter. 52 | * @param[in] *pCoeffs points to the filter coefficients. 53 | * @param[in] *pState points to the state buffer. 54 | * @return none 55 | * 56 | * Coefficient and State Ordering: 57 | * \par 58 | * The coefficients are stored in the array pCoeffs in the following order: 59 | *

    
60 |  *     {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...}    
61 |  * 
62 | * 63 | * \par 64 | * where b1x and a1x are the coefficients for the first stage, 65 | * b2x and a2x are the coefficients for the second stage, 66 | * and so on. The pCoeffs array contains a total of 5*numStages values. 67 | * 68 | * \par 69 | * The pState is a pointer to state array. 70 | * Each Biquad stage has 2 state variables d1, and d2. 71 | * The 2 state variables for stage 1 are first, then the 2 state variables for stage 2, and so on. 72 | * The state array has a total length of 2*numStages values. 73 | * The state variables are updated after each block of data is processed; the coefficients are untouched. 74 | */ 75 | 76 | void arm_biquad_cascade_df2T_init_f32( 77 | arm_biquad_cascade_df2T_instance_f32 * S, 78 | uint8_t numStages, 79 | float32_t * pCoeffs, 80 | float32_t * pState) 81 | { 82 | /* Assign filter stages */ 83 | S->numStages = numStages; 84 | 85 | /* Assign coefficient pointer */ 86 | S->pCoeffs = pCoeffs; 87 | 88 | /* Clear state buffer and size is always 2 * numStages */ 89 | memset(pState, 0, (2u * (uint32_t) numStages) * sizeof(float32_t)); 90 | 91 | /* Assign state pointer */ 92 | S->pState = pState; 93 | } 94 | 95 | /** 96 | * @} end of BiquadCascadeDF2T group 97 | */ 98 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_decimate_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_decimate_init_q31.c 9 | * 10 | * Description: Initialization function for Q31 FIR Decimation filter. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_decimate 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q31 FIR decimator. 49 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. 50 | * @param[in] numTaps number of coefficients in the filter. 51 | * @param[in] M decimation factor. 52 | * @param[in] *pCoeffs points to the filter coefficients. 53 | * @param[in] *pState points to the state buffer. 54 | * @param[in] blockSize number of input samples to process per call. 55 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_LENGTH_ERROR if 56 | * blockSize is not a multiple of M. 57 | * 58 | * Description: 59 | * \par 60 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 61 | *
    
 62 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
 63 |  * 
64 | * \par 65 | * pState points to the array of state variables. 66 | * pState is of length numTaps+blockSize-1 words where blockSize is the number of input samples passed to arm_fir_decimate_q31(). 67 | * M is the decimation factor. 68 | */ 69 | 70 | arm_status arm_fir_decimate_init_q31( 71 | arm_fir_decimate_instance_q31 * S, 72 | uint16_t numTaps, 73 | uint8_t M, 74 | q31_t * pCoeffs, 75 | q31_t * pState, 76 | uint32_t blockSize) 77 | { 78 | arm_status status; 79 | 80 | /* The size of the input block must be a multiple of the decimation factor */ 81 | if((blockSize % M) != 0u) 82 | { 83 | /* Set status as ARM_MATH_LENGTH_ERROR */ 84 | status = ARM_MATH_LENGTH_ERROR; 85 | } 86 | else 87 | { 88 | /* Assign filter taps */ 89 | S->numTaps = numTaps; 90 | 91 | /* Assign coefficient pointer */ 92 | S->pCoeffs = pCoeffs; 93 | 94 | /* Clear the state buffer. The size is always (blockSize + numTaps - 1) */ 95 | memset(pState, 0, (numTaps + (blockSize - 1)) * sizeof(q31_t)); 96 | 97 | /* Assign state pointer */ 98 | S->pState = pState; 99 | 100 | /* Assign Decimation factor */ 101 | S->M = M; 102 | 103 | status = ARM_MATH_SUCCESS; 104 | } 105 | 106 | return (status); 107 | 108 | } 109 | 110 | /** 111 | * @} end of FIR_decimate group 112 | */ 113 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_init_f32.c 9 | * 10 | * Description: Floating-point FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.5 2010/04/26 33 | * incorporated review comments and updated with latest CMSIS layer 34 | * 35 | * Version 0.0.3 2010/03/10 36 | * Initial version 37 | * ---------------------------------------------------------------------------*/ 38 | 39 | #include "arm_math.h" 40 | 41 | /** 42 | * @ingroup groupFilters 43 | */ 44 | 45 | /** 46 | * @addtogroup FIR 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @details 52 | * 53 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. 54 | * @param[in] numTaps Number of filter coefficients in the filter. 55 | * @param[in] *pCoeffs points to the filter coefficients buffer. 56 | * @param[in] *pState points to the state buffer. 57 | * @param[in] blockSize number of samples that are processed per call. 58 | * @return none. 59 | * 60 | * Description: 61 | * \par 62 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 63 | *
    
64 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
65 |  * 
66 | * \par 67 | * pState points to the array of state variables. 68 | * pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_f32(). 69 | */ 70 | 71 | void arm_fir_init_f32( 72 | arm_fir_instance_f32 * S, 73 | uint16_t numTaps, 74 | float32_t * pCoeffs, 75 | float32_t * pState, 76 | uint32_t blockSize) 77 | { 78 | /* Assign filter taps */ 79 | S->numTaps = numTaps; 80 | 81 | /* Assign coefficient pointer */ 82 | S->pCoeffs = pCoeffs; 83 | 84 | /* Clear state buffer and the size of state buffer is (blockSize + numTaps - 1) */ 85 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(float32_t)); 86 | 87 | /* Assign state pointer */ 88 | S->pState = pState; 89 | 90 | } 91 | 92 | /** 93 | * @} end of FIR group 94 | */ 95 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_init_q31.c 9 | * 10 | * Description: Q31 FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.5 2010/04/26 33 | * incorporated review comments and updated with latest CMSIS layer 34 | * 35 | * Version 0.0.3 2010/03/10 36 | * Initial version 37 | * -------------------------------------------------------------------- */ 38 | 39 | #include "arm_math.h" 40 | 41 | /** 42 | * @ingroup groupFilters 43 | */ 44 | 45 | /** 46 | * @addtogroup FIR 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @details 52 | * 53 | * @param[in,out] *S points to an instance of the Q31 FIR filter structure. 54 | * @param[in] numTaps Number of filter coefficients in the filter. 55 | * @param[in] *pCoeffs points to the filter coefficients buffer. 56 | * @param[in] *pState points to the state buffer. 57 | * @param[in] blockSize number of samples that are processed per call. 58 | * @return none. 59 | * 60 | * Description: 61 | * \par 62 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 63 | *
    
64 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
65 |  * 
66 | * \par 67 | * pState points to the array of state variables. 68 | * pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_q31(). 69 | */ 70 | 71 | void arm_fir_init_q31( 72 | arm_fir_instance_q31 * S, 73 | uint16_t numTaps, 74 | q31_t * pCoeffs, 75 | q31_t * pState, 76 | uint32_t blockSize) 77 | { 78 | /* Assign filter taps */ 79 | S->numTaps = numTaps; 80 | 81 | /* Assign coefficient pointer */ 82 | S->pCoeffs = pCoeffs; 83 | 84 | /* Clear state buffer and state array size is (blockSize + numTaps - 1) */ 85 | memset(pState, 0, (blockSize + ((uint32_t) numTaps - 1u)) * sizeof(q31_t)); 86 | 87 | /* Assign state pointer */ 88 | S->pState = pState; 89 | 90 | } 91 | 92 | /** 93 | * @} end of FIR group 94 | */ 95 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_init_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_init_q7.c 9 | * 10 | * Description: Q7 FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.5 2010/04/26 33 | * incorporated review comments and updated with latest CMSIS layer 34 | * 35 | * Version 0.0.3 2010/03/10 36 | * Initial version 37 | * ------------------------------------------------------------------- */ 38 | 39 | #include "arm_math.h" 40 | 41 | /** 42 | * @ingroup groupFilters 43 | */ 44 | 45 | /** 46 | * @addtogroup FIR 47 | * @{ 48 | */ 49 | /** 50 | * @param[in,out] *S points to an instance of the Q7 FIR filter structure. 51 | * @param[in] numTaps Number of filter coefficients in the filter. 52 | * @param[in] *pCoeffs points to the filter coefficients buffer. 53 | * @param[in] *pState points to the state buffer. 54 | * @param[in] blockSize number of samples that are processed per call. 55 | * @return none 56 | * 57 | * Description: 58 | * \par 59 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 60 | *
    
61 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
62 |  * 
63 | * \par 64 | * pState points to the array of state variables. 65 | * pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_q7(). 66 | */ 67 | 68 | void arm_fir_init_q7( 69 | arm_fir_instance_q7 * S, 70 | uint16_t numTaps, 71 | q7_t * pCoeffs, 72 | q7_t * pState, 73 | uint32_t blockSize) 74 | { 75 | 76 | /* Assign filter taps */ 77 | S->numTaps = numTaps; 78 | 79 | /* Assign coefficient pointer */ 80 | S->pCoeffs = pCoeffs; 81 | 82 | /* Clear the state buffer. The size is always (blockSize + numTaps - 1) */ 83 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(q7_t)); 84 | 85 | /* Assign state pointer */ 86 | S->pState = pState; 87 | 88 | } 89 | 90 | /** 91 | * @} end of FIR group 92 | */ 93 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_lattice_init_f32.c 9 | * 10 | * Description: Floating-point FIR Lattice filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Lattice 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the floating-point FIR lattice filter. 49 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. 50 | * @param[in] numStages number of filter stages. 51 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. 52 | * @param[in] *pState points to the state buffer. The array is of length numStages. 53 | * @return none. 54 | */ 55 | 56 | void arm_fir_lattice_init_f32( 57 | arm_fir_lattice_instance_f32 * S, 58 | uint16_t numStages, 59 | float32_t * pCoeffs, 60 | float32_t * pState) 61 | { 62 | /* Assign filter taps */ 63 | S->numStages = numStages; 64 | 65 | /* Assign coefficient pointer */ 66 | S->pCoeffs = pCoeffs; 67 | 68 | /* Clear state buffer and size is always numStages */ 69 | memset(pState, 0, (numStages) * sizeof(float32_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | 74 | } 75 | 76 | /** 77 | * @} end of FIR_Lattice group 78 | */ 79 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_lattice_init_q15.c 9 | * 10 | * Description: Q15 FIR Lattice filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Lattice 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q15 FIR lattice filter. 49 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. 50 | * @param[in] numStages number of filter stages. 51 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. 52 | * @param[in] *pState points to the state buffer. The array is of length numStages. 53 | * @return none. 54 | */ 55 | 56 | void arm_fir_lattice_init_q15( 57 | arm_fir_lattice_instance_q15 * S, 58 | uint16_t numStages, 59 | q15_t * pCoeffs, 60 | q15_t * pState) 61 | { 62 | /* Assign filter taps */ 63 | S->numStages = numStages; 64 | 65 | /* Assign coefficient pointer */ 66 | S->pCoeffs = pCoeffs; 67 | 68 | /* Clear state buffer and size is always numStages */ 69 | memset(pState, 0, (numStages) * sizeof(q15_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | 74 | } 75 | 76 | /** 77 | * @} end of FIR_Lattice group 78 | */ 79 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_lattice_init_q31.c 9 | * 10 | * Description: Q31 FIR lattice filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Lattice 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q31 FIR lattice filter. 49 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. 50 | * @param[in] numStages number of filter stages. 51 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. 52 | * @param[in] *pState points to the state buffer. The array is of length numStages. 53 | * @return none. 54 | */ 55 | 56 | void arm_fir_lattice_init_q31( 57 | arm_fir_lattice_instance_q31 * S, 58 | uint16_t numStages, 59 | q31_t * pCoeffs, 60 | q31_t * pState) 61 | { 62 | /* Assign filter taps */ 63 | S->numStages = numStages; 64 | 65 | /* Assign coefficient pointer */ 66 | S->pCoeffs = pCoeffs; 67 | 68 | /* Clear state buffer and size is always numStages */ 69 | memset(pState, 0, (numStages) * sizeof(q31_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | 74 | } 75 | 76 | /** 77 | * @} end of FIR_Lattice group 78 | */ 79 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_sparse_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_sparse_init_f32.c 9 | * 10 | * Description: Floating-point sparse FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Sparse 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the floating-point sparse FIR filter. 49 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. 50 | * @param[in] numTaps number of nonzero coefficients in the filter. 51 | * @param[in] *pCoeffs points to the array of filter coefficients. 52 | * @param[in] *pState points to the state buffer. 53 | * @param[in] *pTapDelay points to the array of offset times. 54 | * @param[in] maxDelay maximum offset time supported. 55 | * @param[in] blockSize number of samples that will be processed per block. 56 | * @return none 57 | * 58 | * Description: 59 | * \par 60 | * pCoeffs holds the filter coefficients and has length numTaps. 61 | * pState holds the filter's state variables and must be of length 62 | * maxDelay + blockSize, where maxDelay 63 | * is the maximum number of delay line values. 64 | * blockSize is the 65 | * number of samples processed by the arm_fir_sparse_f32() function. 66 | */ 67 | 68 | void arm_fir_sparse_init_f32( 69 | arm_fir_sparse_instance_f32 * S, 70 | uint16_t numTaps, 71 | float32_t * pCoeffs, 72 | float32_t * pState, 73 | int32_t * pTapDelay, 74 | uint16_t maxDelay, 75 | uint32_t blockSize) 76 | { 77 | /* Assign filter taps */ 78 | S->numTaps = numTaps; 79 | 80 | /* Assign coefficient pointer */ 81 | S->pCoeffs = pCoeffs; 82 | 83 | /* Assign TapDelay pointer */ 84 | S->pTapDelay = pTapDelay; 85 | 86 | /* Assign MaxDelay */ 87 | S->maxDelay = maxDelay; 88 | 89 | /* reset the stateIndex to 0 */ 90 | S->stateIndex = 0u; 91 | 92 | /* Clear state buffer and size is always maxDelay + blockSize */ 93 | memset(pState, 0, (maxDelay + blockSize) * sizeof(float32_t)); 94 | 95 | /* Assign state pointer */ 96 | S->pState = pState; 97 | 98 | } 99 | 100 | /** 101 | * @} end of FIR_Sparse group 102 | */ 103 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_sparse_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_sparse_init_q15.c 9 | * 10 | * Description: Q15 sparse FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Sparse 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q15 sparse FIR filter. 49 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. 50 | * @param[in] numTaps number of nonzero coefficients in the filter. 51 | * @param[in] *pCoeffs points to the array of filter coefficients. 52 | * @param[in] *pState points to the state buffer. 53 | * @param[in] *pTapDelay points to the array of offset times. 54 | * @param[in] maxDelay maximum offset time supported. 55 | * @param[in] blockSize number of samples that will be processed per block. 56 | * @return none 57 | * 58 | * Description: 59 | * \par 60 | * pCoeffs holds the filter coefficients and has length numTaps. 61 | * pState holds the filter's state variables and must be of length 62 | * maxDelay + blockSize, where maxDelay 63 | * is the maximum number of delay line values. 64 | * blockSize is the 65 | * number of words processed by arm_fir_sparse_q15() function. 66 | */ 67 | 68 | void arm_fir_sparse_init_q15( 69 | arm_fir_sparse_instance_q15 * S, 70 | uint16_t numTaps, 71 | q15_t * pCoeffs, 72 | q15_t * pState, 73 | int32_t * pTapDelay, 74 | uint16_t maxDelay, 75 | uint32_t blockSize) 76 | { 77 | /* Assign filter taps */ 78 | S->numTaps = numTaps; 79 | 80 | /* Assign coefficient pointer */ 81 | S->pCoeffs = pCoeffs; 82 | 83 | /* Assign TapDelay pointer */ 84 | S->pTapDelay = pTapDelay; 85 | 86 | /* Assign MaxDelay */ 87 | S->maxDelay = maxDelay; 88 | 89 | /* reset the stateIndex to 0 */ 90 | S->stateIndex = 0u; 91 | 92 | /* Clear state buffer and size is always maxDelay + blockSize */ 93 | memset(pState, 0, (maxDelay + blockSize) * sizeof(q15_t)); 94 | 95 | /* Assign state pointer */ 96 | S->pState = pState; 97 | 98 | } 99 | 100 | /** 101 | * @} end of FIR_Sparse group 102 | */ 103 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_sparse_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_sparse_init_q31.c 9 | * 10 | * Description: Q31 sparse FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Sparse 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q31 sparse FIR filter. 49 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. 50 | * @param[in] numTaps number of nonzero coefficients in the filter. 51 | * @param[in] *pCoeffs points to the array of filter coefficients. 52 | * @param[in] *pState points to the state buffer. 53 | * @param[in] *pTapDelay points to the array of offset times. 54 | * @param[in] maxDelay maximum offset time supported. 55 | * @param[in] blockSize number of samples that will be processed per block. 56 | * @return none 57 | * 58 | * Description: 59 | * \par 60 | * pCoeffs holds the filter coefficients and has length numTaps. 61 | * pState holds the filter's state variables and must be of length 62 | * maxDelay + blockSize, where maxDelay 63 | * is the maximum number of delay line values. 64 | * blockSize is the number of words processed by arm_fir_sparse_q31() function. 65 | */ 66 | 67 | void arm_fir_sparse_init_q31( 68 | arm_fir_sparse_instance_q31 * S, 69 | uint16_t numTaps, 70 | q31_t * pCoeffs, 71 | q31_t * pState, 72 | int32_t * pTapDelay, 73 | uint16_t maxDelay, 74 | uint32_t blockSize) 75 | { 76 | /* Assign filter taps */ 77 | S->numTaps = numTaps; 78 | 79 | /* Assign coefficient pointer */ 80 | S->pCoeffs = pCoeffs; 81 | 82 | /* Assign TapDelay pointer */ 83 | S->pTapDelay = pTapDelay; 84 | 85 | /* Assign MaxDelay */ 86 | S->maxDelay = maxDelay; 87 | 88 | /* reset the stateIndex to 0 */ 89 | S->stateIndex = 0u; 90 | 91 | /* Clear state buffer and size is always maxDelay + blockSize */ 92 | memset(pState, 0, (maxDelay + blockSize) * sizeof(q31_t)); 93 | 94 | /* Assign state pointer */ 95 | S->pState = pState; 96 | 97 | } 98 | 99 | /** 100 | * @} end of FIR_Sparse group 101 | */ 102 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_fir_sparse_init_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fir_sparse_init_q7.c 9 | * 10 | * Description: Q7 sparse FIR filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup FIR_Sparse 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q7 sparse FIR filter. 49 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. 50 | * @param[in] numTaps number of nonzero coefficients in the filter. 51 | * @param[in] *pCoeffs points to the array of filter coefficients. 52 | * @param[in] *pState points to the state buffer. 53 | * @param[in] *pTapDelay points to the array of offset times. 54 | * @param[in] maxDelay maximum offset time supported. 55 | * @param[in] blockSize number of samples that will be processed per block. 56 | * @return none 57 | * 58 | * Description: 59 | * \par 60 | * pCoeffs holds the filter coefficients and has length numTaps. 61 | * pState holds the filter's state variables and must be of length 62 | * maxDelay + blockSize, where maxDelay 63 | * is the maximum number of delay line values. 64 | * blockSize is the 65 | * number of samples processed by the arm_fir_sparse_q7() function. 66 | */ 67 | 68 | void arm_fir_sparse_init_q7( 69 | arm_fir_sparse_instance_q7 * S, 70 | uint16_t numTaps, 71 | q7_t * pCoeffs, 72 | q7_t * pState, 73 | int32_t * pTapDelay, 74 | uint16_t maxDelay, 75 | uint32_t blockSize) 76 | { 77 | /* Assign filter taps */ 78 | S->numTaps = numTaps; 79 | 80 | /* Assign coefficient pointer */ 81 | S->pCoeffs = pCoeffs; 82 | 83 | /* Assign TapDelay pointer */ 84 | S->pTapDelay = pTapDelay; 85 | 86 | /* Assign MaxDelay */ 87 | S->maxDelay = maxDelay; 88 | 89 | /* reset the stateIndex to 0 */ 90 | S->stateIndex = 0u; 91 | 92 | /* Clear state buffer and size is always maxDelay + blockSize */ 93 | memset(pState, 0, (maxDelay + blockSize) * sizeof(q7_t)); 94 | 95 | /* Assign state pointer */ 96 | S->pState = pState; 97 | 98 | } 99 | 100 | /** 101 | * @} end of FIR_Sparse group 102 | */ 103 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_iir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_iir_lattice_init_f32.c 9 | * 10 | * Description: Floating-point IIR lattice filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup IIR_Lattice 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the floating-point IIR lattice filter. 49 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. 50 | * @param[in] numStages number of stages in the filter. 51 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. 52 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. 53 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. 54 | * @param[in] blockSize number of samples to process. 55 | * @return none. 56 | */ 57 | 58 | void arm_iir_lattice_init_f32( 59 | arm_iir_lattice_instance_f32 * S, 60 | uint16_t numStages, 61 | float32_t * pkCoeffs, 62 | float32_t * pvCoeffs, 63 | float32_t * pState, 64 | uint32_t blockSize) 65 | { 66 | /* Assign filter taps */ 67 | S->numStages = numStages; 68 | 69 | /* Assign reflection coefficient pointer */ 70 | S->pkCoeffs = pkCoeffs; 71 | 72 | /* Assign ladder coefficient pointer */ 73 | S->pvCoeffs = pvCoeffs; 74 | 75 | /* Clear state buffer and size is always blockSize + numStages */ 76 | memset(pState, 0, (numStages + blockSize) * sizeof(float32_t)); 77 | 78 | /* Assign state pointer */ 79 | S->pState = pState; 80 | 81 | 82 | } 83 | 84 | /** 85 | * @} end of IIR_Lattice group 86 | */ 87 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_iir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_iir_lattice_init_q15.c 9 | * 10 | * Description: Q15 IIR lattice filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup IIR_Lattice 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q15 IIR lattice filter. 49 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. 50 | * @param[in] numStages number of stages in the filter. 51 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. 52 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. 53 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. 54 | * @param[in] blockSize number of samples to process per call. 55 | * @return none. 56 | */ 57 | 58 | void arm_iir_lattice_init_q15( 59 | arm_iir_lattice_instance_q15 * S, 60 | uint16_t numStages, 61 | q15_t * pkCoeffs, 62 | q15_t * pvCoeffs, 63 | q15_t * pState, 64 | uint32_t blockSize) 65 | { 66 | /* Assign filter taps */ 67 | S->numStages = numStages; 68 | 69 | /* Assign reflection coefficient pointer */ 70 | S->pkCoeffs = pkCoeffs; 71 | 72 | /* Assign ladder coefficient pointer */ 73 | S->pvCoeffs = pvCoeffs; 74 | 75 | /* Clear state buffer and size is always blockSize + numStages */ 76 | memset(pState, 0, (numStages + blockSize) * sizeof(q15_t)); 77 | 78 | /* Assign state pointer */ 79 | S->pState = pState; 80 | 81 | 82 | } 83 | 84 | /** 85 | * @} end of IIR_Lattice group 86 | */ 87 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_iir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_iir_lattice_init_q31.c 9 | * 10 | * Description: Initialization function for the Q31 IIR lattice filter. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup IIR_Lattice 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q31 IIR lattice filter. 49 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. 50 | * @param[in] numStages number of stages in the filter. 51 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. 52 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. 53 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. 54 | * @param[in] blockSize number of samples to process. 55 | * @return none. 56 | */ 57 | 58 | void arm_iir_lattice_init_q31( 59 | arm_iir_lattice_instance_q31 * S, 60 | uint16_t numStages, 61 | q31_t * pkCoeffs, 62 | q31_t * pvCoeffs, 63 | q31_t * pState, 64 | uint32_t blockSize) 65 | { 66 | /* Assign filter taps */ 67 | S->numStages = numStages; 68 | 69 | /* Assign reflection coefficient pointer */ 70 | S->pkCoeffs = pkCoeffs; 71 | 72 | /* Assign ladder coefficient pointer */ 73 | S->pvCoeffs = pvCoeffs; 74 | 75 | /* Clear state buffer and size is always blockSize + numStages */ 76 | memset(pState, 0, (numStages + blockSize) * sizeof(q31_t)); 77 | 78 | /* Assign state pointer */ 79 | S->pState = pState; 80 | 81 | 82 | } 83 | 84 | /** 85 | * @} end of IIR_Lattice group 86 | */ 87 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_lms_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_lms_init_f32.c 9 | * 10 | * Description: Floating-point LMS filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @addtogroup LMS 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @brief Initialization function for floating-point LMS filter. 45 | * @param[in] *S points to an instance of the floating-point LMS filter structure. 46 | * @param[in] numTaps number of filter coefficients. 47 | * @param[in] *pCoeffs points to the coefficient buffer. 48 | * @param[in] *pState points to state buffer. 49 | * @param[in] mu step size that controls filter coefficient updates. 50 | * @param[in] blockSize number of samples to process. 51 | * @return none. 52 | */ 53 | 54 | /** 55 | * \par Description: 56 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 57 | *
    
58 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
59 |  * 
60 | * The initial filter coefficients serve as a starting point for the adaptive filter. 61 | * pState points to an array of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_lms_f32(). 62 | */ 63 | 64 | void arm_lms_init_f32( 65 | arm_lms_instance_f32 * S, 66 | uint16_t numTaps, 67 | float32_t * pCoeffs, 68 | float32_t * pState, 69 | float32_t mu, 70 | uint32_t blockSize) 71 | { 72 | /* Assign filter taps */ 73 | S->numTaps = numTaps; 74 | 75 | /* Assign coefficient pointer */ 76 | S->pCoeffs = pCoeffs; 77 | 78 | /* Clear state buffer and size is always blockSize + numTaps */ 79 | memset(pState, 0, (numTaps + (blockSize - 1)) * sizeof(float32_t)); 80 | 81 | /* Assign state pointer */ 82 | S->pState = pState; 83 | 84 | /* Assign Step size value */ 85 | S->mu = mu; 86 | } 87 | 88 | /** 89 | * @} end of LMS group 90 | */ 91 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_lms_init_q15.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_lms_init_q15.c 9 | * 10 | * Description: Q15 LMS filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup LMS 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for the Q15 LMS filter. 49 | * @param[in] *S points to an instance of the Q15 LMS filter structure. 50 | * @param[in] numTaps number of filter coefficients. 51 | * @param[in] *pCoeffs points to the coefficient buffer. 52 | * @param[in] *pState points to the state buffer. 53 | * @param[in] mu step size that controls filter coefficient updates. 54 | * @param[in] blockSize number of samples to process. 55 | * @param[in] postShift bit shift applied to coefficients. 56 | * @return none. 57 | * 58 | * \par Description: 59 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 60 | *
    
 61 | *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
 62 | * 
63 | * The initial filter coefficients serve as a starting point for the adaptive filter. 64 | * pState points to the array of state variables and size of array is 65 | * numTaps+blockSize-1 samples, where blockSize is the number of 66 | * input samples processed by each call to arm_lms_q15(). 67 | */ 68 | 69 | void arm_lms_init_q15( 70 | arm_lms_instance_q15 * S, 71 | uint16_t numTaps, 72 | q15_t * pCoeffs, 73 | q15_t * pState, 74 | q15_t mu, 75 | uint32_t blockSize, 76 | uint32_t postShift) 77 | { 78 | /* Assign filter taps */ 79 | S->numTaps = numTaps; 80 | 81 | /* Assign coefficient pointer */ 82 | S->pCoeffs = pCoeffs; 83 | 84 | /* Clear state buffer and size is always blockSize + numTaps - 1 */ 85 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(q15_t)); 86 | 87 | /* Assign state pointer */ 88 | S->pState = pState; 89 | 90 | /* Assign Step size value */ 91 | S->mu = mu; 92 | 93 | /* Assign postShift value to be applied */ 94 | S->postShift = postShift; 95 | 96 | } 97 | 98 | /** 99 | * @} end of LMS group 100 | */ 101 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_lms_init_q31.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_lms_init_q31.c 9 | * 10 | * Description: Q31 LMS filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup LMS 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for Q31 LMS filter. 49 | * @param[in] *S points to an instance of the Q31 LMS filter structure. 50 | * @param[in] numTaps number of filter coefficients. 51 | * @param[in] *pCoeffs points to coefficient buffer. 52 | * @param[in] *pState points to state buffer. 53 | * @param[in] mu step size that controls filter coefficient updates. 54 | * @param[in] blockSize number of samples to process. 55 | * @param[in] postShift bit shift applied to coefficients. 56 | * @return none. 57 | * 58 | * \par Description: 59 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 60 | *
    
 61 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
 62 |  * 
63 | * The initial filter coefficients serve as a starting point for the adaptive filter. 64 | * pState points to an array of length numTaps+blockSize-1 samples, 65 | * where blockSize is the number of input samples processed by each call to 66 | * arm_lms_q31(). 67 | */ 68 | 69 | void arm_lms_init_q31( 70 | arm_lms_instance_q31 * S, 71 | uint16_t numTaps, 72 | q31_t * pCoeffs, 73 | q31_t * pState, 74 | q31_t mu, 75 | uint32_t blockSize, 76 | uint32_t postShift) 77 | { 78 | /* Assign filter taps */ 79 | S->numTaps = numTaps; 80 | 81 | /* Assign coefficient pointer */ 82 | S->pCoeffs = pCoeffs; 83 | 84 | /* Clear state buffer and size is always blockSize + numTaps - 1 */ 85 | memset(pState, 0, ((uint32_t) numTaps + (blockSize - 1u)) * sizeof(q31_t)); 86 | 87 | /* Assign state pointer */ 88 | S->pState = pState; 89 | 90 | /* Assign Step size value */ 91 | S->mu = mu; 92 | 93 | /* Assign postShift value to be applied */ 94 | S->postShift = postShift; 95 | 96 | } 97 | 98 | /** 99 | * @} end of LMS group 100 | */ 101 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_lms_norm_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_lms_norm_init_f32.c 9 | * 10 | * Description: Floating-point NLMS filter initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupFilters 40 | */ 41 | 42 | /** 43 | * @addtogroup LMS_NORM 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Initialization function for floating-point normalized LMS filter. 49 | * @param[in] *S points to an instance of the floating-point LMS filter structure. 50 | * @param[in] numTaps number of filter coefficients. 51 | * @param[in] *pCoeffs points to coefficient buffer. 52 | * @param[in] *pState points to state buffer. 53 | * @param[in] mu step size that controls filter coefficient updates. 54 | * @param[in] blockSize number of samples to process. 55 | * @return none. 56 | * 57 | * \par Description: 58 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 59 | *
    
 60 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
 61 |  * 
62 | * The initial filter coefficients serve as a starting point for the adaptive filter. 63 | * pState points to an array of length numTaps+blockSize-1 samples, 64 | * where blockSize is the number of input samples processed by each call to arm_lms_norm_f32(). 65 | */ 66 | 67 | void arm_lms_norm_init_f32( 68 | arm_lms_norm_instance_f32 * S, 69 | uint16_t numTaps, 70 | float32_t * pCoeffs, 71 | float32_t * pState, 72 | float32_t mu, 73 | uint32_t blockSize) 74 | { 75 | /* Assign filter taps */ 76 | S->numTaps = numTaps; 77 | 78 | /* Assign coefficient pointer */ 79 | S->pCoeffs = pCoeffs; 80 | 81 | /* Clear state buffer and size is always blockSize + numTaps - 1 */ 82 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(float32_t)); 83 | 84 | /* Assign state pointer */ 85 | S->pState = pState; 86 | 87 | /* Assign Step size value */ 88 | S->mu = mu; 89 | 90 | /* Initialise Energy to zero */ 91 | S->energy = 0.0f; 92 | 93 | /* Initialise x0 to zero */ 94 | S->x0 = 0.0f; 95 | 96 | } 97 | 98 | /** 99 | * @} end of LMS_NORM group 100 | */ 101 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_lms_norm_init_q15.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_lms_norm_init_q15.c 9 | * 10 | * Description: Q15 NLMS initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | #include "arm_common_tables.h" 38 | 39 | /** 40 | * @addtogroup LMS_NORM 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief Initialization function for Q15 normalized LMS filter. 46 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. 47 | * @param[in] numTaps number of filter coefficients. 48 | * @param[in] *pCoeffs points to coefficient buffer. 49 | * @param[in] *pState points to state buffer. 50 | * @param[in] mu step size that controls filter coefficient updates. 51 | * @param[in] blockSize number of samples to process. 52 | * @param[in] postShift bit shift applied to coefficients. 53 | * @return none. 54 | * 55 | * Description: 56 | * \par 57 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 58 | *
    
 59 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
 60 |  * 
61 | * The initial filter coefficients serve as a starting point for the adaptive filter. 62 | * pState points to the array of state variables and size of array is 63 | * numTaps+blockSize-1 samples, where blockSize is the number of input samples processed 64 | * by each call to arm_lms_norm_q15(). 65 | */ 66 | 67 | void arm_lms_norm_init_q15( 68 | arm_lms_norm_instance_q15 * S, 69 | uint16_t numTaps, 70 | q15_t * pCoeffs, 71 | q15_t * pState, 72 | q15_t mu, 73 | uint32_t blockSize, 74 | uint8_t postShift) 75 | { 76 | /* Assign filter taps */ 77 | S->numTaps = numTaps; 78 | 79 | /* Assign coefficient pointer */ 80 | S->pCoeffs = pCoeffs; 81 | 82 | /* Clear state buffer and size is always blockSize + numTaps - 1 */ 83 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(q15_t)); 84 | 85 | /* Assign post Shift value applied to coefficients */ 86 | S->postShift = postShift; 87 | 88 | /* Assign state pointer */ 89 | S->pState = pState; 90 | 91 | /* Assign Step size value */ 92 | S->mu = mu; 93 | 94 | /* Initialize reciprocal pointer table */ 95 | S->recipTable = (q15_t *) armRecipTableQ15; 96 | 97 | /* Initialise Energy to zero */ 98 | S->energy = 0; 99 | 100 | /* Initialise x0 to zero */ 101 | S->x0 = 0; 102 | 103 | } 104 | 105 | /** 106 | * @} end of LMS_NORM group 107 | */ 108 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/FilteringFunctions/arm_lms_norm_init_q31.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_lms_norm_init_q31.c 9 | * 10 | * Description: Q31 NLMS initialization function. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------*/ 35 | 36 | #include "arm_math.h" 37 | #include "arm_common_tables.h" 38 | 39 | /** 40 | * @addtogroup LMS_NORM 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief Initialization function for Q31 normalized LMS filter. 46 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. 47 | * @param[in] numTaps number of filter coefficients. 48 | * @param[in] *pCoeffs points to coefficient buffer. 49 | * @param[in] *pState points to state buffer. 50 | * @param[in] mu step size that controls filter coefficient updates. 51 | * @param[in] blockSize number of samples to process. 52 | * @param[in] postShift bit shift applied to coefficients. 53 | * @return none. 54 | * 55 | * Description: 56 | * \par 57 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 58 | *
    
 59 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
 60 |  * 
61 | * The initial filter coefficients serve as a starting point for the adaptive filter. 62 | * pState points to an array of length numTaps+blockSize-1 samples, 63 | * where blockSize is the number of input samples processed by each call to arm_lms_norm_q31(). 64 | */ 65 | 66 | void arm_lms_norm_init_q31( 67 | arm_lms_norm_instance_q31 * S, 68 | uint16_t numTaps, 69 | q31_t * pCoeffs, 70 | q31_t * pState, 71 | q31_t mu, 72 | uint32_t blockSize, 73 | uint8_t postShift) 74 | { 75 | /* Assign filter taps */ 76 | S->numTaps = numTaps; 77 | 78 | /* Assign coefficient pointer */ 79 | S->pCoeffs = pCoeffs; 80 | 81 | /* Clear state buffer and size is always blockSize + numTaps - 1 */ 82 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(q31_t)); 83 | 84 | /* Assign post Shift value applied to coefficients */ 85 | S->postShift = postShift; 86 | 87 | /* Assign state pointer */ 88 | S->pState = pState; 89 | 90 | /* Assign Step size value */ 91 | S->mu = mu; 92 | 93 | /* Initialize reciprocal pointer table */ 94 | S->recipTable = (q31_t *) armRecipTableQ31; 95 | 96 | /* Initialise Energy to zero */ 97 | S->energy = 0; 98 | 99 | /* Initialise x0 to zero */ 100 | S->x0 = 0; 101 | 102 | } 103 | 104 | /** 105 | * @} end of LMS_NORM group 106 | */ 107 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/MatrixFunctions/arm_mat_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_mat_init_f32.c 9 | * 10 | * Description: Floating-point matrix initialization. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.5 2010/04/26 33 | * incorporated review comments and updated with latest CMSIS layer 34 | * 35 | * Version 0.0.3 2010/03/10 36 | * Initial version 37 | * -------------------------------------------------------------------------- */ 38 | 39 | #include "arm_math.h" 40 | 41 | /** 42 | * @ingroup groupMatrix 43 | */ 44 | 45 | /** 46 | * @defgroup MatrixInit Matrix Initialization 47 | * 48 | * Initializes the underlying matrix data structure. 49 | * The functions set the numRows, 50 | * numCols, and pData fields 51 | * of the matrix data structure. 52 | */ 53 | 54 | /** 55 | * @addtogroup MatrixInit 56 | * @{ 57 | */ 58 | 59 | /** 60 | * @brief Floating-point matrix initialization. 61 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 62 | * @param[in] nRows number of rows in the matrix. 63 | * @param[in] nColumns number of columns in the matrix. 64 | * @param[in] *pData points to the matrix data array. 65 | * @return none 66 | */ 67 | 68 | void arm_mat_init_f32( 69 | arm_matrix_instance_f32 * S, 70 | uint16_t nRows, 71 | uint16_t nColumns, 72 | float32_t * pData) 73 | { 74 | /* Assign Number of Rows */ 75 | S->numRows = nRows; 76 | 77 | /* Assign Number of Columns */ 78 | S->numCols = nColumns; 79 | 80 | /* Assign Data pointer */ 81 | S->pData = pData; 82 | } 83 | 84 | /** 85 | * @} end of MatrixInit group 86 | */ 87 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_mat_init_q15.c 9 | * 10 | * Description: Q15 matrix initialization. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.5 2010/04/26 33 | * incorporated review comments and updated with latest CMSIS layer 34 | * 35 | * Version 0.0.3 2010/03/10 36 | * Initial version 37 | * -------------------------------------------------------------------------- */ 38 | 39 | 40 | #include "arm_math.h" 41 | 42 | /** 43 | * @ingroup groupMatrix 44 | */ 45 | 46 | /** 47 | * @addtogroup MatrixInit 48 | * @{ 49 | */ 50 | 51 | /** 52 | * @brief Q15 matrix initialization. 53 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 54 | * @param[in] nRows number of rows in the matrix. 55 | * @param[in] nColumns number of columns in the matrix. 56 | * @param[in] *pData points to the matrix data array. 57 | * @return none 58 | */ 59 | 60 | void arm_mat_init_q15( 61 | arm_matrix_instance_q15 * S, 62 | uint16_t nRows, 63 | uint16_t nColumns, 64 | q15_t * pData) 65 | { 66 | /* Assign Number of Rows */ 67 | S->numRows = nRows; 68 | 69 | /* Assign Number of Columns */ 70 | S->numCols = nColumns; 71 | 72 | /* Assign Data pointer */ 73 | S->pData = pData; 74 | } 75 | 76 | /** 77 | * @} end of MatrixInit group 78 | */ 79 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_mat_init_q31.c 9 | * 10 | * Description: Q31 matrix initialization. 11 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 12 | * 13 | * Version 1.1.0 2012/02/15 14 | * Updated with more optimizations, bug fixes and minor API changes. 15 | * 16 | * Version 1.0.10 2011/7/15 17 | * Big Endian support added and Merged M0 and M3/M4 Source code. 18 | * 19 | * Version 1.0.3 2010/11/29 20 | * Re-organized the CMSIS folders and updated documentation. 21 | * 22 | * Version 1.0.2 2010/11/11 23 | * Documentation updated. 24 | * 25 | * Version 1.0.1 2010/10/05 26 | * Production release and review comments incorporated. 27 | * 28 | * Version 1.0.0 2010/09/20 29 | * Production release and review comments incorporated. 30 | * 31 | * Version 0.0.5 2010/04/26 32 | * incorporated review comments and updated with latest CMSIS layer 33 | * 34 | * Version 0.0.3 2010/03/10 35 | * Initial version 36 | * -------------------------------------------------------------------------- */ 37 | 38 | 39 | #include "arm_math.h" 40 | 41 | /** 42 | * @ingroup groupMatrix 43 | */ 44 | 45 | /** 46 | * @defgroup MatrixInit Matrix Initialization 47 | * 48 | */ 49 | 50 | /** 51 | * @addtogroup MatrixInit 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @brief Q31 matrix initialization. 57 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 58 | * @param[in] nRows number of rows in the matrix. 59 | * @param[in] nColumns number of columns in the matrix. 60 | * @param[in] *pData points to the matrix data array. 61 | * @return none 62 | */ 63 | 64 | void arm_mat_init_q31( 65 | arm_matrix_instance_q31 * S, 66 | uint16_t nRows, 67 | uint16_t nColumns, 68 | q31_t * pData) 69 | { 70 | /* Assign Number of Rows */ 71 | S->numRows = nRows; 72 | 73 | /* Assign Number of Columns */ 74 | S->numCols = nColumns; 75 | 76 | /* Assign Data pointer */ 77 | S->pData = pData; 78 | } 79 | 80 | /** 81 | * @} end of MatrixInit group 82 | */ 83 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_copy_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_copy_f32.c 9 | * 10 | * Description: Copies the elements of a floating-point vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @defgroup copy Vector Copy 44 | * 45 | * Copies sample by sample from source vector to destination vector. 46 | * 47 | *
    
 48 |  * 	pDst[n] = pSrc[n];   0 <= n < blockSize.    
 49 |  * 
50 | * 51 | * There are separate functions for floating point, Q31, Q15, and Q7 data types. 52 | */ 53 | 54 | /** 55 | * @addtogroup copy 56 | * @{ 57 | */ 58 | 59 | /** 60 | * @brief Copies the elements of a floating-point vector. 61 | * @param[in] *pSrc points to input vector 62 | * @param[out] *pDst points to output vector 63 | * @param[in] blockSize length of the input vector 64 | * @return none. 65 | * 66 | */ 67 | 68 | 69 | void arm_copy_f32( 70 | float32_t * pSrc, 71 | float32_t * pDst, 72 | uint32_t blockSize) 73 | { 74 | uint32_t blkCnt; /* loop counter */ 75 | 76 | #ifndef ARM_MATH_CM0 77 | 78 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 79 | float32_t in1, in2, in3, in4; 80 | 81 | /*loop Unrolling */ 82 | blkCnt = blockSize >> 2u; 83 | 84 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 85 | ** a second loop below computes the remaining 1 to 3 samples. */ 86 | while(blkCnt > 0u) 87 | { 88 | /* C = A */ 89 | /* Copy and then store the results in the destination buffer */ 90 | in1 = *pSrc++; 91 | in2 = *pSrc++; 92 | in3 = *pSrc++; 93 | in4 = *pSrc++; 94 | 95 | *pDst++ = in1; 96 | *pDst++ = in2; 97 | *pDst++ = in3; 98 | *pDst++ = in4; 99 | 100 | /* Decrement the loop counter */ 101 | blkCnt--; 102 | } 103 | 104 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 105 | ** No loop unrolling is used. */ 106 | blkCnt = blockSize % 0x4u; 107 | 108 | #else 109 | 110 | /* Run the below code for Cortex-M0 */ 111 | 112 | /* Loop over blockSize number of values */ 113 | blkCnt = blockSize; 114 | 115 | #endif /* #ifndef ARM_MATH_CM0 */ 116 | 117 | while(blkCnt > 0u) 118 | { 119 | /* C = A */ 120 | /* Copy and then store the results in the destination buffer */ 121 | *pDst++ = *pSrc++; 122 | 123 | /* Decrement the loop counter */ 124 | blkCnt--; 125 | } 126 | } 127 | 128 | /** 129 | * @} end of BasicCopy group 130 | */ 131 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_copy_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_copy_q15.c 9 | * 10 | * Description: Copies the elements of a Q15 vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @addtogroup copy 44 | * @{ 45 | */ 46 | /** 47 | * @brief Copies the elements of a Q15 vector. 48 | * @param[in] *pSrc points to input vector 49 | * @param[out] *pDst points to output vector 50 | * @param[in] blockSize length of the input vector 51 | * @return none. 52 | * 53 | */ 54 | 55 | void arm_copy_q15( 56 | q15_t * pSrc, 57 | q15_t * pDst, 58 | uint32_t blockSize) 59 | { 60 | uint32_t blkCnt; /* loop counter */ 61 | 62 | #ifndef ARM_MATH_CM0 63 | 64 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 65 | 66 | /*loop Unrolling */ 67 | blkCnt = blockSize >> 2u; 68 | 69 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 70 | ** a second loop below computes the remaining 1 to 3 samples. */ 71 | while(blkCnt > 0u) 72 | { 73 | /* C = A */ 74 | /* Read two inputs */ 75 | *__SIMD32(pDst)++ = *__SIMD32(pSrc)++; 76 | *__SIMD32(pDst)++ = *__SIMD32(pSrc)++; 77 | 78 | /* Decrement the loop counter */ 79 | blkCnt--; 80 | } 81 | 82 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 83 | ** No loop unrolling is used. */ 84 | blkCnt = blockSize % 0x4u; 85 | 86 | 87 | #else 88 | 89 | /* Run the below code for Cortex-M0 */ 90 | 91 | /* Loop over blockSize number of values */ 92 | blkCnt = blockSize; 93 | 94 | #endif /* #ifndef ARM_MATH_CM0 */ 95 | 96 | while(blkCnt > 0u) 97 | { 98 | /* C = A */ 99 | /* Copy and then store the value in the destination buffer */ 100 | *pDst++ = *pSrc++; 101 | 102 | /* Decrement the loop counter */ 103 | blkCnt--; 104 | } 105 | } 106 | 107 | /** 108 | * @} end of BasicCopy group 109 | */ 110 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_copy_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_copy_q31.c 9 | * 10 | * Description: Copies the elements of a Q31 vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @addtogroup copy 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Copies the elements of a Q31 vector. 49 | * @param[in] *pSrc points to input vector 50 | * @param[out] *pDst points to output vector 51 | * @param[in] blockSize length of the input vector 52 | * @return none. 53 | * 54 | */ 55 | 56 | void arm_copy_q31( 57 | q31_t * pSrc, 58 | q31_t * pDst, 59 | uint32_t blockSize) 60 | { 61 | uint32_t blkCnt; /* loop counter */ 62 | 63 | 64 | #ifndef ARM_MATH_CM0 65 | 66 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 67 | q31_t in1, in2, in3, in4; 68 | 69 | /*loop Unrolling */ 70 | blkCnt = blockSize >> 2u; 71 | 72 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 73 | ** a second loop below computes the remaining 1 to 3 samples. */ 74 | while(blkCnt > 0u) 75 | { 76 | /* C = A */ 77 | /* Copy and then store the values in the destination buffer */ 78 | in1 = *pSrc++; 79 | in2 = *pSrc++; 80 | in3 = *pSrc++; 81 | in4 = *pSrc++; 82 | 83 | *pDst++ = in1; 84 | *pDst++ = in2; 85 | *pDst++ = in3; 86 | *pDst++ = in4; 87 | 88 | /* Decrement the loop counter */ 89 | blkCnt--; 90 | } 91 | 92 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 93 | ** No loop unrolling is used. */ 94 | blkCnt = blockSize % 0x4u; 95 | 96 | #else 97 | 98 | /* Run the below code for Cortex-M0 */ 99 | 100 | /* Loop over blockSize number of values */ 101 | blkCnt = blockSize; 102 | 103 | #endif /* #ifndef ARM_MATH_CM0 */ 104 | 105 | while(blkCnt > 0u) 106 | { 107 | /* C = A */ 108 | /* Copy and then store the value in the destination buffer */ 109 | *pDst++ = *pSrc++; 110 | 111 | /* Decrement the loop counter */ 112 | blkCnt--; 113 | } 114 | } 115 | 116 | /** 117 | * @} end of BasicCopy group 118 | */ 119 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_copy_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_copy_q7.c 9 | * 10 | * Description: Copies the elements of a Q7 vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @addtogroup copy 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Copies the elements of a Q7 vector. 49 | * @param[in] *pSrc points to input vector 50 | * @param[out] *pDst points to output vector 51 | * @param[in] blockSize length of the input vector 52 | * @return none. 53 | * 54 | */ 55 | 56 | void arm_copy_q7( 57 | q7_t * pSrc, 58 | q7_t * pDst, 59 | uint32_t blockSize) 60 | { 61 | uint32_t blkCnt; /* loop counter */ 62 | 63 | #ifndef ARM_MATH_CM0 64 | 65 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 66 | 67 | /*loop Unrolling */ 68 | blkCnt = blockSize >> 2u; 69 | 70 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 71 | ** a second loop below computes the remaining 1 to 3 samples. */ 72 | while(blkCnt > 0u) 73 | { 74 | /* C = A */ 75 | /* Copy and then store the results in the destination buffer */ 76 | /* 4 samples are copied and stored at a time using SIMD */ 77 | *__SIMD32(pDst)++ = *__SIMD32(pSrc)++; 78 | 79 | /* Decrement the loop counter */ 80 | blkCnt--; 81 | } 82 | 83 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 84 | ** No loop unrolling is used. */ 85 | blkCnt = blockSize % 0x4u; 86 | 87 | #else 88 | 89 | /* Run the below code for Cortex-M0 */ 90 | 91 | /* Loop over blockSize number of values */ 92 | blkCnt = blockSize; 93 | 94 | #endif /* #ifndef ARM_MATH_CM0 */ 95 | 96 | 97 | while(blkCnt > 0u) 98 | { 99 | /* C = A */ 100 | /* Copy and then store the results in the destination buffer */ 101 | *pDst++ = *pSrc++; 102 | 103 | /* Decrement the loop counter */ 104 | blkCnt--; 105 | } 106 | } 107 | 108 | /** 109 | * @} end of BasicCopy group 110 | */ 111 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_fill_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fill_f32.c 9 | * 10 | * Description: Fills a constant value into a floating-point vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * ---------------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @defgroup Fill Vector Fill 44 | * 45 | * Fills the destination vector with a constant value. 46 | * 47 | *
    
 48 |  * 	pDst[n] = value;   0 <= n < blockSize.    
 49 |  * 
50 | * 51 | * There are separate functions for floating point, Q31, Q15, and Q7 data types. 52 | */ 53 | 54 | /** 55 | * @addtogroup Fill 56 | * @{ 57 | */ 58 | 59 | /** 60 | * @brief Fills a constant value into a floating-point vector. 61 | * @param[in] value input value to be filled 62 | * @param[out] *pDst points to output vector 63 | * @param[in] blockSize length of the output vector 64 | * @return none. 65 | * 66 | */ 67 | 68 | 69 | void arm_fill_f32( 70 | float32_t value, 71 | float32_t * pDst, 72 | uint32_t blockSize) 73 | { 74 | uint32_t blkCnt; /* loop counter */ 75 | 76 | #ifndef ARM_MATH_CM0 77 | 78 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 79 | float32_t in1 = value; 80 | float32_t in2 = value; 81 | float32_t in3 = value; 82 | float32_t in4 = value; 83 | 84 | /*loop Unrolling */ 85 | blkCnt = blockSize >> 2u; 86 | 87 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 88 | ** a second loop below computes the remaining 1 to 3 samples. */ 89 | while(blkCnt > 0u) 90 | { 91 | /* C = value */ 92 | /* Fill the value in the destination buffer */ 93 | *pDst++ = in1; 94 | *pDst++ = in2; 95 | *pDst++ = in3; 96 | *pDst++ = in4; 97 | 98 | /* Decrement the loop counter */ 99 | blkCnt--; 100 | } 101 | 102 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 103 | ** No loop unrolling is used. */ 104 | blkCnt = blockSize % 0x4u; 105 | 106 | #else 107 | 108 | /* Run the below code for Cortex-M0 */ 109 | 110 | /* Loop over blockSize number of values */ 111 | blkCnt = blockSize; 112 | 113 | #endif /* #ifndef ARM_MATH_CM0 */ 114 | 115 | 116 | while(blkCnt > 0u) 117 | { 118 | /* C = value */ 119 | /* Fill the value in the destination buffer */ 120 | *pDst++ = value; 121 | 122 | /* Decrement the loop counter */ 123 | blkCnt--; 124 | } 125 | } 126 | 127 | /** 128 | * @} end of Fill group 129 | */ 130 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_fill_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fill_q15.c 9 | * 10 | * Description: Fills a constant value into a Q15 vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @addtogroup Fill 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Fills a constant value into a Q15 vector. 49 | * @param[in] value input value to be filled 50 | * @param[out] *pDst points to output vector 51 | * @param[in] blockSize length of the output vector 52 | * @return none. 53 | * 54 | */ 55 | 56 | void arm_fill_q15( 57 | q15_t value, 58 | q15_t * pDst, 59 | uint32_t blockSize) 60 | { 61 | uint32_t blkCnt; /* loop counter */ 62 | 63 | #ifndef ARM_MATH_CM0 64 | 65 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 66 | 67 | q31_t packedValue; /* value packed to 32 bits */ 68 | 69 | 70 | /*loop Unrolling */ 71 | blkCnt = blockSize >> 2u; 72 | 73 | /* Packing two 16 bit values to 32 bit value in order to use SIMD */ 74 | packedValue = __PKHBT(value, value, 16u); 75 | 76 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 77 | ** a second loop below computes the remaining 1 to 3 samples. */ 78 | while(blkCnt > 0u) 79 | { 80 | /* C = value */ 81 | /* Fill the value in the destination buffer */ 82 | *__SIMD32(pDst)++ = packedValue; 83 | *__SIMD32(pDst)++ = packedValue; 84 | 85 | /* Decrement the loop counter */ 86 | blkCnt--; 87 | } 88 | 89 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 90 | ** No loop unrolling is used. */ 91 | blkCnt = blockSize % 0x4u; 92 | 93 | #else 94 | 95 | /* Run the below code for Cortex-M0 */ 96 | 97 | /* Loop over blockSize number of values */ 98 | blkCnt = blockSize; 99 | 100 | #endif /* #ifndef ARM_MATH_CM0 */ 101 | 102 | while(blkCnt > 0u) 103 | { 104 | /* C = value */ 105 | /* Fill the value in the destination buffer */ 106 | *pDst++ = value; 107 | 108 | /* Decrement the loop counter */ 109 | blkCnt--; 110 | } 111 | } 112 | 113 | /** 114 | * @} end of Fill group 115 | */ 116 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_fill_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fill_q31.c 9 | * 10 | * Description: Fills a constant value into a Q31 vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @addtogroup Fill 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Fills a constant value into a Q31 vector. 49 | * @param[in] value input value to be filled 50 | * @param[out] *pDst points to output vector 51 | * @param[in] blockSize length of the output vector 52 | * @return none. 53 | * 54 | */ 55 | 56 | void arm_fill_q31( 57 | q31_t value, 58 | q31_t * pDst, 59 | uint32_t blockSize) 60 | { 61 | uint32_t blkCnt; /* loop counter */ 62 | 63 | 64 | #ifndef ARM_MATH_CM0 65 | 66 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 67 | q31_t in1 = value; 68 | q31_t in2 = value; 69 | q31_t in3 = value; 70 | q31_t in4 = value; 71 | 72 | /*loop Unrolling */ 73 | blkCnt = blockSize >> 2u; 74 | 75 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 76 | ** a second loop below computes the remaining 1 to 3 samples. */ 77 | while(blkCnt > 0u) 78 | { 79 | /* C = value */ 80 | /* Fill the value in the destination buffer */ 81 | *pDst++ = in1; 82 | *pDst++ = in2; 83 | *pDst++ = in3; 84 | *pDst++ = in4; 85 | 86 | /* Decrement the loop counter */ 87 | blkCnt--; 88 | } 89 | 90 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 91 | ** No loop unrolling is used. */ 92 | blkCnt = blockSize % 0x4u; 93 | 94 | #else 95 | 96 | /* Run the below code for Cortex-M0 */ 97 | 98 | /* Loop over blockSize number of values */ 99 | blkCnt = blockSize; 100 | 101 | #endif /* #ifndef ARM_MATH_CM0 */ 102 | 103 | while(blkCnt > 0u) 104 | { 105 | /* C = value */ 106 | /* Fill the value in the destination buffer */ 107 | *pDst++ = value; 108 | 109 | /* Decrement the loop counter */ 110 | blkCnt--; 111 | } 112 | } 113 | 114 | /** 115 | * @} end of Fill group 116 | */ 117 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_fill_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_fill_q7.c 9 | * 10 | * Description: Fills a constant value into a Q7 vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * 32 | * Version 0.0.7 2010/06/10 33 | * Misra-C changes done 34 | * -------------------------------------------------------------------- */ 35 | 36 | #include "arm_math.h" 37 | 38 | /** 39 | * @ingroup groupSupport 40 | */ 41 | 42 | /** 43 | * @addtogroup Fill 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Fills a constant value into a Q7 vector. 49 | * @param[in] value input value to be filled 50 | * @param[out] *pDst points to output vector 51 | * @param[in] blockSize length of the output vector 52 | * @return none. 53 | * 54 | */ 55 | 56 | void arm_fill_q7( 57 | q7_t value, 58 | q7_t * pDst, 59 | uint32_t blockSize) 60 | { 61 | uint32_t blkCnt; /* loop counter */ 62 | 63 | #ifndef ARM_MATH_CM0 64 | 65 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 66 | 67 | q31_t packedValue; /* value packed to 32 bits */ 68 | 69 | /*loop Unrolling */ 70 | blkCnt = blockSize >> 2u; 71 | 72 | /* Packing four 8 bit values to 32 bit value in order to use SIMD */ 73 | packedValue = __PACKq7(value, value, value, value); 74 | 75 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 76 | ** a second loop below computes the remaining 1 to 3 samples. */ 77 | while(blkCnt > 0u) 78 | { 79 | /* C = value */ 80 | /* Fill the value in the destination buffer */ 81 | *__SIMD32(pDst)++ = packedValue; 82 | 83 | /* Decrement the loop counter */ 84 | blkCnt--; 85 | } 86 | 87 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 88 | ** No loop unrolling is used. */ 89 | blkCnt = blockSize % 0x4u; 90 | 91 | #else 92 | 93 | /* Run the below code for Cortex-M0 */ 94 | 95 | /* Loop over blockSize number of values */ 96 | blkCnt = blockSize; 97 | 98 | #endif /* #ifndef ARM_MATH_CM0 */ 99 | 100 | while(blkCnt > 0u) 101 | { 102 | /* C = value */ 103 | /* Fill the value in the destination buffer */ 104 | *pDst++ = value; 105 | 106 | /* Decrement the loop counter */ 107 | blkCnt--; 108 | } 109 | } 110 | 111 | /** 112 | * @} end of Fill group 113 | */ 114 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/SupportFunctions/arm_q7_to_float.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 15. February 2012 5 | * $Revision: V1.1.0 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_q7_to_float.c 9 | * 10 | * Description: Converts the elements of the Q7 vector to floating-point vector. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Version 1.1.0 2012/02/15 15 | * Updated with more optimizations, bug fixes and minor API changes. 16 | * 17 | * Version 1.0.10 2011/7/15 18 | * Big Endian support added and Merged M0 and M3/M4 Source code. 19 | * 20 | * Version 1.0.3 2010/11/29 21 | * Re-organized the CMSIS folders and updated documentation. 22 | * 23 | * Version 1.0.2 2010/11/11 24 | * Documentation updated. 25 | * 26 | * Version 1.0.1 2010/10/05 27 | * Production release and review comments incorporated. 28 | * 29 | * Version 1.0.0 2010/09/20 30 | * Production release and review comments incorporated. 31 | * ---------------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | 35 | /** 36 | * @ingroup groupSupport 37 | */ 38 | 39 | /** 40 | * @defgroup q7_to_x Convert 8-bit Integer value 41 | */ 42 | 43 | /** 44 | * @addtogroup q7_to_x 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief Converts the elements of the Q7 vector to floating-point vector. 50 | * @param[in] *pSrc points to the Q7 input vector 51 | * @param[out] *pDst points to the floating-point output vector 52 | * @param[in] blockSize length of the input vector 53 | * @return none. 54 | * 55 | * \par Description: 56 | * 57 | * The equation used for the conversion process is: 58 | * 59 | *
    
 60 |  * 	pDst[n] = (float32_t) pSrc[n] / 128;   0 <= n < blockSize.    
 61 |  * 
62 | * 63 | */ 64 | 65 | 66 | void arm_q7_to_float( 67 | q7_t * pSrc, 68 | float32_t * pDst, 69 | uint32_t blockSize) 70 | { 71 | q7_t *pIn = pSrc; /* Src pointer */ 72 | uint32_t blkCnt; /* loop counter */ 73 | 74 | 75 | #ifndef ARM_MATH_CM0 76 | 77 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 78 | 79 | /*loop Unrolling */ 80 | blkCnt = blockSize >> 2u; 81 | 82 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 83 | ** a second loop below computes the remaining 1 to 3 samples. */ 84 | while(blkCnt > 0u) 85 | { 86 | /* C = (float32_t) A / 128 */ 87 | /* convert from q7 to float and then store the results in the destination buffer */ 88 | *pDst++ = ((float32_t) * pIn++ / 128.0f); 89 | *pDst++ = ((float32_t) * pIn++ / 128.0f); 90 | *pDst++ = ((float32_t) * pIn++ / 128.0f); 91 | *pDst++ = ((float32_t) * pIn++ / 128.0f); 92 | 93 | /* Decrement the loop counter */ 94 | blkCnt--; 95 | } 96 | 97 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 98 | ** No loop unrolling is used. */ 99 | blkCnt = blockSize % 0x4u; 100 | 101 | #else 102 | 103 | /* Run the below code for Cortex-M0 */ 104 | 105 | /* Loop over blockSize number of values */ 106 | blkCnt = blockSize; 107 | 108 | #endif /* #ifndef ARM_MATH_CM0 */ 109 | 110 | while(blkCnt > 0u) 111 | { 112 | /* C = (float32_t) A / 128 */ 113 | /* convert from q7 to float and then store the results in the destination buffer */ 114 | *pDst++ = ((float32_t) * pIn++ / 128.0f); 115 | 116 | /* Decrement the loop counter */ 117 | blkCnt--; 118 | } 119 | } 120 | 121 | /** 122 | * @} end of q7_to_x group 123 | */ 124 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern const uint16_t armBitRevTable[1024]; 30 | extern const q15_t armRecipTableQ15[64]; 31 | extern const q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | extern const float32_t twiddleCoef[6144]; 35 | extern const q31_t twiddleCoefQ31[6144]; 36 | extern const q15_t twiddleCoefQ15[6144]; 37 | 38 | #endif /* ARM_COMMON_TABLES_H */ 39 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Libraries/CMSIS/stm32f4xx.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/CMSIS/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 11-January-2013 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f4xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F4XX_H 40 | #define __SYSTEM_STM32F4XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F4xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F4xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F4xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F4xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F4xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F4XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/Fatfs/inc/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / Low level disk interface modlue include file (C)ChaN, 2012 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO_DEFINED 6 | #define _DISKIO_DEFINED 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */ 13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */ 14 | 15 | #include "integer.h" 16 | 17 | /* Status of Disk Functions */ 18 | typedef BYTE DSTATUS; 19 | 20 | /* Results of Disk Functions */ 21 | typedef enum { 22 | RES_OK = 0, /* 0: Successful */ 23 | RES_ERROR, /* 1: R/W Error */ 24 | RES_WRPRT, /* 2: Write Protected */ 25 | RES_NOTRDY, /* 3: Not Ready */ 26 | RES_PARERR /* 4: Invalid Parameter */ 27 | } DRESULT; 28 | 29 | /*---------------------------------------*/ 30 | /* Prototypes for disk control functions */ 31 | 32 | DSTATUS disk_initialize (BYTE); 33 | DSTATUS disk_status (BYTE); 34 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); 35 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); 36 | DRESULT disk_ioctl (BYTE, BYTE, void*); 37 | DWORD get_fattime( void ); 38 | /* Disk Status Bits (DSTATUS) */ 39 | #define STA_NOINIT 0x01 /* Drive not initialized */ 40 | #define STA_NODISK 0x02 /* No medium in the drive */ 41 | #define STA_PROTECT 0x04 /* Write protected */ 42 | 43 | /* Command code for disk_ioctrl fucntion */ 44 | 45 | /* Generic command (used by FatFs) */ 46 | #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */ 47 | #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */ 48 | #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */ 49 | #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ 50 | #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ 51 | 52 | /* Generic command (not used by FatFs) */ 53 | #define CTRL_POWER 5 /* Get/Set power status */ 54 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 55 | #define CTRL_EJECT 7 /* Eject media */ 56 | #define CTRL_FORMAT 8 /* Create physical format on the media */ 57 | 58 | /* MMC/SDC specific ioctl command */ 59 | #define MMC_GET_TYPE 10 /* Get card type */ 60 | #define MMC_GET_CSD 11 /* Get CSD */ 61 | #define MMC_GET_CID 12 /* Get CID */ 62 | #define MMC_GET_OCR 13 /* Get OCR */ 63 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 64 | 65 | /* ATA/CF specific ioctl command */ 66 | #define ATA_GET_REV 20 /* Get F/W revision */ 67 | #define ATA_GET_MODEL 21 /* Get model name */ 68 | #define ATA_GET_SN 22 /* Get serial number */ 69 | 70 | 71 | /* MMC card type flags (MMC_GET_TYPE) */ 72 | #define CT_MMC 0x01 /* MMC ver 3 */ 73 | #define CT_SD1 0x02 /* SD ver 1 */ 74 | #define CT_SD2 0x04 /* SD ver 2 */ 75 | #define CT_SDC (CT_SD1|CT_SD2) /* SD */ 76 | #define CT_BLOCK 0x08 /* Block addressing */ 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/Fatfs/inc/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | #define _INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types must be 16-bit, 32-bit or larger integer */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* These types must be 8-bit integer */ 20 | typedef char CHAR; 21 | typedef unsigned char UCHAR; 22 | typedef unsigned char BYTE; 23 | 24 | /* These types must be 16-bit integer */ 25 | typedef short SHORT; 26 | typedef unsigned short USHORT; 27 | typedef unsigned short WORD; 28 | typedef unsigned short WCHAR; 29 | 30 | /* These types must be 32-bit integer */ 31 | typedef long LONG; 32 | typedef unsigned long ULONG; 33 | typedef unsigned long DWORD; 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/Fatfs/src/diskio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Libraries/Fatfs/src/diskio.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/Fatfs/src/option/unicode.c: -------------------------------------------------------------------------------- 1 | #include "../ff.h" 2 | 3 | #if _USE_LFN != 0 4 | 5 | #if _CODE_PAGE == 932 6 | #include "cc932.c" 7 | #elif _CODE_PAGE == 936 8 | #include "cc936.c" 9 | #elif _CODE_PAGE == 949 10 | #include "cc949.c" 11 | #elif _CODE_PAGE == 950 12 | #include "cc950.c" 13 | #else 14 | #include "ccsbcs.c" 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 11-January-2013 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2013 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_CRC_H 31 | #define __STM32F4xx_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup CRC_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | 62 | void CRC_ResetDR(void); 63 | uint32_t CRC_CalcCRC(uint32_t Data); 64 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 65 | uint32_t CRC_GetCRC(void); 66 | void CRC_SetIDRegister(uint8_t IDValue); 67 | uint8_t CRC_GetIDRegister(void); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* __STM32F4xx_CRC_H */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_bubbleSort.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Algorithm/algorithm_bubbleSort.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_bubblesort.h: -------------------------------------------------------------------------------- 1 | /* #include "Algorithm_bubblesort.h" */ 2 | 3 | #ifndef __ALGORITHM_BUBBLESORT_H 4 | #define __ALGORITHM_BUBBLESORT_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void BubbleSortU8( u16, u8* ); 10 | void BubbleSortU16( u16, u16* ); 11 | void BubbleSortU32( u16, u32* ); 12 | /*=====================================================================================================*/ 13 | /*=====================================================================================================*/ 14 | #endif 15 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_kalman.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_kalman.h" */ 2 | 3 | #ifndef __ALGORITHM_KALMAN_H 4 | #define __ALGORITHM_KALMAN_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | // float KalmanFilter( const float Angle, const float Angular ); 10 | 11 | float xKalmanFilter( const float Angle, const float Angular ); 12 | float yKalmanFilter( const float Angle, const float Angular ); 13 | float zKalmanFilter( const float Angle, const float Angular ); 14 | /*=====================================================================================================*/ 15 | /*=====================================================================================================*/ 16 | #endif 17 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_mathUnit.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Algorithm/algorithm_mathUnit.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_mathUnit.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_mathUnit.h" */ 2 | 3 | #ifndef ____ALGORITHM_MATHUNIt_H 4 | #define ____ALGORITHM_MATHUNIt_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define invSqrtf( iSq ) (1.0f/sqrtf((float)iSq)) 10 | #define squa( Sq ) (((float)Sq)*((float)Sq)) 11 | #define toRad( Math_D ) ((float)(Math_D)*0.0174532925f) 12 | #define toDeg( Math_R ) ((float)(Math_R)*57.2957795f) 13 | /*=====================================================================================================*/ 14 | /*=====================================================================================================*/ 15 | 16 | /*=====================================================================================================*/ 17 | /*=====================================================================================================*/ 18 | #endif 19 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_moveAve.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Algorithm/algorithm_moveAve.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_moveAve.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_moveAve.h" */ 2 | 3 | #ifndef __ALGORITHM_MOVEAVE_H 4 | #define __ALGORITHM_MOVEAVE_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | s16 MoveAve_SMA( s16, s16*, u8 ); 10 | s16 MoveAve_WMA( s16, s16*, u8 ); 11 | /*=====================================================================================================*/ 12 | /*=====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_pid.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Algorithm/algorithm_pid.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_pid.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_pid.h" */ 2 | 3 | #ifndef __ALGORITHM_PID_H 4 | #define __ALGORITHM_PID_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | typedef struct { 10 | float Kp; 11 | float Ki; 12 | float Kd; 13 | float Err0; 14 | float Err1; 15 | float Err2; 16 | float SumErr; 17 | float ZeroErr; 18 | float Output; 19 | float KiMax; 20 | float KiMin; 21 | float OutMax; 22 | float OutMin; 23 | } PID_Struct; 24 | /*=====================================================================================================*/ 25 | /*=====================================================================================================*/ 26 | void PID_Init( PID_Struct* ); 27 | float PID_IncCal( PID_Struct*, float ); 28 | float PID_PosCal( PID_Struct*, float ); 29 | float PID_AHRS_Cal( PID_Struct*, float, float ); 30 | /*=====================================================================================================*/ 31 | /*=====================================================================================================*/ 32 | #endif 33 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_quaternion.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Algorithm/algorithm_quaternion.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Algorithm/algorithm_quaternion.h: -------------------------------------------------------------------------------- 1 | /* #include "algorithm_quaternion.h" */ 2 | 3 | #ifndef __ALGORITHM_QUATERNION_H 4 | #define __ALGORITHM_QUATERNION_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | typedef struct { 10 | float Pitch; 11 | float Roll; 12 | float Yaw; 13 | } EulerAngle; 14 | 15 | typedef struct { 16 | float q0; 17 | float q1; 18 | float q2; 19 | float q3; 20 | } Quaternion; 21 | /*=====================================================================================================*/ 22 | /*=====================================================================================================*/ 23 | void Quaternion_ToNumQ( Quaternion*, EulerAngle* ); 24 | void Quaternion_ToAngE( Quaternion*, EulerAngle* ); 25 | Quaternion Quaternion_Multiply( Quaternion, Quaternion ); 26 | void Quaternion_Normalize( Quaternion* ); 27 | void Quaternion_RungeKutta( Quaternion*, float, float, float, float ); 28 | /*=====================================================================================================*/ 29 | /*=====================================================================================================*/ 30 | extern Quaternion NumQ; 31 | extern EulerAngle AngE; 32 | /*=====================================================================================================*/ 33 | /*=====================================================================================================*/ 34 | #endif 35 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_adc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_adc.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_adc.h: -------------------------------------------------------------------------------- 1 | /* #include "stm32f4_adc.h" */ 2 | 3 | #ifndef __STM32F4_ADC_H 4 | #define __STM32F4_ADC_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define ADC1_DR_ADDRESS ((u32)0x4001204C) 10 | #define ADC2_DR_ADDRESS ((u32)0x4001214C) 11 | #define ADC3_DR_ADDRESS ((u32)0x4001224C) 12 | 13 | #define ADC_Channel 6 14 | #define ADC_Sample 64 15 | /*=====================================================================================================*/ 16 | /*=====================================================================================================*/ 17 | void ADC_Average( u16* ADC_AveTr ); 18 | /*=====================================================================================================*/ 19 | /*=====================================================================================================*/ 20 | extern vu16 ADC_DMA_Buf[ADC_Sample][ADC_Channel]; 21 | /*=====================================================================================================*/ 22 | /*=====================================================================================================*/ 23 | #endif 24 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_delay.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_delay.h: -------------------------------------------------------------------------------- 1 | /* #include "stm32f4_delay.h" */ 2 | 3 | #ifndef __STM32F4_DELAY_H 4 | #define __STM32F4_DELAY_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void Delay_nop( vu32 ); 10 | void Delay_1us( vu32 ); 11 | void Delay_10us( vu32 ); 12 | void Delay_100us( vu32 ); 13 | void Delay_1ms( vu32 ); 14 | void Delay_10ms( vu32 ); 15 | void Delay_100ms( vu32 ); 16 | /*=====================================================================================================*/ 17 | /*=====================================================================================================*/ 18 | #endif 19 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_i2c.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_i2c.h: -------------------------------------------------------------------------------- 1 | /* #include "stm32f4_i2c.h" */ 2 | 3 | #ifndef __STM32F4_I2C_H 4 | #define __STM32F4_I2C_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define I2C1_DR_Address ((u32)0x40005410) 10 | 11 | #define I2C_TIME ((u32)65535) 12 | #define I2C1_SPEED ((u32)400000) 13 | /*=====================================================================================================*/ 14 | /*=====================================================================================================*/ 15 | void I2C_Config(void); 16 | u32 I2C_DMA_Read( u8*, u8, u8, u8* ); 17 | u32 I2C_DMA_ReadReg( u8*, u8, u8, u8 ); 18 | u32 I2C_DMA_Write( u8*, u8, u8, u8* ); 19 | u32 I2C_DMA_WriteReg( u8*, u8, u8, u8 ); 20 | void I2C1_Send_DMA_IRQ( void ); 21 | void I2C1_Recv_DMA_IRQ( void ); 22 | u32 I2C_TimeOut( void ); 23 | /*=====================================================================================================*/ 24 | /*=====================================================================================================*/ 25 | #endif 26 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_sdio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_sdio.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_spi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_spi.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_spi.h: -------------------------------------------------------------------------------- 1 | /* #include "stm32f4_spi.h" */ 2 | 3 | #ifndef __STM32F4_SPI_H 4 | #define __STM32F4_SPI_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | u8 SPI_RW( SPI_TypeDef*, u8 ); 10 | void SPI_WriteByte( SPI_TypeDef*, u8 ); 11 | u8 SPI_ReadByte( SPI_TypeDef* ); 12 | /*=====================================================================================================*/ 13 | /*=====================================================================================================*/ 14 | #endif 15 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_system.c: -------------------------------------------------------------------------------- 1 | /*=====================================================================================================*/ 2 | /*=====================================================================================================*/ 3 | #include "stm32f4_system.h" 4 | /*=====================================================================================================*/ 5 | /*=====================================================================================================*/ 6 | 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_system.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_system.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_typedef.h: -------------------------------------------------------------------------------- 1 | /* #include "stm32f4_typedef.h" */ 2 | 3 | #ifndef __STM32F4_TYPEDEF_H 4 | #define __STM32F4_TYPEDEF_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | // typedef signed long s32; 10 | // typedef signed short s16; 11 | // typedef signed char s8; 12 | 13 | // typedef signed long const sc32; /* Read Only */ 14 | // typedef signed short const sc16; /* Read Only */ 15 | // typedef signed char const sc8; /* Read Only */ 16 | 17 | // typedef volatile signed long vs32; 18 | // typedef volatile signed short vs16; 19 | // typedef volatile signed char vs8; 20 | 21 | // typedef volatile signed long const vsc32; /* Read Only */ 22 | // typedef volatile signed short const vsc16; /* Read Only */ 23 | // typedef volatile signed char const vsc8; /* Read Only */ 24 | 25 | // typedef unsigned long u32; 26 | // typedef unsigned short u16; 27 | // typedef unsigned char u8; 28 | 29 | // typedef unsigned long const uc32; /* Read Only */ 30 | // typedef unsigned short const uc16; /* Read Only */ 31 | // typedef unsigned char const uc8; /* Read Only */ 32 | 33 | // typedef volatile unsigned long vu32; 34 | // typedef volatile unsigned short vu16; 35 | // typedef volatile unsigned char vu8; 36 | 37 | // typedef volatile unsigned long const vuc32; /* Read Only */ 38 | // typedef volatile unsigned short const vuc16; /* Read Only */ 39 | // typedef volatile unsigned char const vuc8; /* Read Only */ 40 | 41 | typedef float fp32; 42 | typedef double fp64; 43 | 44 | typedef volatile float vfp32; 45 | typedef volatile double vfp64; 46 | 47 | typedef float const fpc32; 48 | typedef double const fpc64; 49 | 50 | typedef enum {FALSE = 0, TRUE = !FALSE} bool; 51 | // typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus; 52 | // typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState; 53 | // typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus; 54 | 55 | #define U8_MAX ((u8)255) 56 | #define S8_MAX ((s8)127) 57 | #define S8_MIN ((s8)-128) 58 | #define U16_MAX ((u16)65535u) 59 | #define S16_MAX ((s16)32767) 60 | #define S16_MIN ((s16)-32768) 61 | #define U32_MAX ((u32)4294967295uL) 62 | #define S32_MAX ((s32)2147483647) 63 | #define S32_MIN ((s32)-2147483648) 64 | /*=====================================================================================================*/ 65 | /*=====================================================================================================*/ 66 | #endif 67 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_usart.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Dirver/stm32f4_usart.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Dirver/stm32f4_usart.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/QCopter.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/QCopter.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/QCopter.h: -------------------------------------------------------------------------------- 1 | /* #include "QCopter.h" */ 2 | 3 | #ifndef __QCOPTER_H 4 | #define __QCOPTER_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define FSM_Tx 0 10 | #define FSM_Rx 1 11 | #define FSM_I2C 2 12 | #define FSM_TFT 3 13 | #define FSM_CTRL 4 14 | #define FSM_USART 5 15 | /*=====================================================================================================*/ 16 | /*=====================================================================================================*/ 17 | #endif 18 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/QCopter_it.c: -------------------------------------------------------------------------------- 1 | /*=====================================================================================================*/ 2 | /*=====================================================================================================*/ 3 | #include "stm32f4_system.h" 4 | #include "stm32f4_sdio.h" 5 | #include "QCopter.h" 6 | #include "module_keyBoard.h" 7 | #include "module_nrf24l01.h" 8 | #include "module_xpt2046.h" 9 | /*=====================================================================================================*/ 10 | /*=====================================================================================================*/ 11 | void SysTick_Handler( void ) 12 | { 13 | } 14 | void EXTI3_IRQHandler( void ) 15 | { 16 | if(EXTI_GetITStatus(EXTI_Line3) != RESET) { 17 | // LED8 = ~LED8; 18 | nRF_Recv_IRQ(); 19 | EXTI_ClearITPendingBit(EXTI_Line3); 20 | } 21 | } 22 | void EXTI15_10_IRQHandler( void ) 23 | { 24 | // u8 Times = PEN_TIMES; 25 | 26 | if(EXTI_GetITStatus(EXTI_Line12) != RESET) { 27 | // LED5 = TFT_PEN; 28 | // while(Times--); 29 | // Touch_ReadXY(TouchXY); 30 | EXTI_ClearITPendingBit(EXTI_Line12); 31 | } 32 | } 33 | void SDIO_IRQHandler( void ) 34 | { 35 | SD_ProcessIRQSrc(); 36 | } 37 | void DMA2_Stream3_IRQHandler( void ) 38 | { 39 | SD_ProcessDMAIRQ(); 40 | } 41 | /*=====================================================================================================*/ 42 | /*=====================================================================================================*/ 43 | void HardFault_Handler( void ) 44 | { 45 | while(1){ 46 | LED0 = ~LED0; 47 | Delay_1ms(100); 48 | } 49 | } 50 | void MemManage_Handler( void ) 51 | { 52 | while(1){ 53 | LED1 = ~LED1; 54 | Delay_1ms(100); 55 | } 56 | } 57 | void BusFault_Handler( void ) 58 | { 59 | while(1){ 60 | LED2 = ~LED2; 61 | Delay_1ms(100); 62 | } 63 | } 64 | void UsageFault_Handler( void ) 65 | { 66 | while(1){ 67 | LED3 = ~LED3; 68 | Delay_1ms(100); 69 | } 70 | } 71 | void SVC_Handler( void ) 72 | { 73 | while(1){ 74 | LED4 = ~LED4; 75 | Delay_1ms(100); 76 | } 77 | } 78 | void DebugMon_Handler( void ) 79 | { 80 | while(1){ 81 | LED5 = ~LED5; 82 | Delay_1ms(100); 83 | } 84 | } 85 | void PendSV_Handler( void ) 86 | { 87 | while(1){ 88 | LED6 = ~LED6; 89 | Delay_1ms(100); 90 | } 91 | } 92 | void NMI_Handler( void ) 93 | { 94 | while(1){ 95 | LED7 = ~LED7; 96 | Delay_1ms(100); 97 | } 98 | } 99 | /*=====================================================================================================*/ 100 | /*=====================================================================================================*/ 101 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/lcd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/lcd.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H 2 | #define __LCD_H 3 | 4 | 5 | #define DISP_HOR_RESOLUTION 480 6 | #define DISP_VER_RESOLUTION 800 7 | #define DISP_HOR_PULSE_WIDTH 1 8 | #define DISP_HOR_BACK_PORCH 210 9 | #define DISP_HOR_FRONT_PORCH 45 10 | #define DISP_VER_PULSE_WIDTH 1 11 | #define DISP_VER_BACK_PORCH 34 12 | #define DISP_VER_FRONT_PORCH 10 13 | 14 | #define LCD_XMAX (479) 15 | #define LCD_YMAX (799) 16 | 17 | #define MAX_X 800 18 | #define MAX_Y 480 19 | 20 | #define HT (DISP_HOR_RESOLUTION+DISP_HOR_PULSE_WIDTH+DISP_HOR_BACK_PORCH+DISP_HOR_FRONT_PORCH) 21 | #define HPS (DISP_HOR_PULSE_WIDTH+DISP_HOR_BACK_PORCH) 22 | #define VT (DISP_VER_PULSE_WIDTH+DISP_VER_BACK_PORCH+DISP_VER_FRONT_PORCH+DISP_VER_RESOLUTION) 23 | #define VSP (DISP_VER_PULSE_WIDTH+DISP_VER_BACK_PORCH) 24 | 25 | /* LCD color */ 26 | #define White 0xFFFF 27 | #define Black 0x0000 28 | #define Grey 0xF7DE 29 | #define Blue 0x001F 30 | #define Blue2 0x051F 31 | #define Red 0xF800 32 | #define Magenta 0xF81F 33 | #define Green 0x07E0 34 | #define Cyan 0x7FFF 35 | #define Yellow 0xFFE0 36 | 37 | #define WHITE 0xFFFF 38 | #define BLACK 0x0000 39 | #define GRAY 0xF7DE 40 | #define BLUE 0x001F 41 | #define BLUE2 0x051F 42 | #define RED 0xF800 43 | #define MAGENTA 0xF81F 44 | #define GREEN 0x07E0 45 | #define CYAN 0x7FFF 46 | #define YELLOW 0xFFE0 47 | #define DGRAY Grey 48 | #define DCYAN CYAN 49 | #define PURPLE MAGENTA 50 | #define DGREEN 0x07E0 51 | 52 | void LCD_Initializtion(void); 53 | void LCD_Clear(uint16_t Color); 54 | 55 | void LCD_DrawLine( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1 , uint16_t color ); 56 | static void LCD_SetCursor( uint16_t x, uint16_t y ); 57 | void GUI_Text(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_keyBoard.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_keyBoard.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_keyBoard.h: -------------------------------------------------------------------------------- 1 | /* #include "Module_KeyBoard.h" */ 2 | 3 | #ifndef __MODULE_KEYBOARD_H 4 | #define __MODULE_KEYBOARD_H 5 | 6 | #include "stm32f4xx.h" 7 | #include "stm32f4_adc.h" 8 | /*=====================================================================================================*/ 9 | /*=====================================================================================================*/ 10 | #define LED0 PCO(6) // 11 | #define LED1 PCO(7) // 12 | #define LED2 PBO(0) // 13 | #define LED3 PBO(1) // 14 | #define LED4 PAO(0) // 15 | #define LED5 PAO(1) // 16 | #define LED6 PAO(2) // 17 | #define LED7 PAO(3) // 18 | #define LED8 PBO(8) // 19 | #define LED9 PBO(9) // 20 | 21 | #define KEYR_J PCI(14) // 22 | #define KEYR_U PAI(11) // 23 | #define KEYR_D PAI(10) // 24 | #define KEYR_L PAI(8) // 25 | #define KEYR_R PAI(9) // 26 | #define KEYR_S1 PEI(1) // 27 | #define KEYR_S2 PEI(0) // 28 | #define KEYL_J PEI(2) // 29 | #define KEYL_U PEI(3) // 30 | #define KEYL_D PEI(6) // 31 | #define KEYL_L PEI(4) // 32 | #define KEYL_R PEI(5) // 33 | #define KEYL_S1 PCI(13) // 34 | #define KEYL_S2 PCI(15) // 35 | 36 | /* Joystick ADC Value */ 37 | #define Joystick_X_Max 7670 38 | #define Joystick_X_Med 3640 39 | #define Joystick_X_Min 60 40 | #define Joystick_Y_Max 7670 41 | #define Joystick_Y_Med 3670 42 | #define Joystick_Y_Min 100 43 | #define Joystick_Z_Max 0 44 | #define Joystick_Z_Med 0 45 | #define Joystick_Z_Min 0 46 | /*====================================================================================================*/ 47 | /*====================================================================================================*/ 48 | void KeyBoard_Config( void ); 49 | void KeyBoard_Read( u8* ); 50 | void LED_Shine( u16, u16, u16 ); 51 | void LED_Shift( u16, u16, u16 ); 52 | /*====================================================================================================*/ 53 | /*====================================================================================================*/ 54 | extern u16 ADC_AveTr[ADC_Channel]; 55 | /*====================================================================================================*/ 56 | /*====================================================================================================*/ 57 | #endif 58 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_nrf24l01.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_nrf24l01.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_nrf24l01.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_nrf24l01.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_rs232.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_rs232.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_rs232.h: -------------------------------------------------------------------------------- 1 | /* #include "module_rs232.h" */ 2 | 3 | #ifndef __MODULE_RS232_H 4 | #define __MODULE_RS232_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void RS232_Config( void ); 10 | void RS232_VisualScope( USART_TypeDef*, u8*, u16 ); 11 | /*=====================================================================================================*/ 12 | /*=====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_ssd1963.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_ssd1963.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_ssd1963.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_ssd1963.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_xpt2046.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_xpt2046.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/module_xpt2046.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/module_xpt2046.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/system_engine3D.c: -------------------------------------------------------------------------------- 1 | /*=====================================================================================================*/ 2 | /*=====================================================================================================*/ 3 | #include "stm32f4_system.h" 4 | #include "module_ssd1963.h" 5 | #include "algorithm_mathUnit.h" 6 | #include "system_engine3D.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void Engine3D_RotateX( s16 Angle, s16 *Coordinate ) 10 | { 11 | s16 Temp[2] = {0}; 12 | float TempSin = 0.0f; 13 | float TempCos = 0.0f; 14 | 15 | TempSin = sinf(toRad(Angle)); 16 | TempCos = cosf(toRad(Angle)); 17 | 18 | Temp[0] = (s16)((float)Coordinate[1]*TempCos - (float)Coordinate[2]*TempSin+0.5f); 19 | Temp[1] = (s16)((float)Coordinate[2]*TempCos + (float)Coordinate[1]*TempSin+0.5f); 20 | 21 | Coordinate[1] = Temp[0]; 22 | Coordinate[2] = Temp[1]; 23 | } 24 | /*=====================================================================================================*/ 25 | /*=====================================================================================================*/ 26 | void Engine3D_RotateY( s16 Angle, s16 *Coordinate ) 27 | { 28 | s16 Temp[2] = {0}; 29 | float TempSin = 0.0f; 30 | float TempCos = 0.0f; 31 | 32 | TempSin = sinf(toRad(Angle)); 33 | TempCos = cosf(toRad(Angle)); 34 | 35 | Temp[0] = (s16)((float)Coordinate[0]*TempCos + (float)Coordinate[2]*TempSin + 0.5f); 36 | Temp[1] = (s16)((float)Coordinate[2]*TempCos - (float)Coordinate[0]*TempSin + 0.5f); 37 | 38 | Coordinate[0] = Temp[0]; 39 | Coordinate[2] = Temp[1]; 40 | } 41 | /*=====================================================================================================*/ 42 | /*=====================================================================================================*/ 43 | void Engine3D_RotateZ( s16 Angle, s16 *Coordinate ) 44 | { 45 | s16 Temp[2] = {0}; 46 | float TempSin = 0.0f; 47 | float TempCos = 0.0f; 48 | 49 | TempSin = sinf(toRad(Angle)); 50 | TempCos = cosf(toRad(Angle)); 51 | 52 | Temp[0] = (s16)((float)Coordinate[0]*TempCos - (float)Coordinate[1]*TempSin + 0.5f); 53 | Temp[1] = (s16)((float)Coordinate[1]*TempCos + (float)Coordinate[0]*TempSin + 0.5f); 54 | 55 | Coordinate[0] = Temp[0]; 56 | Coordinate[1] = Temp[1]; 57 | } 58 | /*=====================================================================================================*/ 59 | /*=====================================================================================================*/ 60 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/system_engine3D.h: -------------------------------------------------------------------------------- 1 | /* #include "system_engine3D.h" */ 2 | 3 | #ifndef __SYSTEM_ENGINE3D_H 4 | #define __SYSTEM_ENGINE3D_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void Engine3D_RotateX( s16 Angle, s16 *Coordinate ); 10 | void Engine3D_RotateY( s16 Angle, s16 *Coordinate ); 11 | void Engine3D_RotateZ( s16 Angle, s16 *Coordinate ); 12 | /*=====================================================================================================*/ 13 | /*=====================================================================================================*/ 14 | #endif 15 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/system_waveForm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/system_waveForm.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/system_waveForm.h: -------------------------------------------------------------------------------- 1 | /* #include "system_waveForm.h" */ 2 | 3 | #ifndef __SYSTEM_WAVEFORM_H 4 | #define __SYSTEM_WAVEFORM_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define WaveChannelMax 4 10 | #define WaveWindowX 0 11 | #define WaveWindowY 0 12 | #define WaveFormW 380 13 | #define WaveFormL 120 14 | #define WaveForm2L 240 15 | /*=====================================================================================================*/ 16 | /*=====================================================================================================*/ 17 | typedef struct { 18 | u8 Channel; 19 | s16 Data[WaveChannelMax]; 20 | u16 Scale[WaveChannelMax]; 21 | u32 PointColor[WaveChannelMax]; 22 | u32 WindowColor; 23 | u32 BackColor; 24 | } WaveForm_Struct; 25 | /*=====================================================================================================*/ 26 | /*=====================================================================================================*/ 27 | void WaveFormInit( WaveForm_Struct* WaveForm ); 28 | void WaveFormPrint( WaveForm_Struct* WaveForm ); 29 | /*=====================================================================================================*/ 30 | /*=====================================================================================================*/ 31 | #endif 32 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/system_windows.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/system_windows.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/system_windows.h: -------------------------------------------------------------------------------- 1 | /* #include "system_windows.h" */ 2 | 3 | #ifndef __SYSTEM_WINDOWS_H 4 | #define __SYSTEM_WINDOWS_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define Windows_CTRL 1 10 | #define Windows_WAVE 2 11 | #define Windows_AHRS 3 12 | #define Windows_IMAGE 4 13 | #define Windows_GPS 5 14 | #define Windows_TEST1 6 15 | #define Windows_TEST2 7 16 | 17 | #define Wave_LSM303A 1 18 | #define Wave_L3G4200 2 19 | #define Wave_LSM303M 3 20 | #define Wave_Angular 4 21 | #define Wave_PID 5 22 | #define Wave_SinCos 6 23 | 24 | #define Window_W 246 25 | #define Window_L 480 26 | /*=====================================================================================================*/ 27 | /*=====================================================================================================*/ 28 | void Windows_Init( void ); 29 | void Windows_Interface( u8 Windows_Sel ); 30 | void Windows_DrawMenu( void ); 31 | void Windows_DrawButton( u16 CoordiX, u16 CoordiY, u32 Color ); 32 | 33 | void Windows_DrawFull( u32 ); 34 | void Windows_Change( u8 ); 35 | 36 | static void Windows_SelMenu_Init( void ); 37 | static void Windows_SelMenu( u16, u32, u32 ); 38 | static void MenuCtrl_Motor_Init( void ); 39 | static void MenuCtrl_Motor( void ); 40 | static void MenuCtrl_Power_Init( void ); 41 | static void MenuCtrl_Power( void ); 42 | static void MenuCtrl_Connection_Init( void ); 43 | static void MenuCtrl_Connection( void ); 44 | static void MenuCtrl_Mode_Init( void ); 45 | static void MenuCtrl_Mode( void ); 46 | static void MenuCtrl_WorkTime_Init( void ); 47 | static void MenuCtrl_WorkTime( void ); 48 | /*=====================================================================================================*/ 49 | /*=====================================================================================================*/ 50 | #endif 51 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/tft_spi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/tft_spi.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Master/tft_spi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Master/tft_spi.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/QCopter.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter.h: -------------------------------------------------------------------------------- 1 | /* #include "QCopter.h" */ 2 | 3 | #ifndef __QCOPTER_H 4 | #define __QCOPTER_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define FSM_Tx 0 10 | #define FSM_Rx 1 11 | #define FSM_I2C 2 12 | #define FSM_TFT 3 13 | #define FSM_CTRL 4 14 | #define FSM_USART 5 15 | 16 | #define Mode_OffSet 0 17 | #define Mode_Magnetic 1 18 | #define Mode_Algorithm 2 19 | /*=====================================================================================================*/ 20 | /*=====================================================================================================*/ 21 | #endif 22 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter_AHRS.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/QCopter_AHRS.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter_AHRS.h: -------------------------------------------------------------------------------- 1 | /* #include "QCopter_AHRS.h" */ 2 | 3 | #ifndef __QCOPTER_AHRS_H 4 | #define __QCOPTER_AHRS_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void AHRS_Init( void ); 10 | void AHRS_Update( void ); 11 | /*=====================================================================================================*/ 12 | /*=====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter_CTRL.c: -------------------------------------------------------------------------------- 1 | /*=====================================================================================================*/ 2 | /*=====================================================================================================*/ 3 | #include "stm32f4_system.h" 4 | #include "QCopter_CTRL.h" 5 | #include "algorithm_pid.h" 6 | /*=====================================================================================================*/ 7 | /*=====================================================================================================*/ 8 | PID_Struct PID_Yaw; 9 | PID_Struct PID_Roll; 10 | PID_Struct PID_Pitch; 11 | /*=====================================================================================================*/ 12 | /*=====================================================================================================*/ 13 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter_CTRL.h: -------------------------------------------------------------------------------- 1 | /* #include "QCopter_CTRL.h" */ 2 | 3 | #ifndef __QCOPTER_CTRL_H 4 | #define __QCOPTER_CTRL_H 5 | 6 | #include "stm32f4xx.h" 7 | #include "algorithm_pid.h" 8 | /*=====================================================================================================*/ 9 | /*=====================================================================================================*/ 10 | extern PID_Struct PID_Yaw; 11 | extern PID_Struct PID_Roll; 12 | extern PID_Struct PID_Pitch; 13 | /*=====================================================================================================*/ 14 | /*=====================================================================================================*/ 15 | #endif 16 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/QCopter_it.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/QCopter_it.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_bmp085.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_bmp085.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_bmp085.h: -------------------------------------------------------------------------------- 1 | /* #include "module_bmp085.h" */ 2 | 3 | #ifndef __MODULE_BMP085_H 4 | #define __MODULE_BMP085_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define BMP085_I2C_ADDR ((u8)0xEE) 10 | 11 | #define BMP085_CTRL ((u8)0xF4) 12 | #define BMP085_UT ((u8)0x2E) 13 | #define BMP085_UP_ULR ((u8)0x00) // ((u8)0x34) // Ultra Low Power 14 | #define BMP085_UP_SR ((u8)0x01) // ((u8)0x74) // Standard 15 | #define BMP085_UP_HR ((u8)0x02) // ((u8)0xB4) // High Resolution 16 | #define BMP085_UP_UHR ((u8)0x03) // ((u8)0xF4) // Ultra High Resolution 17 | 18 | #define BMP085_DATA_MSB ((u8)0xF6) 19 | #define BMP085_DATA_LSB ((u8)0xF7) 20 | #define BMP085_DATA_XLSB ((u8)0xF8) 21 | 22 | #define BMP085_AC1_H ((u8)0xAA) 23 | #define BMP085_AC1_L ((u8)0xAB) 24 | #define BMP085_AC2_H ((u8)0xAC) 25 | #define BMP085_AC2_L ((u8)0xAD) 26 | #define BMP085_AC3_H ((u8)0xAE) 27 | #define BMP085_AC3_L ((u8)0xAF) 28 | #define BMP085_AC4_H ((u8)0xB0) 29 | #define BMP085_AC4_L ((u8)0xB1) 30 | #define BMP085_AC5_H ((u8)0xB2) 31 | #define BMP085_AC5_L ((u8)0xB3) 32 | #define BMP085_AC6_H ((u8)0xB4) 33 | #define BMP085_AC6_L ((u8)0xB5) 34 | #define BMP085_B1_H ((u8)0xB6) 35 | #define BMP085_B1_L ((u8)0xB7) 36 | #define BMP085_B2_H ((u8)0xB8) 37 | #define BMP085_B2_L ((u8)0xB9) 38 | #define BMP085_MB_H ((u8)0xBA) 39 | #define BMP085_MB_L ((u8)0xBB) 40 | #define BMP085_MC_H ((u8)0xBC) 41 | #define BMP085_MC_L ((u8)0xBD) 42 | #define BMP085_MD_H ((u8)0xBE) 43 | #define BMP085_MD_L ((u8)0xBF) 44 | /*=====================================================================================================*/ 45 | /*=====================================================================================================*/ 46 | typedef struct { 47 | s16 AC1; 48 | s16 AC2; 49 | s16 AC3; 50 | u16 AC4; 51 | u16 AC5; 52 | u16 AC6; 53 | s16 B1; 54 | s16 B2; 55 | s16 MB; 56 | s16 MC; 57 | s16 MD; 58 | s32 UT; 59 | s32 UP; 60 | s16 OSS; 61 | s32 Temp; 62 | s32 Press; 63 | } BMP085_Struct; 64 | /*====================================================================================================*/ 65 | /*====================================================================================================*/ 66 | void BMP085_Init( u8* ); 67 | void BMP085_ReadCof( u8* ); 68 | void BMP085_Read( BMP085_Struct* ); 69 | /*====================================================================================================*/ 70 | /*====================================================================================================*/ 71 | #endif 72 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_keyBoard.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_keyBoard.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_keyBoard.h: -------------------------------------------------------------------------------- 1 | /* #include "Module_KeyBoard_s.h" */ 2 | 3 | #ifndef __MODULE_KEYBOARD_S_H 4 | #define __MODULE_KEYBOARD_S_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define KeyNums 32 10 | 11 | #define LED_ON 0 12 | #define LED_OFF 1 13 | 14 | #define LED_PWM_Max 2000 15 | #define LED_PWM_Med 1000 16 | #define LED_PWM_Min 0 17 | 18 | #define LED1 PAO(8) // W1 19 | #define LED2 PDO(2) // G1 20 | #define LED3 PAO(4) // B1 21 | #define LED4 PBO(5) // R1 22 | #define LED5 TIM4->CCR3 // W2 23 | #define LED6 TIM5->CCR3 // G2 24 | #define LED7 TIM4->CCR4 // B2 25 | #define LED8 TIM5->CCR4 // R2 26 | #define KEY PAI(5) 27 | 28 | #define KEYR_J KeyCtrl[0] 29 | #define KEYR_U KeyCtrl[1] 30 | #define KEYR_D KeyCtrl[2] 31 | #define KEYR_L KeyCtrl[3] 32 | #define KEYR_R KeyCtrl[4] 33 | #define KEYR_S1 KeyCtrl[5] 34 | #define KEYR_S2 KeyCtrl[6] 35 | #define KEYL_J KeyCtrl[7] 36 | #define KEYL_U KeyCtrl[8] 37 | #define KEYL_D KeyCtrl[9] 38 | #define KEYL_L KeyCtrl[10] 39 | #define KEYL_R KeyCtrl[11] 40 | #define KEYL_S1 KeyCtrl[12] 41 | #define KEYL_S2 KeyCtrl[13] 42 | #define JSR_X KeyCtrl[14] 43 | #define JSR_Y KeyCtrl[15] 44 | #define JSR_Z KeyCtrl[16] 45 | #define JSL_X KeyCtrl[17] 46 | #define JSL_Y KeyCtrl[18] 47 | #define JSL_Z KeyCtrl[19] 48 | 49 | #define Exp_Pitch KeyCtrl[20] 50 | #define Exp_Roll KeyCtrl[21] 51 | #define Exp_Yaw KeyCtrl[22] 52 | #define Exp_Thr KeyCtrl[23] 53 | 54 | #define JSR_X_Max 4080 55 | #define JSR_X_Med 1986 56 | #define JSR_X_Min 210 57 | #define JSR_Y_Max 4080 58 | #define JSR_Y_Med 1986 59 | #define JSR_Y_Min 210 60 | #define JSR_Z_Max 0 61 | #define JSR_Z_Med 0 62 | #define JSR_Z_Min 0 63 | 64 | // //TEST 65 | // #define KEY_Kp PCI(10) 66 | // #define KEY_Ki PCI(11) 67 | // #define KEY_Kd PCI(12) 68 | // #define KEY_U PCI(13) 69 | // #define KEY_D PCI(14) 70 | /*====================================================================================================*/ 71 | /*====================================================================================================*/ 72 | void LED_Config( void ); 73 | void KEY_Config( void ); 74 | void KeyBoard_Read( u8* ); 75 | void LED_Shine( u16, u16, u16 ); 76 | void LED_PWM( u8, u16, u16 ); 77 | void LED_PWM_Shine( u16, u16, u16 ); 78 | /*====================================================================================================*/ 79 | /*====================================================================================================*/ 80 | extern vu16 KeyCtrl[KeyNums]; 81 | /*====================================================================================================*/ 82 | /*====================================================================================================*/ 83 | #endif 84 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_l3g4200.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_l3g4200.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_l3g4200.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_l3g4200.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_lsm303.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_lsm303.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_lsm303.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_lsm303.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_motor.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_motor.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_motor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_motor.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_nrf24l01.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_nrf24l01.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_nrf24l01.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_nrf24l01.h -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_rs232.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_rs232.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_rs232.h: -------------------------------------------------------------------------------- 1 | /* #include "module_rs232.h" */ 2 | 3 | #ifndef __MODULE_RS232_H 4 | #define __MODULE_RS232_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | void RS232_Config( void ); 10 | void RS232_VisualScope( USART_TypeDef*, u8*, u16 ); 11 | /*=====================================================================================================*/ 12 | /*=====================================================================================================*/ 13 | #endif 14 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_sensor.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Program_Slave/module_sensor.c -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Program_Slave/module_sensor.h: -------------------------------------------------------------------------------- 1 | /* #include "module_sensor.h" */ 2 | 3 | #ifndef __MODULE_SENSOR_H 4 | #define __MODULE_SENSOR_H 5 | 6 | #include "stm32f4xx.h" 7 | /*=====================================================================================================*/ 8 | /*=====================================================================================================*/ 9 | #define LSM303A_X_Theoretic 0 10 | #define LSM303A_Y_Theoretic 0 11 | #define LSM303A_Z_Theoretic 8000 // 1000mg/2mg = 500, 500<<4 = 8000 12 | #define L3G4200_X_Theoretic 0 13 | #define L3G4200_Y_Theoretic 0 14 | #define L3G4200_Z_Theoretic 0 15 | #define LSM303M_X_Theoretic 0 // 36352.52nT = 0.3635252Gauss 16 | #define LSM303M_Y_Theoretic 0 17 | #define LSM303M_Z_Theoretic 0 18 | /*=====================================================================================================*/ 19 | /*=====================================================================================================*/ 20 | typedef struct { 21 | s16 X; 22 | s16 Y; 23 | s16 Z; 24 | s16 OffsetX; 25 | s16 OffsetY; 26 | s16 OffsetZ; 27 | float TrueX; 28 | float TrueY; 29 | float TrueZ; 30 | } Sensor; 31 | /*=====================================================================================================*/ 32 | /*=====================================================================================================*/ 33 | extern Sensor Acc; 34 | extern Sensor Gyr; 35 | extern Sensor Meg; 36 | extern Sensor Ang; 37 | extern float Ellipse[5]; 38 | /*=====================================================================================================*/ 39 | /*=====================================================================================================*/ 40 | void Sensor_Init( void ); 41 | void Sensor_EllipseFitting( float*, s16*, s16*, u8 ); 42 | /*=====================================================================================================*/ 43 | /*=====================================================================================================*/ 44 | #endif 45 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Project_MasterV3/Readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Project_MasterV3/Readme.txt -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Project_SlaveV2/Readme.txt: -------------------------------------------------------------------------------- 1 | /*=====================================================================================================*/ 2 | /*=====================================================================================================** 3 | * File Name : Readme.txt 4 | * Author : Hom19910422 5 | * Version : V1.0 6 | * Date : 2012/09/11 7 | * Description : QCopter Fly Board Software/Hardware Information 8 | **=====================================================================================================*/ 9 | /*=====================================================================================================** 10 | * Hardware 11 | * MCU : STM32F405VGT 12 | * SENSOR : L3G4200, LSM303, BMP085 13 | * RF : nRF24L01P+PA+LNA 14 | * LED : 8*LED 15 | * KEY : 1*SmallButton 16 | * 17 | * Add : uBlox NEO-6M, Bluetooth, OV7670 18 | **=====================================================================================================*/ 19 | /*=====================================================================================================** 20 | * Pin Assign 21 | * PA0 PWM5 * PB0 PWM3 * PC0 OV7670_D0 22 | * PA1 PWM6 * PB1 PWM4 * PC1 OV7670_D1 23 | * PA2 LED6 * PB2 BOOT_BOOT1 * PC2 OV7670_D2 24 | * PA3 LED8 * PB3 JTAG_JTDO * PC3 OV7670_D3 25 | * PA4 LED3 * PB4 JTAG_NJTRST * PC4 OV7670_D4 26 | * PA5 KEY * PB5 LED4 * PC5 OV7670_D5 27 | * PA6 PWM1 * PB6 I2C1_SCL * PC6 OV7670_D6 28 | * PA7 PWM2 * PB7 I2C1_SDA * PC7 OV7670_D7 29 | * PA8 LED1 * PB8 LED7 * PC8 OV7670_SCL 30 | * PA9 USART1_Tx * PB9 LED5 * PC9 OV7670_SDA 31 | * PA10 USART1_Rx * PB10 USART3_Tx * PC10 OV7670_VSYN 32 | * PA11 NRF_CE * PB11 USART3_Rx * PC11 OV7670_WRST 33 | * PA12 NRF_IRQ * PB12 NRF_CSN * PC12 OV7670_WEN 34 | * PA13 JTAG_JTMS * PB13 NRF_SCL * PC13 OV7670_RRST 35 | * PA14 JTAG_JTCK * PB14 NRF_MISO * PC14 OV7670_CS 36 | * PA15 JTAG_JTDI * PB15 NRF_MOSI * PC15 OV7670_WR 37 | 38 | * PD2 LED2 39 | **=====================================================================================================*/ 40 | /*=====================================================================================================** 41 | * Function : 42 | * 43 | **=====================================================================================================*/ 44 | /*=====================================================================================================*/ 45 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/STM32F4.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/STM32F4.xlsx -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137.rar -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/AccessPort.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/AccessPort.exe -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/AccessPort.ini: -------------------------------------------------------------------------------- 1 | [Setting] 2 | Language=Chinese(Traditional) 3 | [AccessPort] 4 | SerialPort=1 5 | BaudRate=115200 6 | ParityBit=N 7 | DataBit=8 8 | StopBit=0 9 | FlowControl=0 10 | BufferSize=8192 11 | SendCycle=1000 12 | BytesPerLine=16 13 | CopyHexDumpMode=0 14 | SelectCharMode=0 15 | MaxLogSize_MB=6 16 | TextColor=0 17 | BgColor=16777215 18 | SysParameter=18352736 19 | SendFile= 20 | PredefDataFile= 21 | AutoAckDataFile= 22 | Font_Desc=-11:0:0:0:400:0:0:0:0:1:2:0:34 23 | Font_Name=Courier New 24 | -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/Apsm.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/Apsm.sys -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/Apsm_x64.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/Apsm_x64.sys -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/Language/apchs.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/Language/apchs.ini -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/Language/apcht.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/Language/apcht.ini -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/Language/apeng.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/Language/apeng.ini -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/Language/aprus.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/Language/aprus.ini -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/readme_en_US.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/readme_en_US.txt -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/readme_zh_CN.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/readme_zh_CN.txt -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/AccessPort137/readme_zh_TW.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/AccessPort137/readme_zh_TW.txt -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/Img2Lcd/Img2Lcd.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/Img2Lcd/Img2Lcd.exe -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/Img2Lcd/Img2Lcd_chs.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/Img2Lcd/Img2Lcd_chs.chm -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/Img2Lcd/SSS.DLL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/Img2Lcd/SSS.DLL -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/TFT助手.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/TFT助手.rar -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/CRC16_code.txt: -------------------------------------------------------------------------------- 1 | //The following is the function of CRC16,please refer 2 | //------------------------------------------------------------------------------------------- 3 | unsigned short CRC_CHECK(unsigned char *Buf, unsigned char CRC_CNT) 4 | { 5 | unsigned short CRC_Temp; 6 | unsigned char i,j; 7 | CRC_Temp = 0xffff; 8 | 9 | for (i=0;i>1 ) ^ 0xa001; 14 | else 15 | CRC_Temp = CRC_Temp >> 1; 16 | } 17 | } 18 | return(CRC_Temp); 19 | } -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/VisualScope.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/VisualScope.exe -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/VisualScope.exe使用說明.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/VisualScope.exe使用說明.pdf -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/acc.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/acc.dat -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/config.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/config.dat -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/readme.txt -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/sample.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/sample.dat -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/VisualScope/新建 文本文檔.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/VisualScope/新建 文本文檔.txt -------------------------------------------------------------------------------- /STM32F4_QCopter_20130617/Tool/putty.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/STM32F4_QCopter_20130617/Tool/putty.exe -------------------------------------------------------------------------------- /四軸飛行器_專題報告.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/四軸飛行器_專題報告.pdf -------------------------------------------------------------------------------- /四軸飛行器_專題海報.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/四軸飛行器_專題海報.pdf -------------------------------------------------------------------------------- /四軸飛行器_研究紀錄_20130615.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/四軸飛行器_研究紀錄_20130615.pdf -------------------------------------------------------------------------------- /推導_PID控制器.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/推導_PID控制器.pdf -------------------------------------------------------------------------------- /推導_四元數.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/推導_四元數.pdf -------------------------------------------------------------------------------- /推導_橢圓擬合.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/推導_橢圓擬合.pdf -------------------------------------------------------------------------------- /無人飛行載具_四軸飛行器.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hom-Wang/Quadcopter/c183227b0d462d4653904d70477b0d93cc3441bc/無人飛行載具_四軸飛行器.pdf --------------------------------------------------------------------------------