├── CANopen301 ├── .gitignore ├── CANopen.c ├── CANopen.h ├── Doxyfile ├── LICENSE ├── Makefile ├── README.md ├── codingStyle ├── example │ ├── CO_OD.c │ ├── CO_OD.h │ ├── CO_OD_with_trace │ │ ├── CO_OD.c │ │ └── CO_OD.h │ ├── CO_motor_interface.c │ ├── CO_motor_interface.h │ ├── IO.eds │ ├── IO.html │ ├── _project.html │ ├── _project.xml │ ├── application.c │ ├── application.h │ └── main.c └── stack │ ├── CO_Emergency.c │ ├── CO_Emergency.h │ ├── CO_HBconsumer.c │ ├── CO_HBconsumer.h │ ├── CO_NMT_Heartbeat.c │ ├── CO_NMT_Heartbeat.h │ ├── CO_PDO.c │ ├── CO_PDO.h │ ├── CO_SDO.c │ ├── CO_SDO.h │ ├── CO_SDOmaster.c │ ├── CO_SDOmaster.h │ ├── CO_SYNC.c │ ├── CO_SYNC.h │ ├── CO_trace.c │ ├── CO_trace.h │ ├── STM32F3 │ ├── CO_Flash.c │ ├── CO_Flash.h │ ├── CO_driver.c │ ├── CO_driver.h │ ├── bsp_can.c │ └── bsp_can.h │ ├── crc16-ccitt.c │ ├── crc16-ccitt.h │ ├── drvTemplate │ ├── CO_driver.c │ ├── CO_driver.h │ ├── eeprom.c │ └── eeprom.h │ └── socketCAN │ ├── CO_Linux_tasks.c │ ├── CO_Linux_tasks.h │ ├── CO_OD_storage.c │ ├── CO_OD_storage.h │ ├── CO_driver.c │ └── CO_driver.h ├── Drivers ├── CMSIS │ ├── DSP_Lib │ │ └── Source │ │ │ ├── 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 │ │ │ └── arm_const_structs.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_f64.c │ │ │ ├── arm_biquad_cascade_df2T_init_f32.c │ │ │ ├── arm_biquad_cascade_df2T_init_f64.c │ │ │ ├── arm_biquad_cascade_stereo_df2T_f32.c │ │ │ ├── arm_biquad_cascade_stereo_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_cmplx_mult_f32.c │ │ │ ├── arm_mat_cmplx_mult_q15.c │ │ │ ├── arm_mat_cmplx_mult_q31.c │ │ │ ├── arm_mat_init_f32.c │ │ │ ├── arm_mat_init_q15.c │ │ │ ├── arm_mat_init_q31.c │ │ │ ├── arm_mat_inverse_f32.c │ │ │ ├── arm_mat_inverse_f64.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_f32.c │ │ │ ├── arm_cfft_q15.c │ │ │ ├── arm_cfft_q31.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_cfft_radix8_f32.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_fast_f32.c │ │ │ ├── arm_rfft_fast_init_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 │ ├── Device │ │ └── ST │ │ │ └── STM32F3xx │ │ │ ├── Include │ │ │ ├── stm32f301x8.h │ │ │ ├── stm32f302x8.h │ │ │ ├── stm32f302xc.h │ │ │ ├── stm32f302xe.h │ │ │ ├── stm32f303x8.h │ │ │ ├── stm32f303xc.h │ │ │ ├── stm32f303xe.h │ │ │ ├── stm32f318xx.h │ │ │ ├── stm32f328xx.h │ │ │ ├── stm32f334x8.h │ │ │ ├── stm32f358xx.h │ │ │ ├── stm32f373xc.h │ │ │ ├── stm32f378xx.h │ │ │ ├── stm32f398xx.h │ │ │ ├── stm32f3xx.h │ │ │ └── system_stm32f3xx.h │ │ │ └── Source │ │ │ └── Templates │ │ │ ├── arm │ │ │ ├── startup_stm32f301x8.s │ │ │ ├── startup_stm32f302x8.s │ │ │ ├── startup_stm32f302xc.s │ │ │ ├── startup_stm32f302xe.s │ │ │ ├── startup_stm32f303x8.s │ │ │ ├── startup_stm32f303xc.s │ │ │ ├── startup_stm32f303xe.s │ │ │ ├── startup_stm32f318xx.s │ │ │ ├── startup_stm32f328xx.s │ │ │ ├── startup_stm32f334x8.s │ │ │ ├── startup_stm32f358xx.s │ │ │ ├── startup_stm32f373xc.s │ │ │ ├── startup_stm32f378xx.s │ │ │ └── startup_stm32f398xx.s │ │ │ ├── gcc │ │ │ ├── startup_stm32f301x8.s │ │ │ ├── startup_stm32f302x8.s │ │ │ ├── startup_stm32f302xc.s │ │ │ ├── startup_stm32f302xe.s │ │ │ ├── startup_stm32f303x8.s │ │ │ ├── startup_stm32f303xc.s │ │ │ ├── startup_stm32f303xe.s │ │ │ ├── startup_stm32f318xx.s │ │ │ ├── startup_stm32f328xx.s │ │ │ ├── startup_stm32f334x8.s │ │ │ ├── startup_stm32f358xx.s │ │ │ ├── startup_stm32f373xc.s │ │ │ ├── startup_stm32f378xx.s │ │ │ └── startup_stm32f398xx.s │ │ │ ├── iar │ │ │ ├── linker │ │ │ │ ├── stm32f301x8_flash.icf │ │ │ │ ├── stm32f302x8_flash.icf │ │ │ │ ├── stm32f302xc_flash.icf │ │ │ │ ├── stm32f302xe_flash.icf │ │ │ │ ├── stm32f303x8_flash.icf │ │ │ │ ├── stm32f303xc_flash.icf │ │ │ │ ├── stm32f303xe_flash.icf │ │ │ │ ├── stm32f318xx_flash.icf │ │ │ │ ├── stm32f328xx_flash.icf │ │ │ │ ├── stm32f334x8_flash.icf │ │ │ │ ├── stm32f358xx_flash.icf │ │ │ │ ├── stm32f373xc_flash.icf │ │ │ │ ├── stm32f378xx_flash.icf │ │ │ │ └── stm32f398xx_flash.icf │ │ │ ├── startup_stm32f301x8.s │ │ │ ├── startup_stm32f302x8.s │ │ │ ├── startup_stm32f302xc.s │ │ │ ├── startup_stm32f302xe.s │ │ │ ├── startup_stm32f303x8.s │ │ │ ├── startup_stm32f303xc.s │ │ │ ├── startup_stm32f303xe.s │ │ │ ├── startup_stm32f318xx.s │ │ │ ├── startup_stm32f328xx.s │ │ │ ├── startup_stm32f334x8.s │ │ │ ├── startup_stm32f358xx.s │ │ │ ├── startup_stm32f373xc.s │ │ │ ├── startup_stm32f378xx.s │ │ │ └── startup_stm32f398xx.s │ │ │ └── system_stm32f3xx.c │ ├── Include │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h │ ├── Lib │ │ ├── ARM │ │ │ ├── arm_cortexM4b_math.lib │ │ │ ├── arm_cortexM4bf_math.lib │ │ │ ├── arm_cortexM4l_math.lib │ │ │ └── arm_cortexM4lf_math.lib │ │ └── GCC │ │ │ ├── libarm_cortexM4l_math.a │ │ │ └── libarm_cortexM4lf_math.a │ └── RTOS │ │ └── Template │ │ └── cmsis_os.h └── STM32F3xx_HAL_Driver │ ├── Inc │ ├── Legacy │ │ ├── stm32_hal_legacy.h │ │ └── stm32f3xx_hal_can_legacy.h │ ├── stm32_assert_template.h │ ├── stm32f3xx_hal.h │ ├── stm32f3xx_hal_adc.h │ ├── stm32f3xx_hal_adc_ex.h │ ├── stm32f3xx_hal_can.h │ ├── stm32f3xx_hal_cec.h │ ├── stm32f3xx_hal_comp.h │ ├── stm32f3xx_hal_comp_ex.h │ ├── stm32f3xx_hal_conf_template.h │ ├── stm32f3xx_hal_cortex.h │ ├── stm32f3xx_hal_crc.h │ ├── stm32f3xx_hal_crc_ex.h │ ├── stm32f3xx_hal_dac.h │ ├── stm32f3xx_hal_dac_ex.h │ ├── stm32f3xx_hal_def.h │ ├── stm32f3xx_hal_dma.h │ ├── stm32f3xx_hal_dma_ex.h │ ├── stm32f3xx_hal_flash.h │ ├── stm32f3xx_hal_flash_ex.h │ ├── stm32f3xx_hal_gpio.h │ ├── stm32f3xx_hal_gpio_ex.h │ ├── stm32f3xx_hal_hrtim.h │ ├── stm32f3xx_hal_i2c.h │ ├── stm32f3xx_hal_i2c_ex.h │ ├── stm32f3xx_hal_i2s.h │ ├── stm32f3xx_hal_i2s_ex.h │ ├── stm32f3xx_hal_irda.h │ ├── stm32f3xx_hal_irda_ex.h │ ├── stm32f3xx_hal_iwdg.h │ ├── stm32f3xx_hal_nand.h │ ├── stm32f3xx_hal_nor.h │ ├── stm32f3xx_hal_opamp.h │ ├── stm32f3xx_hal_opamp_ex.h │ ├── stm32f3xx_hal_pccard.h │ ├── stm32f3xx_hal_pcd.h │ ├── stm32f3xx_hal_pcd_ex.h │ ├── stm32f3xx_hal_pwr.h │ ├── stm32f3xx_hal_pwr_ex.h │ ├── stm32f3xx_hal_rcc.h │ ├── stm32f3xx_hal_rcc_ex.h │ ├── stm32f3xx_hal_rtc.h │ ├── stm32f3xx_hal_rtc_ex.h │ ├── stm32f3xx_hal_sdadc.h │ ├── stm32f3xx_hal_smartcard.h │ ├── stm32f3xx_hal_smartcard_ex.h │ ├── stm32f3xx_hal_smbus.h │ ├── stm32f3xx_hal_spi.h │ ├── stm32f3xx_hal_spi_ex.h │ ├── stm32f3xx_hal_sram.h │ ├── stm32f3xx_hal_tim.h │ ├── stm32f3xx_hal_tim_ex.h │ ├── stm32f3xx_hal_tsc.h │ ├── stm32f3xx_hal_uart.h │ ├── stm32f3xx_hal_uart_ex.h │ ├── stm32f3xx_hal_usart.h │ ├── stm32f3xx_hal_usart_ex.h │ ├── stm32f3xx_hal_wwdg.h │ ├── stm32f3xx_ll_adc.h │ ├── stm32f3xx_ll_bus.h │ ├── stm32f3xx_ll_comp.h │ ├── stm32f3xx_ll_cortex.h │ ├── stm32f3xx_ll_crc.h │ ├── stm32f3xx_ll_dac.h │ ├── stm32f3xx_ll_dma.h │ ├── stm32f3xx_ll_exti.h │ ├── stm32f3xx_ll_fmc.h │ ├── stm32f3xx_ll_gpio.h │ ├── stm32f3xx_ll_hrtim.h │ ├── stm32f3xx_ll_i2c.h │ ├── stm32f3xx_ll_iwdg.h │ ├── stm32f3xx_ll_opamp.h │ ├── stm32f3xx_ll_pwr.h │ ├── stm32f3xx_ll_rcc.h │ ├── stm32f3xx_ll_rtc.h │ ├── stm32f3xx_ll_spi.h │ ├── stm32f3xx_ll_system.h │ ├── stm32f3xx_ll_tim.h │ ├── stm32f3xx_ll_usart.h │ ├── stm32f3xx_ll_utils.h │ └── stm32f3xx_ll_wwdg.h │ └── Src │ ├── stm32f3xx_hal.c │ ├── stm32f3xx_hal_adc.c │ ├── stm32f3xx_hal_adc_ex.c │ ├── stm32f3xx_hal_can.c │ ├── stm32f3xx_hal_cec.c │ ├── stm32f3xx_hal_comp.c │ ├── stm32f3xx_hal_cortex.c │ ├── stm32f3xx_hal_crc.c │ ├── stm32f3xx_hal_crc_ex.c │ ├── stm32f3xx_hal_dac.c │ ├── stm32f3xx_hal_dac_ex.c │ ├── stm32f3xx_hal_dma.c │ ├── stm32f3xx_hal_flash.c │ ├── stm32f3xx_hal_flash_ex.c │ ├── stm32f3xx_hal_gpio.c │ ├── stm32f3xx_hal_hrtim.c │ ├── stm32f3xx_hal_i2c.c │ ├── stm32f3xx_hal_i2c_ex.c │ ├── stm32f3xx_hal_i2s.c │ ├── stm32f3xx_hal_i2s_ex.c │ ├── stm32f3xx_hal_irda.c │ ├── stm32f3xx_hal_iwdg.c │ ├── stm32f3xx_hal_msp_template.c │ ├── stm32f3xx_hal_nand.c │ ├── stm32f3xx_hal_nor.c │ ├── stm32f3xx_hal_opamp.c │ ├── stm32f3xx_hal_opamp_ex.c │ ├── stm32f3xx_hal_pccard.c │ ├── stm32f3xx_hal_pcd.c │ ├── stm32f3xx_hal_pcd_ex.c │ ├── stm32f3xx_hal_pwr.c │ ├── stm32f3xx_hal_pwr_ex.c │ ├── stm32f3xx_hal_rcc.c │ ├── stm32f3xx_hal_rcc_ex.c │ ├── stm32f3xx_hal_rtc.c │ ├── stm32f3xx_hal_rtc_ex.c │ ├── stm32f3xx_hal_sdadc.c │ ├── stm32f3xx_hal_smartcard.c │ ├── stm32f3xx_hal_smartcard_ex.c │ ├── stm32f3xx_hal_smbus.c │ ├── stm32f3xx_hal_spi.c │ ├── stm32f3xx_hal_spi_ex.c │ ├── stm32f3xx_hal_sram.c │ ├── stm32f3xx_hal_tim.c │ ├── stm32f3xx_hal_tim_ex.c │ ├── stm32f3xx_hal_timebase_rtc_alarm_template.c │ ├── stm32f3xx_hal_timebase_rtc_wakeup_template.c │ ├── stm32f3xx_hal_timebase_tim_template.c │ ├── stm32f3xx_hal_tsc.c │ ├── stm32f3xx_hal_uart.c │ ├── stm32f3xx_hal_uart_ex.c │ ├── stm32f3xx_hal_usart.c │ ├── stm32f3xx_hal_wwdg.c │ ├── stm32f3xx_ll_adc.c │ ├── stm32f3xx_ll_comp.c │ ├── stm32f3xx_ll_crc.c │ ├── stm32f3xx_ll_dac.c │ ├── stm32f3xx_ll_dma.c │ ├── stm32f3xx_ll_exti.c │ ├── stm32f3xx_ll_fmc.c │ ├── stm32f3xx_ll_gpio.c │ ├── stm32f3xx_ll_hrtim.c │ ├── stm32f3xx_ll_i2c.c │ ├── stm32f3xx_ll_opamp.c │ ├── stm32f3xx_ll_pwr.c │ ├── stm32f3xx_ll_rcc.c │ ├── stm32f3xx_ll_rtc.c │ ├── stm32f3xx_ll_spi.c │ ├── stm32f3xx_ll_tim.c │ ├── stm32f3xx_ll_usart.c │ └── stm32f3xx_ll_utils.c ├── Inc ├── SystemNDriveParams.h ├── UITask.h ├── control_stage_parameters.h ├── drive_parameters.h ├── main.h ├── mc_api.h ├── mc_config.h ├── mc_parameters.h ├── mc_stm_types.h ├── mc_tasks.h ├── motorcontrol.h ├── parameters_conversion.h ├── parameters_conversion_f30x.h ├── pmsm_motor_parameters.h ├── power_stage_parameters.h ├── stm32_assert.h ├── stm32_hal.h ├── stm32f3xx_hal_conf.h ├── stm32f3xx_it.h ├── user_debug.h └── user_interface.h ├── MotorControl ├── Applications │ └── Test_MotorApp │ │ ├── Inc │ │ └── TimeBase.h │ │ └── Src │ │ └── TimeBase.c ├── Legacy │ └── Cube │ │ └── std_hal_missing_define.h ├── MCSDK │ ├── MCLib │ │ ├── Any │ │ │ ├── Inc │ │ │ │ ├── MCIRQHandlerClass.h │ │ │ │ ├── bus_voltage_sensor.h │ │ │ │ ├── circle_limitation.h │ │ │ │ ├── digital_output.h │ │ │ │ ├── enc_align_ctrl.h │ │ │ │ ├── encoder_speed_pos_fdbk.h │ │ │ │ ├── feed_forward_ctrl.h │ │ │ │ ├── flux_weakening_ctrl.h │ │ │ │ ├── hall_speed_pos_fdbk.h │ │ │ │ ├── ics_dd_pwmncurrfdbk.h │ │ │ │ ├── inrush_current_limiter.h │ │ │ │ ├── max_torque_per_ampere.h │ │ │ │ ├── mc_extended_api.h │ │ │ │ ├── mc_interface.h │ │ │ │ ├── mc_irq_handler.h │ │ │ │ ├── mc_library_isr_priority_conf.h │ │ │ │ ├── mc_math.h │ │ │ │ ├── mc_tuning.h │ │ │ │ ├── mc_type.h │ │ │ │ ├── motor_power_measurement.h │ │ │ │ ├── ntc_temperature_sensor.h │ │ │ │ ├── open_loop.h │ │ │ │ ├── pid_regulator.h │ │ │ │ ├── pqd_motor_power_measurement.h │ │ │ │ ├── pwm_curr_fdbk.h │ │ │ │ ├── r1_dd_pwm_curr_fdbk.h │ │ │ │ ├── r3_dd_pwm_curr_fdbk.h │ │ │ │ ├── r_divider_bus_voltage_sensor.h │ │ │ │ ├── ramp_ext_mngr.h │ │ │ │ ├── revup_ctrl.h │ │ │ │ ├── speed_pos_fdbk.h │ │ │ │ ├── speed_torq_ctrl.h │ │ │ │ ├── state_machine.h │ │ │ │ ├── sto_cordic_speed_pos_fdbk.h │ │ │ │ ├── sto_speed_pos_fdbk.h │ │ │ │ ├── virtual_bus_voltage_sensor.h │ │ │ │ └── virtual_speed_sensor.h │ │ │ └── Src │ │ │ │ ├── bus_voltage_sensor.c │ │ │ │ ├── circle_limitation.c │ │ │ │ ├── digital_output.c │ │ │ │ ├── enc_align_ctrl.c │ │ │ │ ├── encoder_speed_pos_fdbk.c │ │ │ │ ├── feed_forward_ctrl.c │ │ │ │ ├── flux_weakening_ctrl.c │ │ │ │ ├── gap_gate_driver_ctrl.c │ │ │ │ ├── hall_speed_pos_fdbk.c │ │ │ │ ├── hifreqinj_fpu_ctrl.c │ │ │ │ ├── inrush_current_limiter.c │ │ │ │ ├── max_torque_per_ampere.c │ │ │ │ ├── mc_interface.c │ │ │ │ ├── mc_irq_handler.c │ │ │ │ ├── mc_math.c │ │ │ │ ├── motor_power_measurement.c │ │ │ │ ├── ntc_temperature_sensor.c │ │ │ │ ├── open_loop.c │ │ │ │ ├── pid_regulator.c │ │ │ │ ├── pqd_motor_power_measurement.c │ │ │ │ ├── pwm_curr_fdbk.c │ │ │ │ ├── r_divider_bus_voltage_sensor.c │ │ │ │ ├── ramp_ext_mngr.c │ │ │ │ ├── revup_ctrl.c │ │ │ │ ├── speed_pos_fdbk.c │ │ │ │ ├── speed_torq_ctrl.c │ │ │ │ ├── state_machine.c │ │ │ │ ├── sto_cordic_speed_pos_fdbk.c │ │ │ │ ├── sto_speed_pos_fdbk.c │ │ │ │ ├── virtual_bus_voltage_sensor.c │ │ │ │ └── virtual_speed_sensor.c │ │ └── F3xx │ │ │ ├── Inc │ │ │ ├── ics_f30x_pwm_curr_fdbk.h │ │ │ ├── r1_f30x_pwm_curr_fdbk.h │ │ │ ├── r3_1_f30x_pwm_curr_fdbk.h │ │ │ ├── r3_2_f30x_pwm_curr_fdbk.h │ │ │ └── r3_4_f30x_pwm_curr_fdbk.h │ │ │ └── Src │ │ │ ├── ics_f30x_pwm_curr_fdbk.c │ │ │ ├── r1_f30x_pwm_curr_fdbk.c │ │ │ ├── r3_1_f30x_pwm_curr_fdbk.c │ │ │ ├── r3_2_f30x_pwm_curr_fdbk.c │ │ │ └── r3_4_f30x_pwm_curr_fdbk.c │ ├── SystemDriveParams │ │ ├── Definitions.h │ │ └── usart_params.h │ └── UILibrary │ │ ├── Inc │ │ ├── LCD_Interface.h │ │ ├── UIIRQHandlerClass.h │ │ ├── UIIRQHandlerPrivate.h │ │ ├── dac_common_ui.h │ │ ├── dac_rctimer_ui.h │ │ ├── dac_ui.h │ │ ├── frame_communication_protocol.h │ │ ├── lcd_exported_functions.h │ │ ├── lcd_manager_ui.h │ │ ├── lcd_vintage_ui.h │ │ ├── motor_control_protocol.h │ │ ├── ui_exported_functions.h │ │ ├── ui_irq_handler.h │ │ ├── unidirectional_fast_com.h │ │ └── usart_frame_communication_protocol.h │ │ └── Src │ │ ├── LCD_Interface.cpp │ │ ├── dac_common_ui.c │ │ ├── dac_rctimer_ui.c │ │ ├── dac_ui.c │ │ ├── frame_communication_protocol.c │ │ ├── lcd_manager_ui.c │ │ ├── lcd_vintage_ui.c │ │ ├── ui_irq_handler.c │ │ ├── unidirectional_fast_com.c │ │ └── usart_frame_communication_protocol.c └── user │ ├── ModbusClient.c │ ├── ModbusClient.h │ ├── crc16.c │ ├── crc16.h │ ├── frame_communication_link_protocol.c │ ├── frame_communication_link_protocol.h │ ├── uart1_frame_communication_protocol.c │ ├── uart1_frame_communication_protocol.h │ ├── uart1_motor_control_protocol.c │ ├── uart1_motor_control_protocol.h │ ├── uart1_user_interface.c │ ├── uart1_user_interface.h │ ├── user_config.c │ └── user_config.h ├── Src ├── main.c ├── mc_api.c ├── mc_config.c ├── mc_parameters.c ├── mc_tasks.c ├── motor_control_protocol.c ├── motorcontrol.c ├── stm32f30x_mc_it.c ├── stm32f3xx_hal_msp.c ├── stm32f3xx_it.c ├── system_stm32f3xx.c ├── ui_task.c ├── user_debug.c └── user_interface.c └── motor-foc-Readme.txt /CANopen301/.gitignore: -------------------------------------------------------------------------------- 1 | canopennode 2 | *.o 3 | 4 | doc/ 5 | 6 | #eclipse 7 | .cproject 8 | .project 9 | .settings/ 10 | 11 | -------------------------------------------------------------------------------- /CANopen301/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for CANopenNode, basic compile with no CAN device. 2 | 3 | 4 | STACKDRV_SRC = stack/drvTemplate 5 | STACK_SRC = stack 6 | CANOPEN_SRC = . 7 | APPL_SRC = example 8 | 9 | 10 | LINK_TARGET = canopennode 11 | 12 | 13 | INCLUDE_DIRS = -I$(STACKDRV_SRC) \ 14 | -I$(STACK_SRC) \ 15 | -I$(CANOPEN_SRC) \ 16 | -I$(APPL_SRC) 17 | 18 | 19 | SOURCES = $(STACKDRV_SRC)/CO_driver.c \ 20 | $(STACKDRV_SRC)/eeprom.c \ 21 | $(STACK_SRC)/crc16-ccitt.c \ 22 | $(STACK_SRC)/CO_SDO.c \ 23 | $(STACK_SRC)/CO_Emergency.c \ 24 | $(STACK_SRC)/CO_NMT_Heartbeat.c \ 25 | $(STACK_SRC)/CO_SYNC.c \ 26 | $(STACK_SRC)/CO_PDO.c \ 27 | $(STACK_SRC)/CO_HBconsumer.c \ 28 | $(STACK_SRC)/CO_SDOmaster.c \ 29 | $(STACK_SRC)/CO_trace.c \ 30 | $(CANOPEN_SRC)/CANopen.c \ 31 | $(APPL_SRC)/CO_OD.c \ 32 | $(APPL_SRC)/main.c 33 | 34 | 35 | OBJS = $(SOURCES:%.c=%.o) 36 | CC = gcc 37 | CFLAGS = -Wall $(INCLUDE_DIRS) 38 | LDFLAGS = 39 | 40 | 41 | .PHONY: all clean 42 | 43 | all: clean $(LINK_TARGET) 44 | 45 | clean: 46 | rm -f $(OBJS) $(LINK_TARGET) 47 | 48 | %.o: %.c 49 | $(CC) $(CFLAGS) -c $< -o $@ 50 | 51 | $(LINK_TARGET): $(OBJS) 52 | $(CC) $(LDFLAGS) $^ -o $@ 53 | -------------------------------------------------------------------------------- /CANopen301/codingStyle: -------------------------------------------------------------------------------- 1 | /** 2 | * Description of the coding style for the source files. 3 | * 4 | * @file codingStyle 5 | * @ingroup codingStyle 6 | * @author Janez Paternoster 7 | * @copyright 2015 Janez Paternoster 8 | * 9 | * License. 10 | */ 11 | 12 | 13 | #ifndef XYZ_H 14 | #define XYZ_H 15 | 16 | 17 | /** 18 | * @defgroup codingStyle Description of coding style 19 | * @ingroup parentGroup 20 | * @{ 21 | * 22 | * Contents of this file should be the base for .h source file, except function 23 | * body at the end. 24 | * 25 | * ###Indentation 26 | * Indent size is 4. 27 | * Spaces are used, not tabs. 28 | * 29 | * ###Doxygen 30 | * Documentation is generated by . 31 | * Doxygen comment starts with /**. /**< is used after member. 32 | * Documentation is usually in header. 33 | * Doxygen settings: 34 | * - JAVADOC_AUTOBRIEF = YES. 35 | * - See doxyfile for other settings. 36 | * 37 | * Doxygen specifics: If description of the structure member is one sentence only, 38 | * don't use period after the sentence. 39 | * 40 | * ###Misra C 41 | * Code shall follow MISRA-C:2012 standard. 42 | */ 43 | 44 | 45 | /** 46 | * Brief description of the object ends at this dot. Details follow 47 | * here. 48 | */ 49 | typedef struct { 50 | int8_t member1; /**< Short description of the member 1 */ 51 | uint16_t member2; /**< Note the '/**<' sequence after the member 2 */ 52 | /** Long description of the variable stringMember. More description. */ 53 | char_t stringMember[5]; 54 | } object1_t; 55 | 56 | 57 | /** 58 | * Function example 1. 59 | * 60 | * This is global function. Local functions (and variables) used inside one file 61 | * are declared as static and not documented by Doxygen. 62 | * 63 | * @param obj Pointer to object. Function operates on this object (not on global 64 | * variables). 65 | * @param arg2 Description of the argument. 66 | * @param arg3 Description of the argument. 67 | * @param arg4 Description of the argument. 68 | * 69 | * @return Some value. 70 | */ 71 | int32_t foo1( 72 | object1_t *obj, 73 | int32_t arg2, 74 | uint16_t arg3, 75 | float32_t arg4) 76 | { 77 | /* Comment */ 78 | 79 | /* Multiline 80 | * comment. 81 | */ 82 | 83 | if(xy == yz) { /* Comment. '//' comments are not allowed */ 84 | ... 85 | } 86 | else { 87 | ... 88 | } 89 | 90 | switch(zx) { 91 | case 1: { 92 | ... 93 | } 94 | } 95 | } 96 | 97 | /** @} */ 98 | #endif 99 | -------------------------------------------------------------------------------- /CANopen301/example/application.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Application interface for CANopenNode stack. 3 | * 4 | * @file application.c 5 | * @ingroup application 6 | * @author Janez Paternoster 7 | * @copyright 2012 - 2013 Janez Paternoster 8 | * 9 | * This file is part of CANopenNode, an opensource CANopen Stack. 10 | * Project home page is . 11 | * For more information on CANopen see . 12 | * 13 | * CANopenNode is free and open source software: you can redistribute 14 | * it and/or modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 2 of the 16 | * License, or (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program. If not, see . 25 | * 26 | * Following clarification and special exception to the GNU General Public 27 | * License is included to the distribution terms of CANopenNode: 28 | * 29 | * Linking this library statically or dynamically with other modules is 30 | * making a combined work based on this library. Thus, the terms and 31 | * conditions of the GNU General Public License cover the whole combination. 32 | * 33 | * As a special exception, the copyright holders of this library give 34 | * you permission to link this library with independent modules to 35 | * produce an executable, regardless of the license terms of these 36 | * independent modules, and to copy and distribute the resulting 37 | * executable under terms of your choice, provided that you also meet, 38 | * for each linked independent module, the terms and conditions of the 39 | * license of that module. An independent module is a module which is 40 | * not derived from or based on this library. If you modify this 41 | * library, you may extend this exception to your version of the 42 | * library, but you are not obliged to do so. If you do not wish 43 | * to do so, delete this exception statement from your version. 44 | */ 45 | 46 | 47 | #include "CANopen.h" 48 | 49 | 50 | /*******************************************************************************/ 51 | void programStart(void){ 52 | 53 | } 54 | 55 | 56 | /*******************************************************************************/ 57 | void communicationReset(void){ 58 | 59 | } 60 | 61 | 62 | /*******************************************************************************/ 63 | void programEnd(void){ 64 | 65 | } 66 | 67 | 68 | /*******************************************************************************/ 69 | void programAsync(uint16_t timer1msDiff){ 70 | 71 | } 72 | 73 | 74 | /*******************************************************************************/ 75 | void program1ms(void){ 76 | 77 | } 78 | -------------------------------------------------------------------------------- /CANopen301/stack/STM32F3/CO_Flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * STM32F3 flash support for CANopen stack 3 | * 4 | * @file CO_Flash.h 5 | * @author Janez Paternoster 6 | * @author Olof Larsson 7 | * @author Petteri Mustonen 8 | * @copyright 2014 Janez Paternoster 9 | * 10 | * This file is part of CANopenNode, an opensource CANopen Stack. 11 | * Project home page is . 12 | * For more information on CANopen see . 13 | * 14 | * CANopenNode is free and open source software: you can redistribute 15 | * it and/or modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation, either version 2 of the 17 | * License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program. If not, see . 26 | * 27 | * Following clarification and special exception to the GNU General Public 28 | * License is included to the distribution terms of CANopenNode: 29 | * 30 | * Linking this library statically or dynamically with other modules is 31 | * making a combined work based on this library. Thus, the terms and 32 | * conditions of the GNU General Public License cover the whole combination. 33 | * 34 | * As a special exception, the copyright holders of this library give 35 | * you permission to link this library with independent modules to 36 | * produce an executable, regardless of the license terms of these 37 | * independent modules, and to copy and distribute the resulting 38 | * executable under terms of your choice, provided that you also meet, 39 | * for each linked independent module, the terms and conditions of the 40 | * license of that module. An independent module is a module which is 41 | * not derived from or based on this library. If you modify this 42 | * library, you may extend this exception to your version of the 43 | * library, but you are not obliged to do so. If you do not wish 44 | * to do so, delete this exception statement from your version. 45 | */ 46 | 47 | #ifndef CO_FLASH_H 48 | #define CO_FLASH_H 49 | 50 | //============================================================================ 51 | // INCLUDES 52 | //============================================================================ 53 | #include "CANopen.h" 54 | 55 | /** 56 | * Initialize flash library and data storage in flash 57 | * We use two blocks in flash for data storage. One block is used for the 58 | * default data that will be restored. The default parameters are stored 59 | * at address CO_OD_Flash_Default_Param. The data that will be loaded at 60 | * startup or saved if user modifies data. 61 | */ 62 | void CO_FlashInit(void); 63 | 64 | /** 65 | * Register object dictionary functions for parameter storage and restoring 66 | * parameters (Object dictionary index 0x1010 Store Param and 0x1011 Restore 67 | * default param. 68 | */ 69 | void CO_FlashRegisterODFunctions(CO_t* CO); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /CANopen301/stack/STM32F3/bsp_can.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/CANopen301/stack/STM32F3/bsp_can.c -------------------------------------------------------------------------------- /CANopen301/stack/STM32F3/bsp_can.h: -------------------------------------------------------------------------------- 1 | #ifndef _BSP_CAN_H 2 | #define _BSP_CAN_H 3 | 4 | #include "stm32f3xx_hal.h" 5 | #include "stm32f3xx.h" 6 | #include 7 | 8 | 9 | /** 10 | * @brief CAN Tx message structure definition 11 | */ 12 | typedef struct 13 | { 14 | uint32_t StdId; /*!< Specifies the standard identifier. 15 | This parameter can be a value between 0 to 0x7FF. */ 16 | 17 | uint32_t ExtId; /*!< Specifies the extended identifier. 18 | This parameter can be a value between 0 to 0x1FFFFFFF. */ 19 | 20 | uint8_t IDE; /*!< Specifies the type of identifier for the message that 21 | will be transmitted. This parameter can be a value 22 | of @ref CAN_identifier_type */ 23 | 24 | uint8_t RTR; /*!< Specifies the type of frame for the message that will 25 | be transmitted. This parameter can be a value of 26 | @ref CAN_remote_transmission_request */ 27 | 28 | uint8_t DLC; /*!< Specifies the length of the frame that will be 29 | transmitted. This parameter can be a value between 30 | 0 to 8 */ 31 | 32 | uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0 33 | to 0xFF. */ 34 | } CanTxMsg; 35 | 36 | 37 | 38 | /** 39 | * @brief CAN Rx message structure definition 40 | */ 41 | typedef struct 42 | { 43 | uint32_t StdId; /*!< Specifies the standard identifier. 44 | This parameter can be a value between 0 to 0x7FF. */ 45 | 46 | uint32_t ExtId; /*!< Specifies the extended identifier. 47 | This parameter can be a value between 0 to 0x1FFFFFFF. */ 48 | 49 | uint8_t IDE; /*!< Specifies the type of identifier for the message that 50 | will be received. This parameter can be a value of 51 | @ref CAN_identifier_type */ 52 | 53 | uint8_t RTR; /*!< Specifies the type of frame for the received message. 54 | This parameter can be a value of 55 | @ref CAN_remote_transmission_request */ 56 | 57 | uint8_t DLC; /*!< Specifies the length of the frame that will be received. 58 | This parameter can be a value between 0 to 8 */ 59 | 60 | uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to 61 | 0xFF. */ 62 | 63 | uint8_t FMI; /*!< Specifies the index of the filter the message stored in 64 | the mailbox passes through. This parameter can be a 65 | value between 0 to 0xFF */ 66 | } CanRxMsg; 67 | /** public perporty */ 68 | extern CAN_RxHeaderTypeDef RxMsg; 69 | extern uint8_t CanRxData[8]; 70 | extern volatile int8_t CAN_RxStatus; 71 | 72 | void MX_CAN_Init(CAN_HandleTypeDef *pCan,uint16_t CANbitRate); 73 | void CAN_SetMsg(CAN_TxHeaderTypeDef *TxMessage); 74 | void CAN_ITConfig(CAN_TypeDef* CANx, uint32_t CAN_IT, FunctionalState NewState); 75 | #endif 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /CANopen301/stack/crc16-ccitt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Calculation of CRC 16 CCITT polynomial. 3 | * 4 | * @file crc16-ccitt.h 5 | * @ingroup CO_crc16_ccitt 6 | * @author Lammert Bies 7 | * @author Janez Paternoster 8 | * @copyright 2012 - 2013 Janez Paternoster 9 | * 10 | * This file is part of CANopenNode, an opensource CANopen Stack. 11 | * Project home page is . 12 | * For more information on CANopen see . 13 | * 14 | * CANopenNode is free and open source software: you can redistribute 15 | * it and/or modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation, either version 2 of the 17 | * License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program. If not, see . 26 | * 27 | * Following clarification and special exception to the GNU General Public 28 | * License is included to the distribution terms of CANopenNode: 29 | * 30 | * Linking this library statically or dynamically with other modules is 31 | * making a combined work based on this library. Thus, the terms and 32 | * conditions of the GNU General Public License cover the whole combination. 33 | * 34 | * As a special exception, the copyright holders of this library give 35 | * you permission to link this library with independent modules to 36 | * produce an executable, regardless of the license terms of these 37 | * independent modules, and to copy and distribute the resulting 38 | * executable under terms of your choice, provided that you also meet, 39 | * for each linked independent module, the terms and conditions of the 40 | * license of that module. An independent module is a module which is 41 | * not derived from or based on this library. If you modify this 42 | * library, you may extend this exception to your version of the 43 | * library, but you are not obliged to do so. If you do not wish 44 | * to do so, delete this exception statement from your version. 45 | */ 46 | 47 | 48 | #ifndef CRC16_CCITT_H 49 | #define CRC16_CCITT_H 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | /** 56 | * @defgroup CO_crc16_ccitt CRC 16 CCITT 57 | * @ingroup CO_CANopen 58 | * @{ 59 | * 60 | * Calculation of CRC 16 CCITT polynomial. 61 | * 62 | * Equation: 63 | * 64 | * `x^16 + x^12 + x^5 + 1` 65 | */ 66 | 67 | 68 | /** 69 | * Calculate CRC sum on block of data. 70 | * 71 | * @param block Pointer to block of data. 72 | * @param blockLength Length of data in bytes; 73 | * @param crc Initial value (zero for xmodem). If block is split into 74 | * multiple segments, previous CRC is used as initial. 75 | * 76 | * @return Calculated CRC. 77 | */ 78 | #ifdef CO_USE_OWN_CRC16 79 | extern 80 | #endif 81 | unsigned short crc16_ccitt( 82 | const unsigned char block[], 83 | unsigned int blockLength, 84 | unsigned short crc); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif /*__cplusplus*/ 89 | 90 | /** @} */ 91 | #endif 92 | -------------------------------------------------------------------------------- /CANopen301/stack/socketCAN/CO_Linux_tasks.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Helper functions for implementing CANopen tasks in Linux using epoll. 3 | * 4 | * @file Linux_tasks.h 5 | * @author Janez Paternoster 6 | * @copyright 2015 Janez Paternoster 7 | * 8 | * This file is part of CANopenNode, an opensource CANopen Stack. 9 | * Project home page is . 10 | * For more information on CANopen see . 11 | * 12 | * CANopenNode is free and open source software: you can redistribute 13 | * it and/or modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation, either version 2 of the 15 | * License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | */ 25 | 26 | 27 | #ifndef CO_LINUX_TASKS_H 28 | #define CO_LINUX_TASKS_H 29 | 30 | 31 | /** 32 | * Initialize mainline task. 33 | * 34 | * taskMain is non-realtime task for CANopenNode processing. It is nonblocking 35 | * and is executing cyclically in 50 ms intervals or less if necessary. 36 | * It uses Linux epoll, timerfd for interval and pipe for task triggering. 37 | * This task processes CO_process() function from CANopen.c file. 38 | * 39 | * @param fdEpoll File descriptor for Linux epoll API. 40 | * @param maxTime Pointer to variable, where longest interval will be written 41 | * [in milliseconds]. If NULL, calculations won't be made. 42 | */ 43 | void taskMain_init(int fdEpoll, uint16_t *maxTime); 44 | 45 | /** 46 | * Cleanup mainline task. 47 | */ 48 | void taskMain_close(void); 49 | 50 | /** 51 | * Process mainline task. 52 | * 53 | * Function must be called after epoll. 54 | * 55 | * @param fd Available file descriptor from epoll(). 56 | * @param reset return value from CO_process() function. 57 | * @param timer1ms variable, which must increment each millisecond. 58 | * 59 | * @return True, if fd was matched. 60 | */ 61 | bool_t taskMain_process(int fd, CO_NMT_reset_cmd_t *reset, uint16_t timer1ms); 62 | 63 | /** 64 | * Signal function, which triggers mainline task. 65 | * 66 | * It is used from some CANopenNode objects as callback. 67 | */ 68 | void taskMain_cbSignal(void); 69 | 70 | 71 | /** 72 | * Initialize realtime task. 73 | * 74 | * CANrx_taskTmr is realtime task for CANopenNode processing. It is nonblocking 75 | * and is executing on CAN message receive or periodically in 1ms (or something) 76 | * intervals. Inside interval is processed CANopen SYNC message, RPDOs(inputs) 77 | * and TPDOs(outputs). Between inputs and outputs can also be executed some 78 | * realtime application code. 79 | * CANrx_taskTmr uses Linux epoll, CAN socket form CO_driver.c and timerfd for 80 | * interval. 81 | * 82 | * 83 | * @param fdEpoll File descriptor for Linux epoll API. 84 | * @param intervalns Interval of periodic timer in nanoseconds. 85 | * @param maxTime Pointer to variable, where longest interval will be written 86 | * [in milliseconds]. If NULL, calculations won't be made. 87 | */ 88 | void CANrx_taskTmr_init(int fdEpoll, long intervalns, uint16_t *maxTime); 89 | 90 | /** 91 | * Cleanup realtime task. 92 | */ 93 | void CANrx_taskTmr_close(void); 94 | 95 | /** 96 | * Process realtime task. 97 | * 98 | * Function must be called after epoll. 99 | * 100 | * @param fd Available file descriptor from epoll(). 101 | * 102 | * @return True, if fd was matched. 103 | */ 104 | bool_t CANrx_taskTmr_process(int fd); 105 | 106 | /** 107 | * Disable CAN receive thread temporary. 108 | * 109 | * Function is called at SYNC message on CAN bus. 110 | * It disables CAN receive thread until RPDOs are processed. 111 | */ 112 | void CANrx_lockCbSync(bool_t syncReceived); 113 | 114 | #endif 115 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions 17 | * are met: 18 | * - Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * - Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in 22 | * the documentation and/or other materials provided with the 23 | * distribution. 24 | * - Neither the name of ARM LIMITED nor the names of its contributors 25 | * may be used to endorse or promote products derived from this 26 | * software without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 31 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 32 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 33 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 34 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 35 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 36 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 38 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 39 | * POSSIBILITY OF SUCH DAMAGE. 40 | * ------------------------------------------------------------------- */ 41 | 42 | #include "arm_math.h" 43 | 44 | /** 45 | * @addtogroup PID 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @brief Initialization function for the floating-point PID Control. 51 | * @param[in,out] *S points to an instance of the PID structure. 52 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state & 1 = reset the state. 53 | * @return none. 54 | * \par Description: 55 | * \par 56 | * The resetStateFlag specifies whether to set state to zero or not. \n 57 | * The function computes the structure fields: A0, A1 A2 58 | * using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 59 | * also sets the state variables to all zeros. 60 | */ 61 | 62 | void arm_pid_init_f32( 63 | arm_pid_instance_f32 * S, 64 | int32_t resetStateFlag) 65 | { 66 | 67 | /* Derived coefficient A0 */ 68 | S->A0 = S->Kp + S->Ki + S->Kd; 69 | 70 | /* Derived coefficient A1 */ 71 | S->A1 = (-S->Kp) - ((float32_t) 2.0 * S->Kd); 72 | 73 | /* Derived coefficient A2 */ 74 | S->A2 = S->Kd; 75 | 76 | /* Check whether state needs reset or not */ 77 | if(resetStateFlag) 78 | { 79 | /* Clear the state buffer. The size will be always 3 samples */ 80 | memset(S->state, 0, 3u * sizeof(float32_t)); 81 | } 82 | 83 | } 84 | 85 | /** 86 | * @} end of PID group 87 | */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @addtogroup PID 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief Reset function for the floating-point PID Control. 50 | * @param[in] *S Instance pointer of PID control data structure. 51 | * @return none. 52 | * \par Description: 53 | * The function resets the state buffer to zeros. 54 | */ 55 | void arm_pid_reset_f32( 56 | arm_pid_instance_f32 * S) 57 | { 58 | 59 | /* Clear the state buffer. The size will be always 3 samples */ 60 | memset(S->state, 0, 3u * sizeof(float32_t)); 61 | } 62 | 63 | /** 64 | * @} end of PID group 65 | */ 66 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @addtogroup PID 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief Reset function for the Q15 PID Control. 50 | * @param[in] *S Instance pointer of PID control data structure. 51 | * @return none. 52 | * \par Description: 53 | * The function resets the state buffer to zeros. 54 | */ 55 | void arm_pid_reset_q15( 56 | arm_pid_instance_q15 * S) 57 | { 58 | /* Reset state to zero, The size will be always 3 samples */ 59 | memset(S->state, 0, 3u * sizeof(q15_t)); 60 | } 61 | 62 | /** 63 | * @} end of PID group 64 | */ 65 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @addtogroup PID 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief Reset function for the Q31 PID Control. 50 | * @param[in] *S Instance pointer of PID control data structure. 51 | * @return none. 52 | * \par Description: 53 | * The function resets the state buffer to zeros. 54 | */ 55 | void arm_pid_reset_q31( 56 | arm_pid_instance_q31 * S) 57 | { 58 | 59 | /* Clear the state buffer. The size will be always 3 samples */ 60 | memset(S->state, 0, 3u * sizeof(q31_t)); 61 | } 62 | 63 | /** 64 | * @} end of PID group 65 | */ 66 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 07. September 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_cos_q15.c 9 | * 10 | * Description: Fast cosine calculation for Q15 values. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | #include "arm_common_tables.h" 43 | 44 | /** 45 | * @ingroup groupFastMath 46 | */ 47 | 48 | /** 49 | * @addtogroup cos 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. 55 | * @param[in] x Scaled input value in radians. 56 | * @return cos(x). 57 | * 58 | * The Q15 input value is in the range [0 +0.9999] and is mapped to a radian 59 | * value in the range [0 2*pi). 60 | */ 61 | 62 | q15_t arm_cos_q15( 63 | q15_t x) 64 | { 65 | q15_t cosVal; /* Temporary variables for input, output */ 66 | int32_t index; /* Index variables */ 67 | q15_t a, b; /* Four nearest output values */ 68 | q15_t fract; /* Temporary values for fractional values */ 69 | 70 | /* add 0.25 (pi/2) to read sine table */ 71 | x = (uint16_t)x + 0x2000; 72 | if(x < 0) 73 | { /* convert negative numbers to corresponding positive ones */ 74 | x = (uint16_t)x + 0x8000; 75 | } 76 | 77 | /* Calculate the nearest index */ 78 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 79 | 80 | /* Calculation of fractional value */ 81 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 82 | 83 | /* Read two nearest values of input value from the sin table */ 84 | a = sinTable_q15[index]; 85 | b = sinTable_q15[index+1]; 86 | 87 | /* Linear interpolation process */ 88 | cosVal = (q31_t)(0x8000-fract)*a >> 16; 89 | cosVal = (q15_t)((((q31_t)cosVal << 16) + ((q31_t)fract*b)) >> 16); 90 | 91 | return cosVal << 1; 92 | } 93 | 94 | /** 95 | * @} end of cos group 96 | */ 97 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 07. September 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_cos_q31.c 9 | * 10 | * Description: Fast cosine calculation for Q31 values. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | #include "arm_common_tables.h" 43 | 44 | /** 45 | * @ingroup groupFastMath 46 | */ 47 | 48 | /** 49 | * @addtogroup cos 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. 55 | * @param[in] x Scaled input value in radians. 56 | * @return cos(x). 57 | * 58 | * The Q31 input value is in the range [0 +0.9999] and is mapped to a radian 59 | * value in the range [0 2*pi). 60 | */ 61 | 62 | q31_t arm_cos_q31( 63 | q31_t x) 64 | { 65 | q31_t cosVal; /* Temporary variables for input, output */ 66 | int32_t index; /* Index variables */ 67 | q31_t a, b; /* Four nearest output values */ 68 | q31_t fract; /* Temporary values for fractional values */ 69 | 70 | /* add 0.25 (pi/2) to read sine table */ 71 | x = (uint32_t)x + 0x20000000; 72 | if(x < 0) 73 | { /* convert negative numbers to corresponding positive ones */ 74 | x = (uint32_t)x + 0x80000000; 75 | } 76 | 77 | /* Calculate the nearest index */ 78 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 79 | 80 | /* Calculation of fractional value */ 81 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 82 | 83 | /* Read two nearest values of input value from the sin table */ 84 | a = sinTable_q31[index]; 85 | b = sinTable_q31[index+1]; 86 | 87 | /* Linear interpolation process */ 88 | cosVal = (q63_t)(0x80000000-fract)*a >> 32; 89 | cosVal = (q31_t)((((q63_t)cosVal << 32) + ((q63_t)fract*b)) >> 32); 90 | 91 | return cosVal << 1; 92 | } 93 | 94 | /** 95 | * @} end of cos group 96 | */ 97 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_sin_q15.c 9 | * 10 | * Description: Fast sine calculation for Q15 values. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | #include "arm_common_tables.h" 43 | 44 | /** 45 | * @ingroup groupFastMath 46 | */ 47 | 48 | /** 49 | * @addtogroup sin 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @brief Fast approximation to the trigonometric sine function for Q15 data. 55 | * @param[in] x Scaled input value in radians. 56 | * @return sin(x). 57 | * 58 | * The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*pi). 59 | */ 60 | 61 | q15_t arm_sin_q15( 62 | q15_t x) 63 | { 64 | q15_t sinVal; /* Temporary variables for input, output */ 65 | int32_t index; /* Index variables */ 66 | q15_t a, b; /* Four nearest output values */ 67 | q15_t fract; /* Temporary values for fractional values */ 68 | 69 | /* Calculate the nearest index */ 70 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 71 | 72 | /* Calculation of fractional value */ 73 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 74 | 75 | /* Read two nearest values of input value from the sin table */ 76 | a = sinTable_q15[index]; 77 | b = sinTable_q15[index+1]; 78 | 79 | /* Linear interpolation process */ 80 | sinVal = (q31_t)(0x8000-fract)*a >> 16; 81 | sinVal = (q15_t)((((q31_t)sinVal << 16) + ((q31_t)fract*b)) >> 16); 82 | 83 | return sinVal << 1; 84 | } 85 | 86 | /** 87 | * @} end of sin group 88 | */ 89 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_sin_q31.c 9 | * 10 | * Description: Fast sine calculation for Q31 values. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | #include "arm_common_tables.h" 43 | 44 | /** 45 | * @ingroup groupFastMath 46 | */ 47 | 48 | /** 49 | * @addtogroup sin 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @brief Fast approximation to the trigonometric sine function for Q31 data. 55 | * @param[in] x Scaled input value in radians. 56 | * @return sin(x). 57 | * 58 | * The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*pi). */ 59 | 60 | q31_t arm_sin_q31( 61 | q31_t x) 62 | { 63 | q31_t sinVal; /* Temporary variables for input, output */ 64 | int32_t index; /* Index variables */ 65 | q31_t a, b; /* Four nearest output values */ 66 | q31_t fract; /* Temporary values for fractional values */ 67 | 68 | /* Calculate the nearest index */ 69 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 70 | 71 | /* Calculation of fractional value */ 72 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 73 | 74 | /* Read two nearest values of input value from the sin table */ 75 | a = sinTable_q31[index]; 76 | b = sinTable_q31[index+1]; 77 | 78 | /* Linear interpolation process */ 79 | sinVal = (q63_t)(0x80000000-fract)*a >> 32; 80 | sinVal = (q31_t)((((q63_t)sinVal << 32) + ((q63_t)fract*b)) >> 32); 81 | 82 | return sinVal << 1; 83 | } 84 | 85 | /** 86 | * @} end of sin group 87 | */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup FIR 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @details 54 | * 55 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. 56 | * @param[in] numTaps Number of filter coefficients in the filter. 57 | * @param[in] *pCoeffs points to the filter coefficients buffer. 58 | * @param[in] *pState points to the state buffer. 59 | * @param[in] blockSize number of samples that are processed per call. 60 | * @return none. 61 | * 62 | * Description: 63 | * \par 64 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 65 | *
    
66 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
67 |  * 
68 | * \par 69 | * pState points to the array of state variables. 70 | * pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_f32(). 71 | */ 72 | 73 | void arm_fir_init_f32( 74 | arm_fir_instance_f32 * S, 75 | uint16_t numTaps, 76 | float32_t * pCoeffs, 77 | float32_t * pState, 78 | uint32_t blockSize) 79 | { 80 | /* Assign filter taps */ 81 | S->numTaps = numTaps; 82 | 83 | /* Assign coefficient pointer */ 84 | S->pCoeffs = pCoeffs; 85 | 86 | /* Clear state buffer and the size of state buffer is (blockSize + numTaps - 1) */ 87 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(float32_t)); 88 | 89 | /* Assign state pointer */ 90 | S->pState = pState; 91 | 92 | } 93 | 94 | /** 95 | * @} end of FIR group 96 | */ 97 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup FIR 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @details 54 | * 55 | * @param[in,out] *S points to an instance of the Q31 FIR filter structure. 56 | * @param[in] numTaps Number of filter coefficients in the filter. 57 | * @param[in] *pCoeffs points to the filter coefficients buffer. 58 | * @param[in] *pState points to the state buffer. 59 | * @param[in] blockSize number of samples that are processed per call. 60 | * @return none. 61 | * 62 | * Description: 63 | * \par 64 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 65 | *
    
66 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
67 |  * 
68 | * \par 69 | * pState points to the array of state variables. 70 | * pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_q31(). 71 | */ 72 | 73 | void arm_fir_init_q31( 74 | arm_fir_instance_q31 * S, 75 | uint16_t numTaps, 76 | q31_t * pCoeffs, 77 | q31_t * pState, 78 | uint32_t blockSize) 79 | { 80 | /* Assign filter taps */ 81 | S->numTaps = numTaps; 82 | 83 | /* Assign coefficient pointer */ 84 | S->pCoeffs = pCoeffs; 85 | 86 | /* Clear state buffer and state array size is (blockSize + numTaps - 1) */ 87 | memset(pState, 0, (blockSize + ((uint32_t) numTaps - 1u)) * sizeof(q31_t)); 88 | 89 | /* Assign state pointer */ 90 | S->pState = pState; 91 | 92 | } 93 | 94 | /** 95 | * @} end of FIR group 96 | */ 97 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup FIR 49 | * @{ 50 | */ 51 | /** 52 | * @param[in,out] *S points to an instance of the Q7 FIR filter structure. 53 | * @param[in] numTaps Number of filter coefficients in the filter. 54 | * @param[in] *pCoeffs points to the filter coefficients buffer. 55 | * @param[in] *pState points to the state buffer. 56 | * @param[in] blockSize number of samples that are processed per call. 57 | * @return none 58 | * 59 | * Description: 60 | * \par 61 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 62 | *
    
63 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
64 |  * 
65 | * \par 66 | * pState points to the array of state variables. 67 | * pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_q7(). 68 | */ 69 | 70 | void arm_fir_init_q7( 71 | arm_fir_instance_q7 * S, 72 | uint16_t numTaps, 73 | q7_t * pCoeffs, 74 | q7_t * pState, 75 | uint32_t blockSize) 76 | { 77 | 78 | /* Assign filter taps */ 79 | S->numTaps = numTaps; 80 | 81 | /* Assign coefficient pointer */ 82 | S->pCoeffs = pCoeffs; 83 | 84 | /* Clear the state buffer. The size is always (blockSize + numTaps - 1) */ 85 | memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(q7_t)); 86 | 87 | /* Assign state pointer */ 88 | S->pState = pState; 89 | 90 | } 91 | 92 | /** 93 | * @} end of FIR group 94 | */ 95 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup FIR_Lattice 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @brief Initialization function for the floating-point FIR lattice filter. 54 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. 55 | * @param[in] numStages number of filter stages. 56 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. 57 | * @param[in] *pState points to the state buffer. The array is of length numStages. 58 | * @return none. 59 | */ 60 | 61 | void arm_fir_lattice_init_f32( 62 | arm_fir_lattice_instance_f32 * S, 63 | uint16_t numStages, 64 | float32_t * pCoeffs, 65 | float32_t * pState) 66 | { 67 | /* Assign filter taps */ 68 | S->numStages = numStages; 69 | 70 | /* Assign coefficient pointer */ 71 | S->pCoeffs = pCoeffs; 72 | 73 | /* Clear state buffer and size is always numStages */ 74 | memset(pState, 0, (numStages) * sizeof(float32_t)); 75 | 76 | /* Assign state pointer */ 77 | S->pState = pState; 78 | 79 | } 80 | 81 | /** 82 | * @} end of FIR_Lattice group 83 | */ 84 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup FIR_Lattice 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @brief Initialization function for the Q15 FIR lattice filter. 54 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. 55 | * @param[in] numStages number of filter stages. 56 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. 57 | * @param[in] *pState points to the state buffer. The array is of length numStages. 58 | * @return none. 59 | */ 60 | 61 | void arm_fir_lattice_init_q15( 62 | arm_fir_lattice_instance_q15 * S, 63 | uint16_t numStages, 64 | q15_t * pCoeffs, 65 | q15_t * pState) 66 | { 67 | /* Assign filter taps */ 68 | S->numStages = numStages; 69 | 70 | /* Assign coefficient pointer */ 71 | S->pCoeffs = pCoeffs; 72 | 73 | /* Clear state buffer and size is always numStages */ 74 | memset(pState, 0, (numStages) * sizeof(q15_t)); 75 | 76 | /* Assign state pointer */ 77 | S->pState = pState; 78 | 79 | } 80 | 81 | /** 82 | * @} end of FIR_Lattice group 83 | */ 84 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup FIR_Lattice 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @brief Initialization function for the Q31 FIR lattice filter. 54 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. 55 | * @param[in] numStages number of filter stages. 56 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. 57 | * @param[in] *pState points to the state buffer. The array is of length numStages. 58 | * @return none. 59 | */ 60 | 61 | void arm_fir_lattice_init_q31( 62 | arm_fir_lattice_instance_q31 * S, 63 | uint16_t numStages, 64 | q31_t * pCoeffs, 65 | q31_t * pState) 66 | { 67 | /* Assign filter taps */ 68 | S->numStages = numStages; 69 | 70 | /* Assign coefficient pointer */ 71 | S->pCoeffs = pCoeffs; 72 | 73 | /* Clear state buffer and size is always numStages */ 74 | memset(pState, 0, (numStages) * sizeof(q31_t)); 75 | 76 | /* Assign state pointer */ 77 | S->pState = pState; 78 | 79 | } 80 | 81 | /** 82 | * @} end of FIR_Lattice group 83 | */ 84 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup IIR_Lattice 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @brief Initialization function for the floating-point IIR lattice filter. 54 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. 55 | * @param[in] numStages number of stages in the filter. 56 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. 57 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. 58 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. 59 | * @param[in] blockSize number of samples to process. 60 | * @return none. 61 | */ 62 | 63 | void arm_iir_lattice_init_f32( 64 | arm_iir_lattice_instance_f32 * S, 65 | uint16_t numStages, 66 | float32_t * pkCoeffs, 67 | float32_t * pvCoeffs, 68 | float32_t * pState, 69 | uint32_t blockSize) 70 | { 71 | /* Assign filter taps */ 72 | S->numStages = numStages; 73 | 74 | /* Assign reflection coefficient pointer */ 75 | S->pkCoeffs = pkCoeffs; 76 | 77 | /* Assign ladder coefficient pointer */ 78 | S->pvCoeffs = pvCoeffs; 79 | 80 | /* Clear state buffer and size is always blockSize + numStages */ 81 | memset(pState, 0, (numStages + blockSize) * sizeof(float32_t)); 82 | 83 | /* Assign state pointer */ 84 | S->pState = pState; 85 | 86 | 87 | } 88 | 89 | /** 90 | * @} end of IIR_Lattice group 91 | */ 92 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup IIR_Lattice 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @brief Initialization function for the Q15 IIR lattice filter. 54 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. 55 | * @param[in] numStages number of stages in the filter. 56 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. 57 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. 58 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. 59 | * @param[in] blockSize number of samples to process per call. 60 | * @return none. 61 | */ 62 | 63 | void arm_iir_lattice_init_q15( 64 | arm_iir_lattice_instance_q15 * S, 65 | uint16_t numStages, 66 | q15_t * pkCoeffs, 67 | q15_t * pvCoeffs, 68 | q15_t * pState, 69 | uint32_t blockSize) 70 | { 71 | /* Assign filter taps */ 72 | S->numStages = numStages; 73 | 74 | /* Assign reflection coefficient pointer */ 75 | S->pkCoeffs = pkCoeffs; 76 | 77 | /* Assign ladder coefficient pointer */ 78 | S->pvCoeffs = pvCoeffs; 79 | 80 | /* Clear state buffer and size is always blockSize + numStages */ 81 | memset(pState, 0, (numStages + blockSize) * sizeof(q15_t)); 82 | 83 | /* Assign state pointer */ 84 | S->pState = pState; 85 | 86 | 87 | } 88 | 89 | /** 90 | * @} end of IIR_Lattice group 91 | */ 92 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupFilters 45 | */ 46 | 47 | /** 48 | * @addtogroup IIR_Lattice 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @brief Initialization function for the Q31 IIR lattice filter. 54 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. 55 | * @param[in] numStages number of stages in the filter. 56 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. 57 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. 58 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. 59 | * @param[in] blockSize number of samples to process. 60 | * @return none. 61 | */ 62 | 63 | void arm_iir_lattice_init_q31( 64 | arm_iir_lattice_instance_q31 * S, 65 | uint16_t numStages, 66 | q31_t * pkCoeffs, 67 | q31_t * pvCoeffs, 68 | q31_t * pState, 69 | uint32_t blockSize) 70 | { 71 | /* Assign filter taps */ 72 | S->numStages = numStages; 73 | 74 | /* Assign reflection coefficient pointer */ 75 | S->pkCoeffs = pkCoeffs; 76 | 77 | /* Assign ladder coefficient pointer */ 78 | S->pvCoeffs = pvCoeffs; 79 | 80 | /* Clear state buffer and size is always blockSize + numStages */ 81 | memset(pState, 0, (numStages + blockSize) * sizeof(q31_t)); 82 | 83 | /* Assign state pointer */ 84 | S->pState = pState; 85 | 86 | 87 | } 88 | 89 | /** 90 | * @} end of IIR_Lattice group 91 | */ 92 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * ---------------------------------------------------------------------------*/ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @addtogroup LMS 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief Initialization function for floating-point LMS filter. 50 | * @param[in] *S points to an instance of the floating-point LMS filter structure. 51 | * @param[in] numTaps number of filter coefficients. 52 | * @param[in] *pCoeffs points to the coefficient buffer. 53 | * @param[in] *pState points to state buffer. 54 | * @param[in] mu step size that controls filter coefficient updates. 55 | * @param[in] blockSize number of samples to process. 56 | * @return none. 57 | */ 58 | 59 | /** 60 | * \par Description: 61 | * pCoeffs points to the array of filter coefficients stored in time reversed order: 62 | *
    
63 |  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}    
64 |  * 
65 | * The initial filter coefficients serve as a starting point for the adaptive filter. 66 | * 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(). 67 | */ 68 | 69 | void arm_lms_init_f32( 70 | arm_lms_instance_f32 * S, 71 | uint16_t numTaps, 72 | float32_t * pCoeffs, 73 | float32_t * pState, 74 | float32_t mu, 75 | uint32_t blockSize) 76 | { 77 | /* Assign filter taps */ 78 | S->numTaps = numTaps; 79 | 80 | /* Assign coefficient pointer */ 81 | S->pCoeffs = pCoeffs; 82 | 83 | /* Clear state buffer and size is always blockSize + numTaps */ 84 | memset(pState, 0, (numTaps + (blockSize - 1)) * sizeof(float32_t)); 85 | 86 | /* Assign state pointer */ 87 | S->pState = pState; 88 | 89 | /* Assign Step size value */ 90 | S->mu = mu; 91 | } 92 | 93 | /** 94 | * @} end of LMS group 95 | */ 96 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupMatrix 45 | */ 46 | 47 | /** 48 | * @defgroup MatrixInit Matrix Initialization 49 | * 50 | * Initializes the underlying matrix data structure. 51 | * The functions set the numRows, 52 | * numCols, and pData fields 53 | * of the matrix data structure. 54 | */ 55 | 56 | /** 57 | * @addtogroup MatrixInit 58 | * @{ 59 | */ 60 | 61 | /** 62 | * @brief Floating-point matrix initialization. 63 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 64 | * @param[in] nRows number of rows in the matrix. 65 | * @param[in] nColumns number of columns in the matrix. 66 | * @param[in] *pData points to the matrix data array. 67 | * @return none 68 | */ 69 | 70 | void arm_mat_init_f32( 71 | arm_matrix_instance_f32 * S, 72 | uint16_t nRows, 73 | uint16_t nColumns, 74 | float32_t * pData) 75 | { 76 | /* Assign Number of Rows */ 77 | S->numRows = nRows; 78 | 79 | /* Assign Number of Columns */ 80 | S->numCols = nColumns; 81 | 82 | /* Assign Data pointer */ 83 | S->pData = pData; 84 | } 85 | 86 | /** 87 | * @} end of MatrixInit group 88 | */ 89 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------------- */ 40 | 41 | 42 | #include "arm_math.h" 43 | 44 | /** 45 | * @ingroup groupMatrix 46 | */ 47 | 48 | /** 49 | * @addtogroup MatrixInit 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @brief Q15 matrix initialization. 55 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 56 | * @param[in] nRows number of rows in the matrix. 57 | * @param[in] nColumns number of columns in the matrix. 58 | * @param[in] *pData points to the matrix data array. 59 | * @return none 60 | */ 61 | 62 | void arm_mat_init_q15( 63 | arm_matrix_instance_q15 * S, 64 | uint16_t nRows, 65 | uint16_t nColumns, 66 | q15_t * pData) 67 | { 68 | /* Assign Number of Rows */ 69 | S->numRows = nRows; 70 | 71 | /* Assign Number of Columns */ 72 | S->numCols = nColumns; 73 | 74 | /* Assign Data pointer */ 75 | S->pData = pData; 76 | } 77 | 78 | /** 79 | * @} end of MatrixInit group 80 | */ 81 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * - Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * - Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in 20 | * the documentation and/or other materials provided with the 21 | * distribution. 22 | * - Neither the name of ARM LIMITED nor the names of its contributors 23 | * may be used to endorse or promote products derived from this 24 | * software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 29 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 30 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 31 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 34 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 36 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 | * POSSIBILITY OF SUCH DAMAGE. 38 | * -------------------------------------------------------------------------- */ 39 | 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupMatrix 45 | */ 46 | 47 | /** 48 | * @defgroup MatrixInit Matrix Initialization 49 | * 50 | */ 51 | 52 | /** 53 | * @addtogroup MatrixInit 54 | * @{ 55 | */ 56 | 57 | /** 58 | * @brief Q31 matrix initialization. 59 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 60 | * @param[in] nRows number of rows in the matrix. 61 | * @param[in] nColumns number of columns in the matrix. 62 | * @param[in] *pData points to the matrix data array. 63 | * @return none 64 | */ 65 | 66 | void arm_mat_init_q31( 67 | arm_matrix_instance_q31 * S, 68 | uint16_t nRows, 69 | uint16_t nColumns, 70 | q31_t * pData) 71 | { 72 | /* Assign Number of Rows */ 73 | S->numRows = nRows; 74 | 75 | /* Assign Number of Columns */ 76 | S->numCols = nColumns; 77 | 78 | /* Assign Data pointer */ 79 | S->pData = pData; 80 | } 81 | 82 | /** 83 | * @} end of MatrixInit group 84 | */ 85 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 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 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #include "arm_math.h" 42 | 43 | /** 44 | * @ingroup groupSupport 45 | */ 46 | 47 | /** 48 | * @addtogroup copy 49 | * @{ 50 | */ 51 | /** 52 | * @brief Copies the elements of a Q15 vector. 53 | * @param[in] *pSrc points to input vector 54 | * @param[out] *pDst points to output vector 55 | * @param[in] blockSize length of the input vector 56 | * @return none. 57 | * 58 | */ 59 | 60 | void arm_copy_q15( 61 | q15_t * pSrc, 62 | q15_t * pDst, 63 | uint32_t blockSize) 64 | { 65 | uint32_t blkCnt; /* loop counter */ 66 | 67 | #ifndef ARM_MATH_CM0_FAMILY 68 | 69 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 70 | 71 | /*loop Unrolling */ 72 | blkCnt = blockSize >> 2u; 73 | 74 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 75 | ** a second loop below computes the remaining 1 to 3 samples. */ 76 | while(blkCnt > 0u) 77 | { 78 | /* C = A */ 79 | /* Read two inputs */ 80 | *__SIMD32(pDst)++ = *__SIMD32(pSrc)++; 81 | *__SIMD32(pDst)++ = *__SIMD32(pSrc)++; 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 | 92 | #else 93 | 94 | /* Run the below code for Cortex-M0 */ 95 | 96 | /* Loop over blockSize number of values */ 97 | blkCnt = blockSize; 98 | 99 | #endif /* #ifndef ARM_MATH_CM0_FAMILY */ 100 | 101 | while(blkCnt > 0u) 102 | { 103 | /* C = A */ 104 | /* Copy and then store the value in the destination buffer */ 105 | *pDst++ = *pSrc++; 106 | 107 | /* Decrement the loop counter */ 108 | blkCnt--; 109 | } 110 | } 111 | 112 | /** 113 | * @} end of BasicCopy group 114 | */ 115 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f373xc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f373xc.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f378xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f378xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f3xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f3xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f301x8_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f302x8_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f302xc_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20009FFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f302xe_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f303x8_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20002FFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10000FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f303xc_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20009FFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10001FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f303xe_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10003FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f318xx_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f328xx_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20002FFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10000FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f334x8_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20002FFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10000FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f358xx_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20009FFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10001FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f373xc_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f378xx_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; 11 | /*-Sizes-*/ 12 | define symbol __ICFEDIT_size_cstack__ = 0x400; 13 | define symbol __ICFEDIT_size_heap__ = 0x200; 14 | /**** End of ICF editor section. ###ICF###*/ 15 | 16 | 17 | define memory mem with size = 4G; 18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 20 | 21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 23 | 24 | initialize by copy { readwrite }; 25 | do not initialize { section .noinit }; 26 | 27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 28 | 29 | place in ROM_region { readonly }; 30 | place in RAM_region { readwrite, 31 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/iar/linker/stm32f398xx_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 11 | define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_CCMRAM_end__ = 0x10003FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x400; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | define region CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_end__]; 23 | 24 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 25 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 26 | 27 | initialize by copy { readwrite }; 28 | do not initialize { section .noinit }; 29 | 30 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 31 | 32 | place in ROM_region { readonly }; 33 | place in RAM_region { readwrite, 34 | block CSTACK, block HEAP }; -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/arm_const_structs.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_const_structs.h 9 | * 10 | * Description: This file has constant structs that are initialized for 11 | * user convenience. For example, some can be given as 12 | * arguments to the arm_cfft_f32() function. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * - Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * - Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * - Neither the name of ARM LIMITED nor the names of its contributors 26 | * may be used to endorse or promote products derived from this 27 | * software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 | * POSSIBILITY OF SUCH DAMAGE. 41 | * -------------------------------------------------------------------- */ 42 | 43 | #ifndef _ARM_CONST_STRUCTS_H 44 | #define _ARM_CONST_STRUCTS_H 45 | 46 | #include "arm_math.h" 47 | #include "arm_common_tables.h" 48 | 49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; 50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; 51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; 52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; 53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; 54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; 55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; 56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; 57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; 58 | 59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; 60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; 61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; 62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; 63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; 64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; 65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; 66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; 67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; 68 | 69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; 70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; 71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; 72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; 73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; 74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; 75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; 76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; 77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmFunc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmFunc.h 3 | * @brief CMSIS Cortex-M Core Function Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMFUNC_H 42 | #define __CORE_CMFUNC_H 43 | 44 | 45 | /* ########################### Core Function Access ########################### */ 46 | /** \ingroup CMSIS_Core_FunctionInterface 47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@} end of CMSIS_Core_RegAccFunctions */ 86 | 87 | #endif /* __CORE_CMFUNC_H */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmInstr.h 3 | * @brief CMSIS Cortex-M Core Instruction Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMINSTR_H 42 | #define __CORE_CMINSTR_H 43 | 44 | 45 | /* ########################## Core Instruction Access ######################### */ 46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface 47 | Access to dedicated instructions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */ 86 | 87 | #endif /* __CORE_CMINSTR_H */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmSimd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmSimd.h 3 | * @brief CMSIS Cortex-M SIMD Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMSIMD_H 42 | #define __CORE_CMSIMD_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | 49 | /* ################### Compiler specific Intrinsics ########################### */ 50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics 51 | Access to dedicated SIMD instructions 52 | @{ 53 | */ 54 | 55 | /*------------------ RealView Compiler -----------------*/ 56 | #if defined ( __CC_ARM ) 57 | #include "cmsis_armcc.h" 58 | 59 | /*------------------ ARM Compiler V6 -------------------*/ 60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 61 | #include "cmsis_armcc_V6.h" 62 | 63 | /*------------------ GNU Compiler ----------------------*/ 64 | #elif defined ( __GNUC__ ) 65 | #include "cmsis_gcc.h" 66 | 67 | /*------------------ ICC Compiler ----------------------*/ 68 | #elif defined ( __ICCARM__ ) 69 | #include 70 | 71 | /*------------------ TI CCS Compiler -------------------*/ 72 | #elif defined ( __TMS470__ ) 73 | #include 74 | 75 | /*------------------ TASKING Compiler ------------------*/ 76 | #elif defined ( __TASKING__ ) 77 | /* 78 | * The CMSIS functions have been implemented as intrinsics in the compiler. 79 | * Please use "carm -?i" to get an up to date list of all intrinsics, 80 | * Including the CMSIS ones. 81 | */ 82 | 83 | /*------------------ COSMIC Compiler -------------------*/ 84 | #elif defined ( __CSMC__ ) 85 | #include 86 | 87 | #endif 88 | 89 | /*@} end of group CMSIS_SIMD_intrinsics */ 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __CORE_CMSIMD_H */ 97 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Lib/ARM/arm_cortexM4b_math.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Lib/ARM/arm_cortexM4b_math.lib -------------------------------------------------------------------------------- /Drivers/CMSIS/Lib/ARM/arm_cortexM4bf_math.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Lib/ARM/arm_cortexM4bf_math.lib -------------------------------------------------------------------------------- /Drivers/CMSIS/Lib/ARM/arm_cortexM4l_math.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Lib/ARM/arm_cortexM4l_math.lib -------------------------------------------------------------------------------- /Drivers/CMSIS/Lib/ARM/arm_cortexM4lf_math.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Lib/ARM/arm_cortexM4lf_math.lib -------------------------------------------------------------------------------- /Drivers/CMSIS/Lib/GCC/libarm_cortexM4l_math.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Lib/GCC/libarm_cortexM4l_math.a -------------------------------------------------------------------------------- /Drivers/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a -------------------------------------------------------------------------------- /Drivers/STM32F3xx_HAL_Driver/Inc/stm32_assert_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_assert.h 4 | * @author MCD Application Team 5 | * @brief STM32 assert template file. 6 | * This file should be copied to the application folder and renamed 7 | * to stm32_assert.h. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2016 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32_ASSERT_H 40 | #define __STM32_ASSERT_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Exported types ------------------------------------------------------------*/ 47 | /* Exported constants --------------------------------------------------------*/ 48 | /* Includes ------------------------------------------------------------------*/ 49 | /* Exported macro ------------------------------------------------------------*/ 50 | #ifdef USE_FULL_ASSERT 51 | /** 52 | * @brief The assert_param macro is used for function's parameters check. 53 | * @param expr If expr is false, it calls assert_failed function 54 | * which reports the name of the source file and the source 55 | * line number of the call that failed. 56 | * If expr is true, it returns no value. 57 | * @retval None 58 | */ 59 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__)) 60 | /* Exported functions ------------------------------------------------------- */ 61 | void assert_failed(char* file, uint32_t line); 62 | #else 63 | #define assert_param(expr) ((void)0U) 64 | #endif /* USE_FULL_ASSERT */ 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* __STM32_ASSERT_H */ 71 | 72 | 73 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 74 | -------------------------------------------------------------------------------- /Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_spi_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f3xx_hal_spi_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of SPI HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© COPYRIGHT(c) 2016 STMicroelectronics

10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | ****************************************************************************** 34 | */ 35 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ 37 | #ifndef __STM32F3xx_HAL_SPI_EX_H 38 | #define __STM32F3xx_HAL_SPI_EX_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /* Includes ------------------------------------------------------------------*/ 45 | #include "stm32f3xx_hal_def.h" 46 | 47 | /** @addtogroup STM32F3xx_HAL_Driver 48 | * @{ 49 | */ 50 | 51 | /** @addtogroup SPIEx 52 | * @{ 53 | */ 54 | 55 | /* Exported types ------------------------------------------------------------*/ 56 | /* Exported constants --------------------------------------------------------*/ 57 | /* Exported macros -----------------------------------------------------------*/ 58 | /* Exported functions --------------------------------------------------------*/ 59 | /** @addtogroup SPIEx_Exported_Functions 60 | * @{ 61 | */ 62 | 63 | /* Initialization and de-initialization functions ****************************/ 64 | /* IO operation functions *****************************************************/ 65 | /** @addtogroup SPIEx_Exported_Functions_Group1 66 | * @{ 67 | */ 68 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi); 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* __STM32F3xx_HAL_SPI_EX_H */ 90 | 91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 92 | -------------------------------------------------------------------------------- /Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_alarm_template.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_alarm_template.c -------------------------------------------------------------------------------- /Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_wakeup_template.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_wakeup_template.c -------------------------------------------------------------------------------- /Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_ll_pwr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f3xx_ll_pwr.c 4 | * @author MCD Application Team 5 | * @brief PWR LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© COPYRIGHT(c) 2016 STMicroelectronics

10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | ****************************************************************************** 34 | */ 35 | #if defined(USE_FULL_LL_DRIVER) 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f3xx_ll_pwr.h" 39 | #include "stm32f3xx_ll_bus.h" 40 | 41 | /** @addtogroup STM32F3xx_LL_Driver 42 | * @{ 43 | */ 44 | 45 | #if defined(PWR) 46 | 47 | /** @defgroup PWR_LL PWR 48 | * @{ 49 | */ 50 | 51 | /* Private types -------------------------------------------------------------*/ 52 | /* Private variables ---------------------------------------------------------*/ 53 | /* Private constants ---------------------------------------------------------*/ 54 | /* Private macros ------------------------------------------------------------*/ 55 | /* Private function prototypes -----------------------------------------------*/ 56 | 57 | /* Exported functions --------------------------------------------------------*/ 58 | /** @addtogroup PWR_LL_Exported_Functions 59 | * @{ 60 | */ 61 | 62 | /** @addtogroup PWR_LL_EF_Init 63 | * @{ 64 | */ 65 | 66 | /** 67 | * @brief De-initialize the PWR registers to their default reset values. 68 | * @retval An ErrorStatus enumeration value: 69 | * - SUCCESS: PWR registers are de-initialized 70 | * - ERROR: not applicable 71 | */ 72 | ErrorStatus LL_PWR_DeInit(void) 73 | { 74 | /* Force reset of PWR clock */ 75 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR); 76 | 77 | /* Release reset of PWR clock */ 78 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR); 79 | 80 | return SUCCESS; 81 | } 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** 92 | * @} 93 | */ 94 | #endif /* defined(PWR) */ 95 | /** 96 | * @} 97 | */ 98 | 99 | #endif /* USE_FULL_LL_DRIVER */ 100 | 101 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 102 | -------------------------------------------------------------------------------- /Inc/SystemNDriveParams.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file SystemNDriveParams.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file contains System & Drive constant initialization. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 10 | * All rights reserved.

11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted, provided that the following conditions are met: 14 | * 15 | * 1. Redistribution of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of other 21 | * contributors to this software may be used to endorse or promote products 22 | * derived from this software without specific written permission. 23 | * 4. This software, including modifications and/or derivative works of this 24 | * software, must execute solely and exclusively on microcontroller or 25 | * microprocessor devices manufactured by or for STMicroelectronics. 26 | * 5. Redistribution and use of this software other than as permitted under 27 | * this license is void and will automatically terminate your rights under 28 | * this license. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 31 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 33 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 34 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 35 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 36 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 37 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 38 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 41 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | * 43 | ****************************************************************************** 44 | */ 45 | 46 | /* Define to prevent recursive inclusion -------------------------------------*/ 47 | #ifndef __SYSTEMNDRIVE_PARAMS_H 48 | #define __SYSTEMNDRIVE_PARAMS_H 49 | #include "std_hal_missing_define.h" 50 | #include "parameters_conversion.h" 51 | 52 | #define MAX_TWAIT 0 /* Dummy value for single drive */ 53 | #define FREQ_RATIO 1 /* Dummy value for single drive */ 54 | #define FREQ_RELATION HIGHEST_FREQ /* Dummy value for single drive */ 55 | 56 | #define NBR_OF_MOTORS 1 57 | 58 | #endif /* __SYSTEMNDRIVE_PARAMS_H */ 59 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 60 | -------------------------------------------------------------------------------- /Inc/UITask.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file UITask.h 4 | * @author STMicroelectronics - System Lab - MC Team 5 | * @version 4.3.0 6 | * @date 22-Sep-2016 15:29 7 | * @brief Interface of UITask module 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __UITASK_H 30 | #define __UITASK_H 31 | 32 | #include "user_interface.h" 33 | #include "dac_rctimer_ui.h" 34 | #include "dac_ui.h" 35 | #include "lcd_manager_ui.h" 36 | #include "lcd_vintage_ui.h" 37 | #include "motor_control_protocol.h" 38 | #include "frame_communication_protocol.h" 39 | #include "usart_frame_communication_protocol.h" 40 | #if 0 /* Cubify it first */ 41 | #include "unidirectional_fast_com.h" 42 | #endif /* 0 */ 43 | #include "ui_irq_handler.h" 44 | 45 | /* Exported functions --------------------------------------------------------*/ 46 | void UI_TaskInit(uint8_t cfg, uint32_t* pUICfg, uint8_t bMCNum, MCI_Handle_t * pMCIList[], 47 | MCT_Handle_t* pMCTList[],const char* s_fwVer); 48 | void UI_Scheduler(void); 49 | void UI_LCDRefresh(void); 50 | void UI_DACUpdate(uint8_t bMotorNbr); 51 | UI_Handle_t * GetLCD(void); 52 | UI_Handle_t * GetDAC(void); 53 | MCP_Handle_t * GetMCP(void); 54 | 55 | bool UI_IdleTimeHasElapsed(void); 56 | void UI_SetIdleTime(uint16_t SysTickCount); 57 | bool UI_SerialCommunicationATRTimeHasElapsed(void); 58 | 59 | bool UI_SerialCommunicationTimeOutHasElapsed(void); 60 | void UI_SerialCommunicationTimeOutStop(void); 61 | void UI_SerialCommunicationTimeOutStart(void); 62 | 63 | bool UI_Serial1CommunicationTimeOutHasElapsed(void); 64 | void UI_Serial1CommunicationTimeOutStop(void); 65 | void UI_Serial1CommunicationTimeOutStart(void); 66 | 67 | /* Exported defines ----------------------------------------------------------*/ 68 | #define LCD_LIGHT 0x01 69 | #define LCD_FULL 0x02 70 | 71 | #define COM_BIDIRECTIONAL 0x01 72 | #define COM_UNIDIRECTIONAL 0x02 73 | 74 | #endif /* __UITASK_H */ 75 | 76 | /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /Inc/drive_parameters.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Inc/drive_parameters.h -------------------------------------------------------------------------------- /Inc/mc_parameters.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | ****************************************************************************** 4 | * @file mc_parameters.h 5 | * @author Motor Control SDK Team, ST Microelectronics 6 | * @brief This file provides declarations of HW parameters specific to the 7 | * configuration of the subsystem. 8 | * 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 13 | * All rights reserved.

14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted, provided that the following conditions are met: 17 | * 18 | * 1. Redistribution of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. Neither the name of STMicroelectronics nor the names of other 24 | * contributors to this software may be used to endorse or promote products 25 | * derived from this software without specific written permission. 26 | * 4. This software, including modifications and/or derivative works of this 27 | * software, must execute solely and exclusively on microcontroller or 28 | * microprocessor devices manufactured by or for STMicroelectronics. 29 | * 5. Redistribution and use of this software other than as permitted under 30 | * this license is void and will automatically terminate your rights under 31 | * this license. 32 | * 33 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 34 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 36 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 37 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 38 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 39 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 41 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 42 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 43 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 44 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 | * 46 | ****************************************************************************** 47 | */ 48 | #ifndef MC_PARAMETERS_H 49 | #define MC_PARAMETERS_H 50 | 51 | #endif /* MC_PARAMETERS_H */ 52 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 53 | -------------------------------------------------------------------------------- /Inc/mc_stm_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file mc_stm_types.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief Includes HAL/LL headers relevant to the current configuration. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 10 | * All rights reserved.

11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted, provided that the following conditions are met: 14 | * 15 | * 1. Redistribution of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of other 21 | * contributors to this software may be used to endorse or promote products 22 | * derived from this software without specific written permission. 23 | * 4. This software, including modifications and/or derivative works of this 24 | * software, must execute solely and exclusively on microcontroller or 25 | * microprocessor devices manufactured by or for STMicroelectronics. 26 | * 5. Redistribution and use of this software other than as permitted under 27 | * this license is void and will automatically terminate your rights under 28 | * this license. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 31 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 33 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 34 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 35 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 36 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 37 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 38 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 41 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | * 43 | ****************************************************************************** 44 | */ 45 | #ifndef __MC_STM_TYPES_H 46 | #define __MC_STM_TYPES_H 47 | 48 | 49 | #ifndef USE_FULL_LL_DRIVER 50 | #define USE_FULL_LL_DRIVER 51 | #endif 52 | 53 | #ifdef MISRA_C_2004_BUILD 54 | #error "The code is not ready for that..." 55 | #endif 56 | 57 | #ifdef MISRA_C_2004_BUILD 58 | #include "stm32f30x_MisraCompliance.h" 59 | #define FULL_MISRA_C_COMPLIANCY 60 | #else 61 | #include "stm32f3xx_hal.h" 62 | #include "stm32f3xx_ll_bus.h" 63 | #include "stm32f3xx_ll_rcc.h" 64 | #include "stm32f3xx_ll_system.h" 65 | #include "stm32f3xx_ll_adc.h" 66 | #include "stm32f3xx_ll_tim.h" 67 | #include "stm32f3xx_ll_gpio.h" 68 | #include "stm32f3xx_ll_usart.h" 69 | #include "stm32f3xx_ll_dac.h" 70 | #include "stm32f3xx_ll_dma.h" 71 | #include "stm32f3xx_ll_comp.h" 72 | #include "stm32f3xx_ll_opamp.h" 73 | #endif 74 | 75 | #endif /* __MC_STM_TYPES_H */ 76 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /Inc/motorcontrol.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | ****************************************************************************** 4 | * @file motorcontrol.h 5 | * @author Motor Control SDK Team, ST Microelectronics 6 | * @brief Motor Control Subsystem initialization functions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ 48 | #ifndef __MOTORCONTROL_H 49 | #define __MOTORCONTROL_H 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif /* __cplusplus */ 54 | 55 | /** @addtogroup MCSDK 56 | * @{ 57 | */ 58 | 59 | /** @addtogroup MCAPI 60 | * @{ 61 | */ 62 | 63 | /* Initializes the Motor Control Subsystem */ 64 | void MX_MotorControl_Init(void); 65 | 66 | void MC_HandleStartStopButton(void); 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif /* __cpluplus */ 79 | 80 | #endif /* __MOTORCONTROL_H */ 81 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 82 | -------------------------------------------------------------------------------- /Inc/parameters_conversion.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file parameters_conversion.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file includes the proper Parameter conversion on the base 6 | * of stdlib for the first drive 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© COPYRIGHT 2018 STMicroelectronics

11 | * 12 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 13 | * You may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at: 15 | * 16 | * http://www.st.com/software_license_agreement_liberty_v2 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | ****************************************************************************** 25 | */ 26 | 27 | /* Define to prevent recursive inclusion -------------------------------------*/ 28 | #ifndef __PARAMETERS_CONVERSION_H 29 | #define __PARAMETERS_CONVERSION_H 30 | 31 | #include "parameters_conversion_f30x.h" 32 | 33 | /* Common parameters conversions */ 34 | #define OTF_STARTUP_EN false 35 | 36 | #define DIN_ACTIVE_LOW Bit_RESET 37 | #define DIN_ACTIVE_HIGH Bit_SET 38 | 39 | #endif /*__PARAMETERS_CONVERSION_H*/ 40 | 41 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 42 | -------------------------------------------------------------------------------- /Inc/pmsm_motor_parameters.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Inc/pmsm_motor_parameters.h -------------------------------------------------------------------------------- /Inc/stm32_hal.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_hal.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file includes all STM32 HAL and LL headers needed for the 6 | * Motor Control Library. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | /* Define to prevent recursive inclusion -------------------------------------*/ 47 | #ifndef __STM32_HAL_H 48 | #define __STM32_HAL_H 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif /* __cplusplus */ 53 | 54 | #error "This file is most probably not needed anymore." 55 | 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif /* __cpluplus */ 66 | 67 | #endif /* __STM32_HAL_H */ 68 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 69 | 70 | -------------------------------------------------------------------------------- /Inc/stm32f3xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f3xx_it.h 4 | * @brief This file contains the headers of the interrupt handlers. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2019 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Define to prevent recursive inclusion -------------------------------------*/ 35 | #ifndef __STM32F3xx_IT_H 36 | #define __STM32F3xx_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | #include "stm32f3xx_hal.h" 44 | #include "main.h" 45 | /* Exported types ------------------------------------------------------------*/ 46 | /* Exported constants --------------------------------------------------------*/ 47 | /* Exported macro ------------------------------------------------------------*/ 48 | /* Exported functions ------------------------------------------------------- */ 49 | 50 | void CAN_RX1_IRQHandler(void); 51 | void CAN_SCE_IRQHandler(void); 52 | void USART1_IRQHandler(void); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* __STM32F3xx_IT_H */ 59 | 60 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 61 | -------------------------------------------------------------------------------- /MotorControl/Applications/Test_MotorApp/Inc/TimeBase.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Timebase.h 4 | * @author STMicroelectronics - System Lab - MC Team 5 | * @version 4.3.0 6 | * @date 22-Sep-2016 15:29 7 | * @brief This file defines booting function of MC library, single motor 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __TIMEBASE_H 30 | #define __TIMEBASE_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "mc_type.h" 34 | 35 | /** @addtogroup Timebase 36 | * @{ 37 | */ 38 | 39 | /** @defgroup Timebase_exported_functions Timebase exported functions 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @brief Use this function to know whether the user time base is elapsed 45 | * has elapsed 46 | * @param none 47 | * @retval bool true if time is elapsed, false otherwise 48 | */ 49 | bool TB_UserTimebaseHasElapsed(void); 50 | 51 | /** 52 | * @brief It set a counter intended to be used for counting the user time base 53 | * time 54 | * @param SysTickCount number of System ticks to be counted 55 | * @retval void 56 | */ 57 | void TB_SetUserTimebaseTime(uint16_t SysTickCount); 58 | 59 | /** 60 | * @brief It is the task scheduler. 61 | * @param none 62 | * @retval none 63 | */ 64 | void TB_Scheduler(void); 65 | 66 | void TB_Set_DebounceDelay_500us(uint8_t hDelay); 67 | bool TB_DebounceDelay_IsElapsed(void); 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | #endif /* __MCBOOTSINGLEMOTOR_H */ 82 | 83 | /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/MCLib/Any/Inc/MCIRQHandlerClass.h: -------------------------------------------------------------------------------- 1 | #include "mc_irq_handler.h" 2 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/MCLib/Any/Inc/ntc_temperature_sensor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/MotorControl/MCSDK/MCLib/Any/Inc/ntc_temperature_sensor.h -------------------------------------------------------------------------------- /MotorControl/MCSDK/SystemDriveParams/Definitions.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Control stage parameters.h 4 | * @author STMicroelectronics - System Lab - MC Team 5 | * @version 4.3.0 6 | * @date 22-Sep-2016 15:29 7 | * @brief This file contains motor parameters needed by STM32 PMSM MC FW 8 | * library v3.0 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2016 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 __DEFINITIONS_H 31 | #define __DEFINITIONS_H 32 | 33 | #define DEGREES_120 0u 34 | #define DEGREES_60 1u 35 | 36 | #define TURN_ON 1 37 | #define TURN_OFF 0 38 | #define INRUSH_ACTIVE 1 39 | #define INRUSH_INACTIVE 0 40 | 41 | #define TURN_OFF_PWM 0 42 | #define TURN_ON_R_BRAKE 1 43 | #define TURN_ON_LOW_SIDES 2 44 | 45 | //#define STM32VALUE 1 46 | //#define STM32PERFORMANCEMD 2 47 | //#define STM32PERFORMANCEHD 3 48 | //#define STM32PERFORMANCELD 4 49 | #define VFQFPN36 1 50 | #define VFQFPN48 2 51 | #define LQFP48 3 52 | #define LQFP64 4 53 | #define LQFP100 5 54 | #define LQFP144 6 55 | #define WLCSP64 7 56 | #define LFBGA100 8 57 | #define LFBGA144 9 58 | #define BGA100 10 59 | #define BGA64 11 60 | #define TFBGA64 12 61 | 62 | #define HALL_TIM2 2 63 | #define HALL_TIM3 3 64 | #define HALL_TIM4 4 65 | #define HALL_TIM5 5 66 | 67 | #define ENC_TIM2 2 68 | #define ENC_TIM3 3 69 | #define ENC_TIM4 4 70 | #define ENC_TIM5 5 71 | 72 | 73 | #endif /*__DEFINITIONS_H*/ 74 | /**************** (c) 2007 STMicroelectronics ********************************/ 75 | /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/ 76 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/SystemDriveParams/usart_params.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file USARTParams.h 4 | * @author STMicroelectronics - System Lab - MC Team 5 | * @version 4.3.0 6 | * @date 22-Sep-2016 15:29 7 | * @brief This file contains USART constant parameters definition 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USART_PARAMS_H 30 | #define __USART_PARAMS_H 31 | #include "parameters_conversion.h" 32 | 33 | /* For backward compatibility */ 34 | #if (!defined(USART_SPEED)) 35 | #define USART_SPEED 115200 36 | #endif 37 | 38 | #define MC_PROTOCOL_REG_UNDEFINED 1 39 | #if (SERIAL_COM_CHANNEL2 == MC_PROTOCOL_REG_UNDEFINED) 40 | #define SERIAL_COM_CH_NBRS 1 41 | #else 42 | #define SERIAL_COM_CH_NBRS 2 43 | #endif 44 | #undef MC_PROTOCOL_REG_UNDEFINED 45 | 46 | #endif /* __USART_PARAMS_H */ 47 | 48 | /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/ 49 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/LCD_Interface.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file LCD_Interface.c 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief Header of "LCD Interface" module. 6 | * 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ 48 | #ifndef __LCD_INTERFACE_H 49 | #define __LCD_INTERFACE_H 50 | 51 | /* Exported Defines ----------------------------------------------------------*/ 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /* TODO: Is this still needed? */ 58 | #define this _this 59 | #include "user_interface.h" 60 | #undef this 61 | 62 | void LCDI_Init(UI_Handle_t *pHandle, UI_Handle_t * pDAC, const char* s_fwVer); 63 | void LCDI_UpdateAll(UI_Handle_t *pHandle); 64 | void LCDI_UpdateMeasured(UI_Handle_t *pHandle); 65 | void LCDI_Polling(void); 66 | void LCDI_SetUIImportedFunctions(void* const* ImportedFunctions); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __LCD_INTERFACE_H */ 73 | 74 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 75 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/UIIRQHandlerClass.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file UIIRQHandlerClass.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief Proxy include file. To be removed before 5.0.0. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© COPYRIGHT 2017 STMicroelectronics

10 | * 11 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 12 | * You may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at: 14 | * 15 | * http://www.st.com/software_license_agreement_liberty_v2 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | ****************************************************************************** 24 | */ 25 | 26 | #include "ui_irq_handler.h" 27 | 28 | /******************* (C) COPYRIGHT 2017 STMicroelectronics *****END OF FILE****/ 29 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/UIIRQHandlerPrivate.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file UIIRQHandlerPrivate.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief Proxy include file. To be removed before 5.0.0. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© COPYRIGHT 2017 STMicroelectronics

10 | * 11 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 12 | * You may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at: 14 | * 15 | * http://www.st.com/software_license_agreement_liberty_v2 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | ****************************************************************************** 24 | */ 25 | 26 | #include "ui_irq_handler.h" 27 | 28 | /******************* (C) COPYRIGHT 2017 STMicroelectronics *****END OF FILE****/ 29 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/dac_rctimer_ui.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file dac_rctimer_ui.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file contains all definitions and functions prototypes for the 6 | * dac_rctimer_ui component of the Motor Control SDK. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ 48 | #ifndef __DACRCTIMERUI_H 49 | #define __DACRCTIMERUI_H 50 | 51 | #include "user_interface.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif /* __cplusplus */ 56 | 57 | /** @addtogroup MCSDK 58 | * @{ 59 | */ 60 | 61 | /** 62 | * @addtogroup UILib 63 | * @{ 64 | */ 65 | 66 | /** 67 | * @addtogroup MCUI 68 | * @{ 69 | */ 70 | 71 | /** @addtogroup dac_rctimer_ui 72 | * @{ 73 | */ 74 | 75 | #define DAC_CH_NBR 2 76 | #define DAC_CH_USER 2 77 | 78 | 79 | 80 | void DACT_Init(UI_Handle_t *pHandle); 81 | 82 | void DACT_Exec(UI_Handle_t *pHandle); 83 | 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif /* __cpluplus */ 104 | 105 | #endif /* __DACRCTIMERUI_H */ 106 | 107 | /************************ (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 108 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/dac_ui.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file dac_ui.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file contains all definitions and functions prototypes for the 6 | * dac_ui component of the Motor Control SDK. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ 48 | #ifndef __DACUI_H 49 | #define __DACUI_H 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif /* __cplusplus */ 54 | 55 | /* Includes ------------------------------------------------------------------*/ 56 | #include "user_interface.h" 57 | #include "dac_common_ui.h" 58 | 59 | 60 | /** @addtogroup MCSDK 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @addtogroup UILib 66 | * @{ 67 | */ 68 | 69 | /** @addtogroup MCUI 70 | * @{ 71 | */ 72 | 73 | /** @addtogroup DAC_UserInterface 74 | * @{ 75 | */ 76 | 77 | #define DAC_CH_NBR 2 78 | #define DAC_CH_USER 2 79 | 80 | 81 | void DAC_Init(UI_Handle_t *pHandle); 82 | 83 | void DAC_Exec(UI_Handle_t *pHandle); 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** 98 | * @} 99 | */ 100 | #ifdef __cplusplus 101 | } 102 | #endif /* __cpluplus */ 103 | 104 | #endif /*__DACUI_H*/ 105 | 106 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 107 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/lcd_exported_functions.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file lcd_exported_functions.c 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file contains the definitions of LCDI exported functions. 6 | * 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ 48 | #ifndef __LCDIEXPORTEDFUNCTIONS_H 49 | #define __LCDIEXPORTEDFUNCTIONS_H 50 | 51 | enum { 52 | EF_LCDI_Init, 53 | EF_LCDI_UpdateMeasured, 54 | EF_LCDI_UpdateAll, 55 | EF_LCDI_Polling, 56 | EF_LCDI_NUMBERS 57 | }; 58 | 59 | typedef void (*pLCDI_Init_t) (UI_Handle_t *pHandle,UI_Handle_t *pDAC,const char*); 60 | typedef void (*pLCDI_Polling_t) (void); 61 | typedef void (*pLCDI_UpdateMeasured_t) (UI_Handle_t *pHandle); 62 | typedef void (*pLCDI_UpdateAll_t) (UI_Handle_t *pHandle); 63 | 64 | #endif /*__LCDIEXPORTEDFUNCTIONS_H*/ 65 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 66 | -------------------------------------------------------------------------------- /MotorControl/MCSDK/UILibrary/Inc/ui_exported_functions.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file ui_exported_functions.c 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief This file contains the definitions of UI exported functions. 6 | * 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ 48 | #ifndef __UIEXPORTEDFUNCTIONS_H 49 | #define __UIEXPORTEDFUNCTIONS_H 50 | 51 | enum { 52 | EF_UI_GetReg, 53 | EF_UI_ExecSpeedRamp, 54 | EF_UI_SetReg, 55 | EF_UI_ExecCmd, 56 | EF_UI_GetSelectedMCConfig, 57 | EF_UI_SetRevupData, 58 | EF_UI_GetRevupData, 59 | EF_UI_DACChannelConfig, 60 | EF_UI_SetCurrentReferences, 61 | EF_UI_NUMBERS 62 | }; 63 | 64 | typedef int32_t (*pUI_GetReg_t) (UI_Handle_t *pHandle,MC_Protocol_REG_t); 65 | typedef bool (*pUI_ExecSpeedRamp_t)(UI_Handle_t *pHandle,int32_t,uint16_t); 66 | typedef bool (*pUI_SetReg_t)(UI_Handle_t *pHandle,MC_Protocol_REG_t,int32_t); 67 | typedef bool (*pUI_ExecCmd_t)(UI_Handle_t *pHandle,uint8_t); 68 | typedef uint32_t (*pUI_GetSelectedMCConfig_t)(UI_Handle_t *pHandle); 69 | typedef bool (*pUI_SetRevupData_t)(UI_Handle_t *pHandle,uint8_t,uint16_t,int16_t,int16_t); 70 | typedef bool (*pUI_GetRevupData_t)(UI_Handle_t *pHandle,uint8_t,uint16_t*,int16_t*,int16_t*); 71 | typedef void (*pUI_DACChannelConfig_t)(UI_Handle_t *pHandle,DAC_Channel_t,MC_Protocol_REG_t); 72 | typedef void (*pUI_SetCurrentReferences_t)(UI_Handle_t *pHandle,int16_t,int16_t); 73 | 74 | #endif /*__UIEXPORTEDFUNCTIONS_H*/ 75 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 76 | -------------------------------------------------------------------------------- /MotorControl/user/crc16.c: -------------------------------------------------------------------------------- 1 | // crc32.c 2 | // WeChat Embedded 3 | // 4 | // Created by harlliu on 14-03-03. 5 | // Copyright 2014 Tencent. All rights reserved. 6 | // 7 | 8 | #include 9 | #include "crc16.h" 10 | 11 | #define CRC16InitVal 0xFFFF 12 | 13 | //=================== Table of ModbusCrc values for low–order byte =================== 14 | static uint8_t uchCRCLTable[] = { 15 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//00~0f 16 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//10~1f 17 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//20~2f 18 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//30~3f 19 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//40~4f 20 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//50~5f 21 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//60~6f 22 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//70~7f 23 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//80~8f 24 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//90~9f 25 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//a0~af 26 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//b0~bf 27 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,//c0~cf 28 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//d0~df 29 | 0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40,0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,//e0~ef 30 | 0x00,0xC1,0x81,0x40,0x01,0xC0,0x80,0x41,0x01,0xC0,0x80,0x41,0x00,0xC1,0x81,0x40 //f0~ff 31 | }; 32 | //=================== Table of ModbusCrc values for high–order byte ================== 33 | static uint8_t uchCRCHTable[] = { 34 | 0x00,0xC0,0xC1,0x01,0xC3,0x03,0x02,0xC2,0xC6,0x06,0x07,0xC7,0x05,0xC5,0xC4,0x04,//00~0f 35 | 0xCC,0x0C,0x0D,0xCD,0x0F,0xCF,0xCE,0x0E,0x0A,0xCA,0xCB,0x0B,0xC9,0x09,0x08,0xC8,//10~1f 36 | 0xD8,0x18,0x19,0xD9,0x1B,0xDB,0xDA,0x1A,0x1E,0xDE,0xDF,0x1F,0xDD,0x1D,0x1C,0xDC,//20~2f 37 | 0x14,0xD4,0xD5,0x15,0xD7,0x17,0x16,0xD6,0xD2,0x12,0x13,0xD3,0x11,0xD1,0xD0,0x10,//30~3f 38 | 0xF0,0x30,0x31,0xF1,0x33,0xF3,0xF2,0x32,0x36,0xF6,0xF7,0x37,0xF5,0x35,0x34,0xF4,//40~4f 39 | 0x3C,0xFC,0xFD,0x3D,0xFF,0x3F,0x3E,0xFE,0xFA,0x3A,0x3B,0xFB,0x39,0xF9,0xF8,0x38,//50~5f 40 | 0x28,0xE8,0xE9,0x29,0xEB,0x2B,0x2A,0xEA,0xEE,0x2E,0x2F,0xEF,0x2D,0xED,0xEC,0x2C,//60~6f 41 | 0xE4,0x24,0x25,0xE5,0x27,0xE7,0xE6,0x26,0x22,0xE2,0xE3,0x23,0xE1,0x21,0x20,0xE0,//70~7f 42 | 0xA0,0x60,0x61,0xA1,0x63,0xA3,0xA2,0x62,0x66,0xA6,0xA7,0x67,0xA5,0x65,0x64,0xA4,//80~8f 43 | 0x6C,0xAC,0xAD,0x6D,0xAF,0x6F,0x6E,0xAE,0xAA,0x6A,0x6B,0xAB,0x69,0xA9,0xA8,0x68,//90~9f 44 | 0x78,0xB8,0xB9,0x79,0xBB,0x7B,0x7A,0xBA,0xBE,0x7E,0x7F,0xBF,0x7D,0xBD,0xBC,0x7C,//a0~af 45 | 0xB4,0x74,0x75,0xB5,0x77,0xB7,0xB6,0x76,0x72,0xB2,0xB3,0x73,0xB1,0x71,0x70,0xB0,//b0~bf 46 | 0x50,0x90,0x91,0x51,0x93,0x53,0x52,0x92,0x96,0x56,0x57,0x97,0x55,0x95,0x94,0x54,//c0~cf 47 | 0x9C,0x5C,0x5D,0x9D,0x5F,0x9F,0x9E,0x5E,0x5A,0x9A,0x9B,0x5B,0x99,0x59,0x58,0x98,//d0~df 48 | 0x88,0x48,0x49,0x89,0x4B,0x8B,0x8A,0x4A,0x4E,0x8E,0x8F,0x4F,0x8D,0x4D,0x4C,0x8C,//e0~ef 49 | 0x44,0x84,0x85,0x45,0x87,0x47,0x46,0x86,0x82,0x42,0x43,0x83,0x41,0x81,0x80,0x40 //f0~ff 50 | } ; 51 | 52 | 53 | 54 | uint16_t crc16(uint8_t *puchHeadAddr,uint8_t uchLen) 55 | { 56 | if (uchLen == 0) 57 | return 0xFFFF; 58 | uint8_t uchCRCL = (uint8_t)CRC16InitVal; //初始化低字节 59 | uint8_t uchCRCH = (CRC16InitVal&0xff00)>>8; //初始化高字节 60 | uint16_t u16Index; //CRC表索引 61 | 62 | while(uchLen--) /*通过数据缓冲器*/ 63 | { 64 | u16Index = uchCRCL ^ *puchHeadAddr++; //计算CRC 65 | uchCRCL = uchCRCH ^ uchCRCLTable[u16Index]; 66 | uchCRCH = uchCRCHTable[u16Index]; 67 | } 68 | return ((uint16_t)uchCRCH << 8 | uchCRCL) ; 69 | } 70 | -------------------------------------------------------------------------------- /MotorControl/user/crc16.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __CRC16_H__ 3 | #define __CRC16_H__ 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | 11 | //******************************************* public attribute ****************************************** 12 | uint16_t crc16(uint8_t *puchHeadAddr,uint8_t uchLen); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /MotorControl/user/user_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file mc_config.h 4 | * @author Motor Control SDK Team, ST Microelectronics 5 | * @brief Motor Control Subsystem components configuration and handler 6 | * structures declarations. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 11 | * All rights reserved.

12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted, provided that the following conditions are met: 15 | * 16 | * 1. Redistribution of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of other 22 | * contributors to this software may be used to endorse or promote products 23 | * derived from this software without specific written permission. 24 | * 4. This software, including modifications and/or derivative works of this 25 | * software, must execute solely and exclusively on microcontroller or 26 | * microprocessor devices manufactured by or for STMicroelectronics. 27 | * 5. Redistribution and use of this software other than as permitted under 28 | * this license is void and will automatically terminate your rights under 29 | * this license. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | ****************************************************************************** 45 | */ 46 | #include "pid_regulator.h" 47 | #include "revup_ctrl.h" 48 | #include "speed_torq_ctrl.h" 49 | #include "virtual_speed_sensor.h" 50 | #include "ntc_temperature_sensor.h" 51 | #include "pwm_curr_fdbk.h" 52 | #include "r_divider_bus_voltage_sensor.h" 53 | #include "virtual_bus_voltage_sensor.h" 54 | #include "pqd_motor_power_measurement.h" 55 | #include "user_interface.h" 56 | #include "lcd_manager_ui.h" 57 | #include "lcd_vintage_ui.h" 58 | #include "dac_rctimer_ui.h" 59 | #include "motor_control_protocol.h" 60 | #include "r3_1_f30x_pwm_curr_fdbk.h" 61 | #include "hall_speed_pos_fdbk.h" 62 | #include "ramp_ext_mngr.h" 63 | #include "circle_limitation.h" 64 | #include "usart_frame_communication_protocol.h" 65 | 66 | #include "uart1_frame_communication_protocol.h" 67 | 68 | 69 | extern U1FCP_Handle_t pUSART1; 70 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 71 | -------------------------------------------------------------------------------- /Src/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtltljb/FOC-MOTOR-CONTROLLER/6e036591735ea11b8e935437da8174846ff772e9/Src/main.c -------------------------------------------------------------------------------- /Src/mc_parameters.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | ****************************************************************************** 4 | * @file mc_parameters.c 5 | * @author Motor Control SDK Team, ST Microelectronics 6 | * @brief This file provides definitions of HW parameters specific to the 7 | * configuration of the subsystem. 8 | * 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© Copyright (c) 2018 STMicroelectronics International N.V. 13 | * All rights reserved.

14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted, provided that the following conditions are met: 17 | * 18 | * 1. Redistribution of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. Neither the name of STMicroelectronics nor the names of other 24 | * contributors to this software may be used to endorse or promote products 25 | * derived from this software without specific written permission. 26 | * 4. This software, including modifications and/or derivative works of this 27 | * software, must execute solely and exclusively on microcontroller or 28 | * microprocessor devices manufactured by or for STMicroelectronics. 29 | * 5. Redistribution and use of this software other than as permitted under 30 | * this license is void and will automatically terminate your rights under 31 | * this license. 32 | * 33 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" 34 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT 35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 36 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY 37 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT 38 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 39 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 41 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 42 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 43 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 44 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 | * 46 | ****************************************************************************** 47 | */ 48 | 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "main.h" 51 | #include "parameters_conversion.h" 52 | 53 | #define MAX_TWAIT 0 /* Dummy value for single drive */ 54 | #define FREQ_RATIO 1 /* Dummy value for single drive */ 55 | #define FREQ_RELATION HIGHEST_FREQ /* Dummy value for single drive */ 56 | 57 | /******************* (C) COPYRIGHT 2018 STMicroelectronics *****END OF FILE****/ 58 | -------------------------------------------------------------------------------- /motor-foc-Readme.txt: -------------------------------------------------------------------------------- 1 | # 概述 2 | 基于STM32有感直流无刷电机驱动控制程序,集成CANopen通讯电机控制子集协议 和 MONDBUS 协议。 3 | 4 | 5 | #硬件资源配置表如下: 6 | 7 | Configuration STM32F302R8-FOC 8 | STM32CubeMX 4.27.0 9 | Date 05/25/2019 10 | MCU STM32F302R8Tx 11 | 12 | PERIPHERALS MODES FUNCTIONS PINS 13 | ADC1 IN4 Single-ended ADC1_IN4 PA3 14 | ADC1 IN6 Single-ended ADC1_IN6 PC0 15 | ADC1 IN7 Single-ended ADC1_IN7 PC1 16 | ADC1 IN8 Single-ended ADC1_IN8 PC2 17 | ADC1 IN9 Single-ended ADC1_IN9 PC3 18 | ADC1 IN10 Single-ended ADC1_IN10 PA6 19 | ADC1 IN11 Single-ended ADC1_IN11 PB0 20 | ADC1 IN12 Single-ended ADC1_IN12 PB1 21 | ADC1 Single-ended ADC1_TempSens_Input VP_ADC1_TempSens_Input 22 | CAN Master CAN_RX PB8 23 | CAN Master CAN_TX PB9 24 | DAC OUT1 Configuration DAC_OUT1 PA4 25 | RCC Crystal/Ceramic Resonator RCC_OSC_IN PF0-OSC_IN 26 | RCC Crystal/Ceramic Resonator RCC_OSC_OUT PF1-OSC_OUT 27 | SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick 28 | TIM1 Trigger Mode TIM1_VS_ControllerModeTrigger VP_TIM1_VS_ControllerModeTrigger 29 | TIM1 ITR1 TIM1_VS_ClockSourceITR VP_TIM1_VS_ClockSourceITR 30 | TIM1 PWM Generation CH1 CH1N TIM1_CH1 PA8 31 | TIM1 PWM Generation CH1 CH1N TIM1_CH1N PB13 32 | TIM1 PWM Generation CH2 CH2N TIM1_CH2 PA9 33 | TIM1 PWM Generation CH2 CH2N TIM1_CH2N PB14 34 | TIM1 PWM Generation CH3 CH3N TIM1_CH3 PA10 35 | TIM1 PWM Generation CH3 CH3N TIM1_CH3N PB15 36 | TIM1 PWM Generation No Output TIM1_VS_no_output4 VP_TIM1_VS_no_output4 37 | TIM1 Activate-Break-Input-2 TIM1_BKIN2 PA11 38 | TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT 39 | TIM2 XOR ON / Hall Sensor Mode TIM2_CH1 PA0 40 | TIM2 XOR ON / Hall Sensor Mode TIM2_CH2 PA1 41 | TIM2 XOR ON / Hall Sensor Mode TIM2_CH3 PA2 42 | USART1 Asynchronous USART1_RX PB7 43 | USART1 Asynchronous USART1_TX PB6 44 | USART3 Asynchronous USART3_RX PB11 45 | USART3 Asynchronous USART3_TX PB10 46 | 47 | 48 | 49 | Pin Nb PINs FUNCTIONs LABELs 50 | 5 PF0-OSC_IN RCC_OSC_IN 51 | 6 PF1-OSC_OUT RCC_OSC_OUT 52 | 8 PC0 ADC1_IN6 M1_CURR_AMPL_U 53 | 9 PC1 ADC1_IN7 M1_CURR_AMPL_V 54 | 10 PC2 ADC1_IN8 M1_CURR_AMPL_W 55 | 11 PC3 ADC1_IN9 M1_BUS_VOLTAGE 56 | 14 PA0 TIM2_CH1 M1_HALL_H1 57 | 15 PA1 TIM2_CH2 M1_HALL_H2 58 | 16 PA2 TIM2_CH3 M1_HALL_H3 59 | 17 PA3 ADC1_IN4 TEMP_IN 60 | 20 PA4 DAC_OUT1 DBG_DAC_CH1 61 | 22 PA6 ADC1_IN10 BEMP_U 62 | 24 PC4 GPIO_EXTI4 BEEP_EVT 63 | 26 PB0 ADC1_IN11 BEMP_V 64 | 27 PB1 ADC1_IN12 BEMP_W 65 | 29 PB10 USART3_TX DBG_TX3 66 | 30 PB11 USART3_RX DBG_RX2 67 | 34 PB13 TIM1_CH1N M1_PWM_UL 68 | 35 PB14 TIM1_CH2N M1_PWM_VL 69 | 36 PB15 TIM1_CH3N M1_PWM_WL 70 | 41 PA8 TIM1_CH1 M1_PWM_UH 71 | 42 PA9 TIM1_CH2 M1_PWM_VH 72 | 43 PA10 TIM1_CH3 M1_PWM_WH 73 | 44 PA11 TIM1_BKIN2 M1_OCP 74 | 58 PB6 USART1_TX R485_TX1 75 | 59 PB7 USART1_RX R485_RX1 76 | 61 PB8 CAN_RX 77 | 62 PB9 CAN_TX 78 | 79 | 80 | 81 | SOFTWARE PROJECT 82 | 83 | Project Settings : 84 | Project Name : STM32F302R8-FOC 85 | Project Folder : D:\motor\FOC5.0STM32F302R8\STM32F302R8-FOC 86 | Toolchain / IDE : MDK-ARM V5 87 | Firmware Package Name and Version : STM32Cube FW_F3 V1.10.0 88 | 89 | Code Generation Settings : 90 | STM32Cube Firmware Library Package : Copy all used libraries into the project folder 91 | Generate peripheral initialization as a pair of '.c/.h' files per peripheral : No 92 | Backup previously generated files when re-generating : No 93 | Delete previously generated files when not re-generated : Yes 94 | Set all free pins as analog (to optimize the power consumption) : No 95 | 96 | 97 | Toolchains Settings : 98 | Compiler Optimizations : 99 | 100 | 101 | 102 | 103 | 104 | --------------------------------------------------------------------------------