├── .gitattributes ├── .gitignore ├── LICENSE ├── Libraries ├── SimpleGUI │ ├── inc │ │ ├── Resource.h │ │ ├── SGUI_Basic.h │ │ ├── SGUI_Common.h │ │ ├── SGUI_Config.h │ │ ├── SGUI_FontResource.h │ │ ├── SGUI_Graph.h │ │ ├── SGUI_IconResource.h │ │ ├── SGUI_Interface.h │ │ ├── SGUI_ItemsBase.h │ │ ├── SGUI_List.h │ │ ├── SGUI_Menu.h │ │ ├── SGUI_Notice.h │ │ ├── SGUI_ProcessBar.h │ │ ├── SGUI_RealtimeGraph.h │ │ ├── SGUI_ScrollBar.h │ │ ├── SGUI_Text.h │ │ ├── SGUI_Typedef.h │ │ └── SGUI_VariableBox.h │ └── src │ │ ├── Resource.c │ │ ├── SGUI_Basic.c │ │ ├── SGUI_Common.c │ │ ├── SGUI_FontResource.c │ │ ├── SGUI_IconResource.c │ │ ├── SGUI_Interface.c │ │ ├── SGUI_ItemsBase.c │ │ ├── SGUI_List.c │ │ ├── SGUI_Menu.c │ │ ├── SGUI_Notice.c │ │ ├── SGUI_ProcessBar.c │ │ ├── SGUI_RealtimeGraph.c │ │ ├── SGUI_ScrollBar.c │ │ ├── SGUI_Text.c │ │ └── SGUI_VariableBox.c ├── StateMachineCompact │ ├── StateMachine.cpp │ └── StateMachine.hpp ├── doc │ ├── read me.txt │ └── version.txt ├── dspSource │ ├── BasicMathFunctions │ │ ├── BasicMathFunctions.c │ │ ├── CMakeLists.txt │ │ ├── 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 │ ├── CMakeLists.txt │ ├── CommonTables │ │ ├── CMakeLists.txt │ │ ├── CommonTables.c │ │ ├── arm_common_tables.c │ │ └── arm_const_structs.c │ ├── ComplexMathFunctions │ │ ├── ComplexMathFunctions.c │ │ ├── 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 │ │ ├── CMakeLists.txt │ │ ├── ControllerFunctions.c │ │ ├── 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 │ │ ├── CMakeLists.txt │ │ ├── FastMathFunctions.c │ │ ├── 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 │ │ ├── CMakeLists.txt │ │ ├── FilteringFunctions.c │ │ ├── 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 │ │ ├── MatrixFunctions.c │ │ ├── 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 │ │ ├── CMakeLists.txt │ │ ├── StatisticsFunctions.c │ │ ├── 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 │ │ ├── CMakeLists.txt │ │ ├── SupportFunctions.c │ │ ├── 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 │ │ ├── TransformFunctions.c │ │ ├── arm_bitreversal.c │ │ ├── arm_bitreversal2.S │ │ ├── arm_bitreversal2.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 ├── nncu │ ├── aiann │ │ └── aia_cmsisnn_ext.h │ ├── cmsis_nn │ │ ├── Include │ │ │ ├── arm_nn_tables.h │ │ │ ├── arm_nnfunctions.h │ │ │ ├── arm_nnfunctions.h.bak │ │ │ └── arm_nnsupportfunctions.h │ │ └── Source │ │ │ ├── arm_avepool_q7_HWC_nonsquare.c │ │ │ ├── arm_convolve_1x1_HWC_q7_fast_nonsquare.c │ │ │ ├── arm_convolve_HWC_q15_basic.c │ │ │ ├── arm_convolve_HWC_q15_fast.c │ │ │ ├── arm_convolve_HWC_q15_fast_nonsquare.c │ │ │ ├── arm_convolve_HWC_q7_RGB.c │ │ │ ├── arm_convolve_HWC_q7_basic.c │ │ │ ├── arm_convolve_HWC_q7_basic_nonsquare.c │ │ │ ├── arm_convolve_HWC_q7_fast.c │ │ │ ├── arm_convolve_HWC_q7_fast_nonsquare.c │ │ │ ├── arm_depthwise_separable_conv_HWC_q7.c │ │ │ ├── arm_depthwise_separable_conv_HWC_q7_nonsquare.c │ │ │ ├── arm_fully_connected_mat_q7_vec_q15.c │ │ │ ├── arm_fully_connected_mat_q7_vec_q15_opt.c │ │ │ ├── arm_fully_connected_q15.c │ │ │ ├── arm_fully_connected_q15_opt.c │ │ │ ├── arm_fully_connected_q7.c │ │ │ ├── arm_fully_connected_q7_opt.c │ │ │ ├── arm_nn_activations_q15.c │ │ │ ├── arm_nn_activations_q7.c │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15.c │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15_reordered.c │ │ │ ├── arm_nn_mult_q15.c │ │ │ ├── arm_nn_mult_q7.c │ │ │ ├── arm_nntables.c │ │ │ ├── arm_pool_q7_HWC.c │ │ │ ├── arm_q7_to_q15_no_shift.c │ │ │ ├── arm_q7_to_q15_reordered_no_shift.c │ │ │ ├── arm_relu_q15.c │ │ │ ├── arm_relu_q7.c │ │ │ ├── arm_softmax_q15.c │ │ │ └── arm_softmax_q7.c │ ├── nncie.h │ ├── nncie_imxrt10x0.lib │ └── nncie_port_nxpsdk.c ├── nxp_libraries │ ├── CMSIS │ │ ├── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_const_structs.h │ │ │ ├── arm_math.h │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armclang.h │ │ │ ├── cmsis_armclang_ltm.h │ │ │ ├── cmsis_compiler.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── cmsis_iccarm.h │ │ │ ├── cmsis_version.h │ │ │ ├── core_armv81mml.h │ │ │ ├── core_armv8mbl.h │ │ │ ├── core_armv8mml.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm1.h │ │ │ ├── core_cm23.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm33.h │ │ │ ├── core_cm35p.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm7.h │ │ │ ├── core_dsp.h │ │ │ ├── core_sc000.h │ │ │ ├── core_sc300.h │ │ │ ├── mpu_armv7.h │ │ │ ├── mpu_armv8.h │ │ │ └── tz_context.h │ │ └── LICENSE.txt │ ├── components │ │ ├── lists │ │ │ ├── generic_list.c │ │ │ └── generic_list.h │ │ ├── serial_manager │ │ │ ├── serial_manager.c │ │ │ ├── serial_manager.h │ │ │ ├── serial_port_internal.h │ │ │ ├── serial_port_swo.c │ │ │ ├── serial_port_swo.h │ │ │ ├── serial_port_uart.c │ │ │ └── serial_port_uart.h │ │ └── uart │ │ │ ├── lpuart_adapter.c │ │ │ └── uart.h │ ├── deceive │ │ ├── MIMXRT1064.h │ │ ├── MIMXRT1064_features.h │ │ ├── fsl_device_registers.h │ │ ├── system_MIMXRT1064.c │ │ └── system_MIMXRT1064.h │ ├── drives │ │ ├── fsl_adc.c │ │ ├── fsl_adc.h │ │ ├── fsl_cache.c │ │ ├── fsl_cache.h │ │ ├── fsl_clock.c │ │ ├── fsl_clock.h │ │ ├── fsl_common.c │ │ ├── fsl_common.h │ │ ├── fsl_dmamux.c │ │ ├── fsl_dmamux.h │ │ ├── fsl_edma.c │ │ ├── fsl_edma.h │ │ ├── fsl_flexio.c │ │ ├── fsl_flexio.h │ │ ├── fsl_flexram.c │ │ ├── fsl_flexram.h │ │ ├── fsl_flexram_allocate.c │ │ ├── fsl_flexram_allocate.h │ │ ├── fsl_flexspi.c │ │ ├── fsl_flexspi.h │ │ ├── fsl_gpio.c │ │ ├── fsl_gpio.h │ │ ├── fsl_gpt.c │ │ ├── fsl_gpt.h │ │ ├── fsl_iomuxc.h │ │ ├── fsl_lpspi.c │ │ ├── fsl_lpspi.h │ │ ├── fsl_lpspi_edma.c │ │ ├── fsl_lpspi_edma.h │ │ ├── fsl_lpuart.c │ │ ├── fsl_lpuart.h │ │ ├── fsl_lpuart_edma.c │ │ ├── fsl_lpuart_edma.h │ │ ├── fsl_pit.c │ │ ├── fsl_pit.h │ │ ├── fsl_pwm.c │ │ ├── fsl_pwm.h │ │ ├── fsl_qtmr.c │ │ ├── fsl_qtmr.h │ │ ├── fsl_rtwdog.h │ │ ├── fsl_src.c │ │ ├── fsl_src.h │ │ ├── fsl_tempmon.c │ │ ├── fsl_tempmon.h │ │ └── fsl_wdog.h │ ├── startup │ │ └── MDK-ARM │ │ │ └── startup_MIMXRT1064.s │ ├── utilities │ │ ├── debug_console │ │ │ ├── fsl_debug_console.c │ │ │ ├── fsl_debug_console.h │ │ │ ├── fsl_debug_console_conf.h │ │ │ └── fsl_debug_console_conf.h.bak │ │ ├── fsl_assert.c │ │ ├── fsl_notifier.c │ │ ├── fsl_notifier.h │ │ ├── fsl_sbrk.c │ │ ├── fsl_shell.c │ │ ├── fsl_shell.h │ │ └── str │ │ │ ├── fsl_str.c │ │ │ └── fsl_str.h │ └── xip │ │ ├── evkmimxrt1064_flexspi_nor_config.c │ │ ├── evkmimxrt1064_flexspi_nor_config.h │ │ ├── evkmimxrt1064_sdram_ini_dcd.c │ │ ├── evkmimxrt1064_sdram_ini_dcd.h │ │ ├── fsl_flexspi_nor_boot.c │ │ └── fsl_flexspi_nor_boot.h ├── seekfree_libraries │ ├── common │ │ ├── common.c │ │ └── common.h │ ├── headfile.h │ ├── zf_flash.c │ ├── zf_flash.h │ ├── zf_gpio.c │ ├── zf_gpio.h │ ├── zf_iomuxc.c │ ├── zf_iomuxc.h │ ├── zf_pit.c │ ├── zf_pit.h │ ├── zf_pwm.c │ ├── zf_pwm.h │ ├── zf_qtimer.h │ ├── zf_rom_api.c │ ├── zf_rom_api.h │ ├── zf_spi.c │ ├── zf_spi.h │ ├── zf_systick.c │ └── zf_systick.h └── seekfree_peripheral │ ├── SEEKFREE_FUN.c │ ├── SEEKFREE_FUN.h │ ├── SEEKFREE_IIC.c │ ├── SEEKFREE_IIC.h │ ├── SEEKFREE_VIRSCO.c │ └── SEEKFREE_VIRSCO.h ├── Pictures ├── IMG_20200511_130902.jpg ├── IMG_20200511_130913.jpg ├── IMG_20200511_130925.jpg ├── IMG_20200511_130935.jpg ├── IMG_20200511_131000.jpg ├── IMG_20200511_131010.jpg ├── IMG_20200511_131032.jpg ├── IMG_20200511_131054.jpg ├── IMG_20200511_131122.jpg ├── IMG_20200511_131148.jpg ├── IMG_20200511_164132.jpg ├── IMG_20200511_205727.jpg ├── IMG_20200511_210009.jpg ├── config.png ├── print.png └── uper.png ├── Project ├── CODE │ ├── README.md │ ├── ai │ │ ├── deep.cpp │ │ ├── deep.hpp │ │ ├── model1.nncu.c │ │ ├── model2.nncu.c │ │ └── model3.nncu.c │ ├── bsp │ │ ├── MCP4452.c │ │ ├── MCP4452.h │ │ ├── RT106X_config.h │ │ ├── bat.cpp │ │ ├── bat.hpp │ │ ├── beep.cpp │ │ ├── beep.hpp │ │ ├── encoder.cpp │ │ ├── encoder.hpp │ │ ├── key.cpp │ │ ├── key.hpp │ │ ├── led.cpp │ │ ├── led.hpp │ │ ├── route.h │ │ ├── storage.cpp │ │ └── storage.hpp │ ├── car │ │ ├── car.cpp │ │ ├── car.hpp │ │ ├── car_config.h │ │ ├── communication.cpp │ │ ├── communication.hpp │ │ ├── machine.cpp │ │ └── machine.hpp │ ├── control │ │ ├── hall.cpp │ │ ├── magnet.cpp │ │ ├── magnet.hpp │ │ ├── motor.cpp │ │ ├── motor.hpp │ │ ├── pid.cpp │ │ ├── pid.hpp │ │ ├── rit.cpp │ │ ├── steer.cpp │ │ └── steer.hpp │ ├── gui │ │ ├── SEEKFREE_OLED.c │ │ ├── SEEKFREE_OLED.h │ │ ├── gb2312.c │ │ ├── gui.cpp │ │ ├── gui.hpp │ │ ├── layout.cpp │ │ ├── layout.hpp │ │ ├── readme.md │ │ ├── screen.c │ │ ├── screen.h │ │ └── tree.hpp │ ├── main.cpp │ ├── utility │ │ ├── filter.cpp │ │ ├── filter.hpp │ │ ├── music.cpp │ │ ├── music.hpp │ │ ├── package.cpp │ │ ├── package.hpp │ │ ├── retarget.c │ │ ├── scheduler.cpp │ │ ├── scheduler.hpp │ │ ├── timer.cpp │ │ ├── timer.hpp │ │ ├── usage.cpp │ │ ├── usage.hpp │ │ └── util.h │ └── 写字库.cpp └── MDK │ ├── JLinkSettings.ini │ ├── MDK删除临时文件.bat │ ├── RT106X.mex │ ├── RT106X.uvoptx │ ├── RT106X.uvprojx │ ├── RTE │ ├── Compiler │ │ └── EventRecorderConf.h │ └── _nor_sdram_zf_dtcm_v6 │ │ └── RTE_Components.h │ ├── board │ ├── RTE_Device.h │ ├── board.c │ ├── board.h │ ├── clock_config.c │ ├── clock_config.h │ ├── peripherals.c │ ├── peripherals.h │ ├── pin_mux.c │ └── pin_mux.h │ ├── ini │ └── evkmimxrt1064_flexspi_nor.ini │ └── scf │ ├── MIMXRT1064xxxxx_flexspi_nor.scf │ └── MIMXRT1064xxxxx_flexspi_nor_v5.scf └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | Libraries/* linguist-vendored 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.dep 2 | *.lnp 3 | *.lst 4 | *.map 5 | .vscode 6 | Objects/ 7 | 8 | # Prerequisites 9 | *.d 10 | 11 | # Compiled Object files 12 | *.slo 13 | *.lo 14 | *.o 15 | *.obj 16 | 17 | # Precompiled Headers 18 | *.gch 19 | *.pch 20 | 21 | # Compiled Dynamic libraries 22 | *.so 23 | *.dylib 24 | *.dll 25 | 26 | # Fortran module files 27 | *.mod 28 | *.smod 29 | 30 | # Compiled Static libraries 31 | *.lai 32 | *.la 33 | *.a 34 | 35 | # Executables 36 | *.exe 37 | *.out 38 | *.app 39 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/Resource.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_RESOURCE_H_ 2 | #define _INCLUDE_RESOURCE_H_ 3 | 4 | #include"SGUI_Typedef.h" 5 | 6 | extern const SGUI_FONT_RES GB2312_FZXS12; 7 | 8 | #endif // _INCLUDE_RESOURCE_H_ 9 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Basic.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_GUI_BASIC__ 2 | #define __INCLUDE_GUI_BASIC__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | 8 | //=======================================================================// 9 | //= User Macro definition. =// 10 | //=======================================================================// 11 | #define SGUI_USED_BYTE(V) (((V-1)/8)+1) 12 | //Bitmap(include font) data bit operation 13 | #define SGUI_SET_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) | (0x01 << (Bit))) 14 | #define SGUI_CLR_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) & (~(0x01 << (Bit)))) 15 | #define SGUI_GET_PAGE_BIT(PAGE, Bit) ((((PAGE) & (0x01 << (Bit)))>0)?1:0) 16 | 17 | //=======================================================================// 18 | //= Public function declaration. =// 19 | //=======================================================================// 20 | void SGUI_Basic_ClearScreen(SGUI_SCR_DEV* pstDeviceIF); 21 | void SGUI_Basic_DrawPoint(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiPosX, SGUI_UINT uiY, SGUI_COLOR eColor); 22 | void SGUI_Basic_DrawLine(SGUI_SCR_DEV* pstDeviceIF, SGUI_INT uiStartX, SGUI_INT uiStartY, SGUI_INT uiEndX, SGUI_INT uiEndY, SGUI_COLOR eColor); 23 | void SGUI_Basic_DrawLineInArea(SGUI_SCR_DEV* pstDeviceIF, SGUI_POINT* pstStartPoint, SGUI_POINT* pstEndPoint, const SGUI_RECT* pcstArea, SGUI_COLOR eColor); 24 | void SGUI_Basic_DrawRectangle(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor); 25 | void SGUI_Basic_DrawCircle(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor); 26 | void SGUI_Basic_ReverseBlockColor(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight); 27 | void SGUI_Basic_DrawBitMap(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstDisplayArea, SGUI_POINT* pstInnerPos, const SGUI_BMP_RES* pstBitmapData, SGUI_DRAW_MODE eDrawMode); 28 | void SGUI_Basic_DrawPoint(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY, SGUI_COLOR eColor); 29 | SGUI_COLOR SGUI_Basic_GetPoint(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY); 30 | SGUI_BOOL SGUI_Basic_PointIsInArea(const SGUI_RECT* pstArea, const SGUI_POINT* pstPoint); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Common.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_GUI_COMMON_H__ 2 | #define __INCLUDE_GUI_COMMON_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Config.h" 7 | #include "SGUI_Typedef.h" 8 | #include "SGUI_Interface.h" 9 | 10 | //=======================================================================// 11 | //= User Macro definition. =// 12 | //=======================================================================// 13 | #define NOTICE_ICON_SIZE (16) 14 | #define SGUI_NUMBER_STR_LENGTH_MAX (12) 15 | #define SGUI_ISDIGIT(C) (((C>='0')&&(C<='9'))?true:false) 16 | #define SGUI_ISALPHA(C) ((((C>='A')&&(C<='Z'))||((C>='a')&&(C<='z')))?true:false) 17 | #define SGUI_ISHEXDIGIT(C) ((((C>='A')&&(C<='F'))||((C>='a')&&(C<='f'))||((C>='0')&&(C<='9')))?true:false) 18 | #define SGUI_ISUPPER(C) (((C>='A')&&(C<='Z'))?true:false) 19 | #define SGUI_TOUPPER(C) (SGUI_ISUPPER(C)?(C):(C-32)) 20 | #define SGUI_SWAP(A, B) {A=A^B; B=A^B; A=A^B;} 21 | 22 | #define LAYOUT(POBJ) ((POBJ)->stParam.stLayout) 23 | 24 | //=======================================================================// 25 | //= Public function declaration. =// 26 | //=======================================================================// 27 | 28 | //=======================================================================// 29 | //= Public function declaration. =// 30 | //=======================================================================// 31 | void SGUI_Common_AdaptDisplayInfo(SGUI_RECT* pstDisplayArea, SGUI_POINT* pstInnerPos); 32 | SGUI_SIZE SGUI_Common_IntegerToStringWithDecimalPoint(SGUI_INT iInteger, SGUI_UINT uiDecimalPlaces, SGUI_SZSTR pszStringBuffer, SGUI_INT iAlignment, SGUI_CHAR cFillCharacter); 33 | SGUI_SIZE SGUI_Common_IntegerToString(SGUI_INT iInteger, SGUI_SZSTR pszStringBuffer, SGUI_UINT uiBase, SGUI_INT iAlignment, SGUI_CHAR cFillCharacter); 34 | SGUI_UINT SGUI_Common_ConvertStringToUnsignedInteger(SGUI_SZSTR szString, SGUI_CHAR** ppcEndPointer, SGUI_UINT uiBase); 35 | SGUI_INT SGUI_Common_ConvertStringToInteger(SGUI_SZSTR szString, SGUI_CHAR** ppcEndPointer, SGUI_UINT uiBase); 36 | 37 | #endif // __INCLUDE_GUI_COMMON_H__ 38 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Config.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_SIMPLE_GUI_CONFIG_H_ 2 | #define _INCLUDE_SIMPLE_GUI_CONFIG_H_ 3 | 4 | //=======================================================================// 5 | //= Used for SimpleGUI virtual SDK. =// 6 | //=======================================================================// 7 | 8 | //#define _SIMPLE_GUI_ENCODE_TEXT_ 9 | 10 | #ifdef _SIMPLE_GUI_ENCODE_TEXT_ 11 | #define _SIMPLE_GUI_ENCODE_TEXT_SRC_ ("UTF-8") 12 | #define _SIMPLE_GUI_ENCODE_TEXT_DEST_ ("GB2312") 13 | #endif // _SIMPLE_GUI_ENCODE_TEXT_ 14 | //#define _SIMPLE_GUI_IN_VIRTUAL_SDK_ 15 | #define _SIMPLE_GUI_USE_SYS_PF_FUNCTIONS_ 16 | 17 | //=======================================================================// 18 | //= Used for SimpleGUI interface. =// 19 | //=======================================================================// 20 | //#define _SIMPLE_GUI_ENABLE_DYNAMIC_MEMORY_ 21 | 22 | #endif // _INCLUDE_SIMPLE_GUI_CONFIG_H_ 23 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_FontResource.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDED_SGUI_FONT_SOURCE_H_ 2 | #define _INCLUDED_SGUI_FONT_SOURCE_H_ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Typedef.h" 7 | 8 | //=======================================================================// 9 | //= Public variable declaration. =// 10 | //=======================================================================// 11 | extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_MiniNum; 12 | extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_8; 13 | extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_12; 14 | extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_16; 15 | 16 | #endif // _INCLUDED_SGUI_FONT_SOURCE_H_ 17 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Graph.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_SGUI_GRAPH_H__ 2 | #define __INCLUDE_SGUI_GRAPH_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | #include "SGUI_ScrollBar.h" 9 | 10 | //=======================================================================// 11 | //= Data type definition. =// 12 | //=======================================================================// 13 | typedef struct 14 | { 15 | SGUI_INT x; 16 | SGUI_INT y; 17 | }SGUI_GRAPH_POINT; 18 | 19 | typedef struct 20 | { 21 | SGUI_INT Min; 22 | SGUI_INT Max; 23 | }SGUI_GRAPH_AXIS; 24 | 25 | typedef struct 26 | { 27 | SGUI_GRAPH_POINT* Points; 28 | SGUI_SIZE Count; 29 | }SGUI_GRAPH_DATA; 30 | 31 | typedef struct 32 | { 33 | SGUI_GRAPH_AXIS xAxis; 34 | SGUI_GRAPH_AXIS yAxis; 35 | SGUI_SIZE FocusIndex; 36 | SGUI_INT PointRangeX; 37 | SGUI_INT PointRangeY; 38 | SGUI_GRAPH_POINT LastDrawingPoint; 39 | }SGUI_GRAPH_CONTROL; 40 | 41 | typedef struct 42 | { 43 | SGUI_SCROLLBAR_STRUCT xScrollBar; 44 | SGUI_SCROLLBAR_STRUCT yScrollBar; 45 | }SGUI_GRAPH_SUBELEMENT; 46 | 47 | typedef struct 48 | { 49 | SGUI_GRAPH_DATA* Data; 50 | SGUI_GRAPH_CONTROL* Control; 51 | SGUI_GRAPH_SUBELEMENT SubElement; 52 | }SGUI_GRAPH; 53 | 54 | typedef struct 55 | { 56 | SGUI_SIZE Count; 57 | SGUI_SIZE FocusIndex; 58 | SGUI_GRAPH_POINT* Points; 59 | }SGUI_GRAPH_INIT_DATA; 60 | 61 | //=======================================================================// 62 | //= Public function declaration. =// 63 | //=======================================================================// 64 | void SGUI_Graph_InitializeGraphData(SGUI_SCR_DEV* pstIFObj, SGUI_GRAPH* pstGraph, SGUI_GRAPH_INIT_DATA* pstInitializeData); 65 | void SGUI_Graph_Refresh(SGUI_SCR_DEV* pstIFObj, SGUI_GRAPH* pstGraph); 66 | #endif // __INCLUDE_SGUI_GRAPH_H__ 67 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_IconResource.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_SGUI_RESOURCE_H_ 2 | #define _INCLUDE_SGUI_RESOURCE_H_ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Typedef.h" 7 | 8 | //=======================================================================// 9 | //= Public variable declaration. =// 10 | //=======================================================================// 11 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_ERROR_16); 12 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_INFORMATION_16); 13 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_QUESTION_16); 14 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_WARNING_16); 15 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_ERROR_24); 16 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_INFORMATION_24); 17 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_QUESTION_24); 18 | SGUI_BMP_RESOURCE_DECLARE(SGUI_RES_ICON_WARNING_24); 19 | SGUI_BMP_RESOURCE_DECLARE(SGUI_MENU_ICON_MOVEUP_W5H3); 20 | SGUI_BMP_RESOURCE_DECLARE(SGUI_MENU_ICON_MOVEDOWN_W5H3); 21 | #endif // _INCLUDE_SGUI_RESOURCE_H_ 22 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Interface.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDED_SGUI_INTERFACE_H__ 2 | #define __INCLUDED_SGUI_INTERFACE_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Typedef.h" 7 | #include "SGUI_Common.h" 8 | 9 | //=======================================================================// 10 | //= User Macro definition. =// 11 | //=======================================================================// 12 | #if defined ( __CC_ARM ) 13 | #define SGUI_ASM __asm // asm keyword for ARM Compiler(Keil MDK). 14 | #define SGUI_INLINE __inline // inline keyword for ARM Compiler. 15 | #pragma diag_suppress 870 // Disabled "multibyte character sequence" warning. 16 | 17 | #elif defined ( __ICCARM__ ) 18 | #define SGUI_ASM __asm // < asm keyword for IAR Compiler. 19 | #define SGUI_INLINE inline // inline keyword for IAR Compiler. Only available in High optimization mode! 20 | 21 | #elif defined ( __GNUC__ ) 22 | #define SGUI_ASM __asm // asm keyword for GNU Compiler. 23 | #define SGUI_INLINE inline // inline keyword for GNU Compiler. 24 | 25 | #elif defined ( __TASKING__ ) 26 | #define SGUI_ASM __asm // asm keyword for TASKING Compiler. 27 | #define SGUI_INLINE inline // inline keyword for TASKING Compiler. 28 | #endif 29 | 30 | //=======================================================================// 31 | //= Public function declaration. =// 32 | //=======================================================================// 33 | #ifdef _SIMPLE_GUI_ENCODE_TEXT_ 34 | // Only used when running in simulated environment and text encode need convert to GB2312. 35 | SGUI_SZSTR SGUI_SystemIF_EncodeConvert(SGUI_CSZSTR szSourceEncode, SGUI_SZSTR szDestinationEncode, SGUI_SZSTR szSource); 36 | #define SGUI_ENCODE_BUFFER_SIZE (512) 37 | #define ENCODE(S) (SGUI_SystemIF_EncodeConvert(_SIMPLE_GUI_ENCODE_TEXT_SRC_, _SIMPLE_GUI_ENCODE_TEXT_DEST_, (char *)S)) 38 | #else 39 | #define ENCODE(S) (S) 40 | #endif 41 | 42 | #ifdef _SIMPLE_GUI_ENABLE_DYNAMIC_MEMORY_ 43 | SGUI_PTR SGUI_SystemIF_Allocate(SGUI_SIZE sSize); 44 | void SGUI_SystemIF_Free(SGUI_PTR pFreePointer); 45 | #endif 46 | SGUI_PTR SGUI_SystemIF_MemoryCopy(SGUI_PTR pDest, const SGUI_PTR pSrc, SGUI_SIZE sSize); 47 | void SGUI_SystemIF_MemorySet(SGUI_PTR pMemoryPtr, SGUI_BYTE iSetValue, SGUI_SIZE sSize); 48 | SGUI_SIZE SGUI_SystemIF_StringLength(SGUI_CSZSTR szString); 49 | SGUI_SZSTR SGUI_SystemIF_StringCopy(SGUI_SZSTR szDest, SGUI_CSZSTR szSrc); 50 | SGUI_SZSTR SGUI_SystemIF_StringLengthCopy(SGUI_SZSTR szDest, SGUI_CSZSTR szSrc, SGUI_SIZE sSize); 51 | 52 | #endif // __INCLUDED_SGUI_INTERFACE_H__ 53 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_ItemsBase.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_SGUI_ITEMS_BASE_H_ 2 | #define _INCLUDE_SGUI_ITEMS_BASE_H_ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | #include "SGUI_Text.h" 9 | 10 | //=======================================================================// 11 | //= User Macro definition. =// 12 | //=======================================================================// 13 | #define ITEM_EDGE_WIDTH (1) 14 | #define ITEM_HEIGHT(FONT) ((FONT)->iHeight+(ITEM_EDGE_WIDTH*2)) 15 | 16 | //=======================================================================// 17 | //= Data type definition. =// 18 | //=======================================================================// 19 | typedef struct _st_sgui_items_item_ 20 | { 21 | SGUI_CSZSTR cszLabelText; // This pointer points to a character array constant 22 | // char szVariableText[19]; 23 | SGUI_SZSTR szVariableText; // This pointer points to a character array variable, this member will be used first if existed. 24 | }SGUI_ITEMS_ITEM; 25 | 26 | typedef struct 27 | { 28 | SGUI_RECT stLayout; 29 | SGUI_ITEMS_ITEM* pstItems; // Read only 30 | SGUI_INT iCount; 31 | SGUI_INT iSelection; // Read only 32 | SGUI_INT iPageStartIndex; // Read only 33 | SGUI_INT iPageEndIndex; // Read only 34 | SGUI_INT iVisibleItems; 35 | SGUI_INT iItemPaintOffset; 36 | const SGUI_FONT_RES* pstFontRes; 37 | }SGUI_ITEMS_BASE; 38 | 39 | //=======================================================================// 40 | //= Public function declaration. =// 41 | //=======================================================================// 42 | void SGUI_ItemsBase_Initialize(SGUI_ITEMS_BASE* pstObj, const SGUI_FONT_RES* pstFontRes, SGUI_ITEMS_ITEM* pstItemsData, SGUI_INT iItemsCount); 43 | void SGUI_ItemsBase_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_ITEMS_BASE* pstObj); 44 | SGUI_ITEMS_ITEM* SGUI_ItemsBase_GetItem(SGUI_ITEMS_BASE* pstObj, SGUI_INT iSelection); 45 | void SGUI_ItemsBase_GetItemExtent(SGUI_ITEMS_BASE* pstObj, SGUI_INT iSelection, SGUI_RECT* pstItemExtent); 46 | void SGUI_ItemsBase_FitLayout(SGUI_ITEMS_BASE* pstObj); 47 | 48 | #endif // _INCLUDE_SGUI_ITEMS_BASE_H_ 49 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_List.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_SGUI_List_H__ 2 | #define __INCLUDE_SGUI_List_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | #include "SGUI_Text.h" 9 | #include "SGUI_ScrollBar.h" 10 | #include "SGUI_ItemsBase.h" 11 | 12 | //=======================================================================// 13 | //= Data type definition. =// 14 | //=======================================================================// 15 | typedef struct 16 | { 17 | SGUI_RECT stLayout; 18 | SGUI_ITEMS_BASE stItems; 19 | SGUI_CSZSTR szTitle; 20 | SGUI_SCROLLBAR_STRUCT stScrollBar; 21 | const SGUI_FONT_RES* pstFontRes; 22 | }SGUI_LIST_STRUCT; 23 | 24 | //=======================================================================// 25 | //= Public function declaration. =// 26 | //=======================================================================// 27 | void SGUI_List_Initialize(SGUI_LIST_STRUCT* pstObj, const SGUI_FONT_RES* pstFontRes, SGUI_ITEMS_ITEM* pstItemsData, SGUI_INT iItemsCount); 28 | void SGUI_List_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_LIST_STRUCT* pstObj); 29 | 30 | #endif // __INCLUDE_SGUI_List_H__ 31 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Menu.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_SGUI_MENU_H_ 2 | #define _INCLUDE_SGUI_MENU_H_ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | #include "SGUI_Text.h" 9 | #include "SGUI_ItemsBase.h" 10 | //=======================================================================// 11 | //= Data type definition. =// 12 | //=======================================================================// 13 | typedef struct 14 | { 15 | SGUI_RECT stLayout; 16 | SGUI_ITEMS_BASE stItems; 17 | const SGUI_FONT_RES* pstFontRes; 18 | }SGUI_MENU_STRUCT; 19 | 20 | //=======================================================================// 21 | //= Public function declaration. =// 22 | //=======================================================================// 23 | void SGUI_Menu_Initialize(SGUI_MENU_STRUCT* pstObj, const SGUI_FONT_RES* pstFontRes, const SGUI_RECT* cpstLayout, SGUI_ITEMS_ITEM* pstItemsData, SGUI_INT iItemsCount); 24 | void SGUI_Menu_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_MENU_STRUCT* pstObj); 25 | void SGUI_Menu_Layout(SGUI_MENU_STRUCT* pstObj, const SGUI_RECT* pstNewLayout); 26 | void SGUI_Menu_PopupSubMenu(SGUI_SCR_DEV* pstDeviceIF, SGUI_MENU_STRUCT* pstObj, const SGUI_RECT* cpstParentLayout); 27 | 28 | #endif // _INCLUDE_SGUI_MENU_H_ 29 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Notice.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_GUI_NOTICE_H__ 2 | #define __INCLUDE_GUI_NOTICE_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | #include "SGUI_Text.h" 9 | 10 | //=======================================================================// 11 | //= Data type definition. =// 12 | //=======================================================================// 13 | typedef struct 14 | { 15 | SGUI_CSZSTR cszNoticeText; 16 | const SGUI_BMP_RES* pstIcon; 17 | SGUI_RECT stLayout; 18 | }SGUI_NOTICT_BOX; 19 | 20 | //=======================================================================// 21 | //= Public function declaration. =// 22 | //=======================================================================// 23 | SGUI_SIZE SGUI_Notice_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_NOTICT_BOX* pstObject, const SGUI_FONT_RES* pstFontRes, SGUI_INT uiTextOffset); 24 | void SGUI_Notice_FitArea(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstFitArea); 25 | 26 | #endif // __INCLUDE_GUI_NOTICE_H__ 27 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_ProcessBar.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_GUI_PROCESSBAR_H__ 2 | #define __INCLUDE_GUI_PROCESSBAR_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | 9 | //=======================================================================// 10 | //= Data type definition. =// 11 | //=======================================================================// 12 | typedef enum 13 | { 14 | SGUI_PROCBAR_UP = 0, //Process bar direction to up. 15 | SGUI_PROCBAR_DOWN, //Process bar direction to down. 16 | SGUI_PROCBAR_LEFT, //Process bar direction to left. 17 | SGUI_PROCBAR_RIGHT, //Process bar direction to right. 18 | }SGUI_PROCBAR_DIRECTION; 19 | 20 | typedef struct 21 | { 22 | SGUI_INT PosX; 23 | SGUI_INT PosY; 24 | SGUI_SIZE Width; 25 | SGUI_SIZE Height; 26 | SGUI_PROCBAR_DIRECTION Direction; 27 | SGUI_UINT32 MaxValue; 28 | 29 | }SGUI_PROCBAR_PARAMETER; 30 | 31 | typedef struct 32 | { 33 | SGUI_SIZE Value; 34 | }SGUI_PROCBAR_DATA; 35 | 36 | typedef struct 37 | { 38 | SGUI_PROCBAR_PARAMETER Parameter; 39 | SGUI_PROCBAR_DATA Data; 40 | }SGUI_PROCBAR_STRUCT; 41 | 42 | //=======================================================================// 43 | //= Public function declaration. =// 44 | //=======================================================================// 45 | void SGUI_ProcessBar_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_PROCBAR_STRUCT *pProcessBarData); 46 | 47 | #endif // __INCLUDE_GUI_PROCESSBAR_H__ 48 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_RealtimeGraph.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_GUI_REAL_GRAPH_H__ 2 | #define __INCLUDE_GUI_REAL_GRAPH_H__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | 9 | //=======================================================================// 10 | //= User Macro definition. =// 11 | //=======================================================================// 12 | #define SGUI_RTGRAPH_VALUE_ARRAY_SIZE (128) 13 | 14 | //=======================================================================// 15 | //= Data type definition. =// 16 | //=======================================================================// 17 | typedef struct 18 | { 19 | SGUI_INT yAxisMax; // Max value on screen display. 20 | SGUI_INT yAxisMin; // Min value on screen display. 21 | SGUI_BOOL EnableBaseline; // Enable to show zero-point line. 22 | SGUI_INT xAxisStepPixel; 23 | SGUI_INT ValueArea; // Display value range, auto calculate when initialize. 24 | }SGUI_RTGRAPH_CONTROL; 25 | 26 | typedef struct 27 | { 28 | 29 | SGUI_INT ValueArray[SGUI_RTGRAPH_VALUE_ARRAY_SIZE]; 30 | SGUI_INT LimitedValueArray[SGUI_RTGRAPH_VALUE_ARRAY_SIZE]; 31 | SGUI_INT PointYCoordinateArray[SGUI_RTGRAPH_VALUE_ARRAY_SIZE]; 32 | SGUI_INT BaseLineValue; // Base line value on graph map. 33 | SGUI_INT ValueCount; // Display value point number, auto calculate when initialize. 34 | }SGUI_RTGRAPH_DATA; 35 | 36 | typedef struct 37 | { 38 | SGUI_RECT stLayout; 39 | SGUI_RTGRAPH_DATA* Data; 40 | SGUI_RTGRAPH_CONTROL* Control; 41 | }SGUI_RTGRAPH; 42 | 43 | //=======================================================================// 44 | //= Public function declaration. =// 45 | //=======================================================================// 46 | void SGUI_RealtimeGraph_Initialize(SGUI_RTGRAPH* pstRTGraph); 47 | void SGUI_RealtimeGraph_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_RTGRAPH* pstRTGraph); 48 | void SGUI_RealtimeGraph_AppendValue(SGUI_SCR_DEV* pstDeviceIF, SGUI_RTGRAPH* pstRTGraph, SGUI_INT iNewValue); 49 | #endif // __INCLUDE_GUI_REAL_GRAPH_H__ 50 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_ScrollBar.h: -------------------------------------------------------------------------------- 1 | #ifndef __INCLUDE_GUI_SCROLLBAR__ 2 | #define __INCLUDE_GUI_SCROLLBAR__ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Basic.h" 7 | #include "SGUI_Common.h" 8 | 9 | //=======================================================================// 10 | //= Data type definition. =// 11 | //=======================================================================// 12 | typedef enum 13 | { 14 | SGUI_SCROLLBAR_VERTICAL = 0, //Vertical scroll bar. 15 | SGUI_SCROLLBAR_HORIZONTAL, //Horizontal scroll bar. 16 | }SGUI_SCROLLBAR_DIRECTION; 17 | 18 | typedef struct 19 | { 20 | SGUI_RECT stLayout; 21 | SGUI_SIZE sMaxValue; 22 | SGUI_SCROLLBAR_DIRECTION eDirection; 23 | }SGUI_SCROLLBAR_PARAM; 24 | 25 | typedef struct 26 | { 27 | SGUI_SIZE sValue; 28 | }SGUI_SCROLLBAR_DATA; 29 | 30 | typedef struct 31 | { 32 | SGUI_SCROLLBAR_PARAM stParam; 33 | SGUI_SCROLLBAR_DATA stData; 34 | }SGUI_SCROLLBAR_STRUCT; 35 | 36 | //=======================================================================// 37 | //= Public function declaration. =// 38 | //=======================================================================// 39 | void SGUI_ScrollBar_Initialize(SGUI_SCROLLBAR_STRUCT* pstObj, const SGUI_SCROLLBAR_PARAM* pcstInitParam); 40 | void SGUI_ScrollBar_SetValue(SGUI_SCROLLBAR_STRUCT* pstObj, SGUI_SIZE sNewValue); 41 | SGUI_SIZE SGUI_ScrollBar_GetValue(const SGUI_SCROLLBAR_STRUCT* pstObj); 42 | void SGUI_ScrollBar_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_SCROLLBAR_STRUCT* pstObj); 43 | 44 | #endif // __INCLUDE_GUI_SCROLLBAR_STRUCT__ 45 | -------------------------------------------------------------------------------- /Libraries/SimpleGUI/inc/SGUI_Text.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_GUI_FONT_H_ 2 | #define _INCLUDE_GUI_FONT_H_ 3 | //=======================================================================// 4 | //= Include files. =// 5 | //=======================================================================// 6 | #include "SGUI_Common.h" 7 | #include "SGUI_Basic.h" 8 | 9 | //=======================================================================// 10 | //= User Macro definition. =// 11 | //=======================================================================// 12 | #define FONT_LIB_ADDR 0X00000 13 | // Max font size is 64 pix, maximum of font data size is 64 * 8 = 512 Bytes. 14 | #define TEXT_NUMBER_STR_LENGTH_MAX (12) 15 | #define TEXT_PLACEHOLDER_CHARACTER ('*') 16 | #define SGUI_IS_VISIBLE_CHAR(C) ((C>0x1F) && (C<0x7F)) 17 | 18 | //=======================================================================// 19 | //= Data type definition. =// 20 | //=======================================================================// 21 | 22 | //=======================================================================// 23 | //= Public variable declaration. =// 24 | //=======================================================================// 25 | extern SGUI_CSZSTR SGUI_EMPTY_STRING; 26 | 27 | //=======================================================================// 28 | //= Public function declaration. =// 29 | //=======================================================================// 30 | void SGUI_Text_GetTextExtent(SGUI_CSZSTR cszTextBuffer, const SGUI_FONT_RES* pstFontRes, SGUI_AREA_SIZE* pstTextExtent); 31 | void SGUI_Text_DrawText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR cszTextBuffer, const SGUI_FONT_RES* pstFontRes, SGUI_RECT* pstDisplayArea, SGUI_POINT* pstInnerPos, SGUI_DRAW_MODE eFontMode); 32 | SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR szTextBuffer, const SGUI_FONT_RES* pstFontRes, SGUI_RECT* pstDisplayArea, SGUI_INT iTopOffset, SGUI_DRAW_MODE eFontMode); 33 | SGUI_SIZE SGUI_Text_GetMultiLineTextLines(SGUI_CSZSTR cszText, const SGUI_FONT_RES* pstFontRes, SGUI_SIZE uiDisplayAreaWidth); 34 | SGUI_SIZE SGUI_Text_GetCharacterData(const SGUI_FONT_RES* pstFontRes, SGUI_UINT32 uiCode, SGUI_BYTE* pDataBuffer, SGUI_SIZE sBufferSize); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Libraries/StateMachineCompact/StateMachine.cpp: -------------------------------------------------------------------------------- 1 | #include "StateMachine.hpp" 2 | #include "util.h" 3 | #include 4 | 5 | StateMachine::StateMachine(unsigned char maxStates) 6 | : _maxStates(maxStates), currentState(0), _eventGenerated(false), 7 | _pEventData(NULL) {} 8 | 9 | // generates an external event. called once per external event 10 | // to start the state machine executing 11 | void StateMachine::ExternalEvent(unsigned char newState, EventData *pData) { 12 | // if we are supposed to ignore this event 13 | if (newState == EVENT_IGNORED) { 14 | // just delete the event data, if any 15 | if (pData) 16 | delete pData; 17 | } else { 18 | // TODO - capture software lock here for thread-safety if necessary 19 | CRITICAL_REGION_ENTER(); 20 | // generate the event and execute the state engine 21 | InternalEvent(newState, pData); 22 | StateEngine(); 23 | CRITICAL_REGION_EXIT(); 24 | // TODO - release software lock here 25 | } 26 | } 27 | 28 | // generates an internal event. called from within a state 29 | // function to transition to a new state 30 | void StateMachine::InternalEvent(unsigned char newState, EventData *pData) { 31 | if (pData == NULL) 32 | pData = new EventData(); 33 | 34 | _pEventData = pData; 35 | _eventGenerated = true; 36 | currentState = newState; 37 | } 38 | 39 | // the state engine executes the state machine states 40 | void StateMachine::StateEngine(void) { 41 | EventData *pDataTemp = NULL; 42 | 43 | // while events are being generated keep executing states 44 | while (_eventGenerated) { 45 | pDataTemp = _pEventData; // copy of event data pointer 46 | _pEventData = NULL; // event data used up, reset ptr 47 | _eventGenerated = false; // event used up, reset flag 48 | 49 | // assert(currentState < _maxStates); 50 | 51 | // get state map 52 | const StateStruct *pStateMap = GetStateMap(); 53 | 54 | // execute the state passing in event data, if any 55 | (this->*pStateMap[currentState].pStateFunc)(pDataTemp); 56 | 57 | // if event data was used, then delete it 58 | if (pDataTemp) { 59 | delete pDataTemp; 60 | pDataTemp = NULL; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Libraries/StateMachineCompact/StateMachine.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _STATE_MACHINE_H 2 | #define _STATE_MACHINE_H 3 | #include 4 | 5 | class EventData 6 | { 7 | public: 8 | virtual ~EventData() {}; 9 | }; 10 | 11 | struct StateStruct; 12 | 13 | // base class for state machines 14 | class StateMachine 15 | { 16 | public: 17 | StateMachine(unsigned char maxStates); 18 | virtual ~StateMachine() {} 19 | protected: 20 | enum { EVENT_IGNORED = 0xFE, CANNOT_HAPPEN }; 21 | unsigned char currentState; 22 | void ExternalEvent(unsigned char, EventData* = NULL); 23 | void InternalEvent(unsigned char, EventData* = NULL); 24 | virtual const StateStruct* GetStateMap() = 0; 25 | private: 26 | const unsigned char _maxStates; 27 | bool _eventGenerated; 28 | EventData* _pEventData; 29 | void StateEngine(void); 30 | }; 31 | 32 | typedef void (StateMachine::*StateFunc)(EventData *); 33 | struct StateStruct 34 | { 35 | StateFunc pStateFunc; 36 | }; 37 | 38 | #define BEGIN_STATE_MAP \ 39 | public:\ 40 | const StateStruct* GetStateMap() {\ 41 | static const StateStruct StateMap[] = { 42 | 43 | #define STATE_MAP_ENTRY(stateFunc)\ 44 | { reinterpret_cast(stateFunc) }, 45 | 46 | #define END_STATE_MAP \ 47 | }; \ 48 | return &StateMap[0]; } 49 | 50 | #define BEGIN_TRANSITION_MAP \ 51 | static const unsigned char TRANSITIONS[] = {\ 52 | 53 | #define TRANSITION_MAP_ENTRY(entry)\ 54 | entry, 55 | 56 | #define END_TRANSITION_MAP(data) \ 57 | 0 };\ 58 | ExternalEvent(TRANSITIONS[currentState], data); 59 | 60 | #endif //STATE_MACHINE_H 61 | -------------------------------------------------------------------------------- /Libraries/doc/read me.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/doc/read me.txt -------------------------------------------------------------------------------- /Libraries/doc/version.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/doc/version.txt -------------------------------------------------------------------------------- /Libraries/dspSource/BasicMathFunctions/BasicMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: BasicMathFunctions.c 4 | * Description: Combination of all basic math function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_abs_f32.c" 30 | #include "arm_abs_q15.c" 31 | #include "arm_abs_q31.c" 32 | #include "arm_abs_q7.c" 33 | #include "arm_add_f32.c" 34 | #include "arm_add_q15.c" 35 | #include "arm_add_q31.c" 36 | #include "arm_add_q7.c" 37 | #include "arm_dot_prod_f32.c" 38 | #include "arm_dot_prod_q15.c" 39 | #include "arm_dot_prod_q31.c" 40 | #include "arm_dot_prod_q7.c" 41 | #include "arm_mult_f32.c" 42 | #include "arm_mult_q15.c" 43 | #include "arm_mult_q31.c" 44 | #include "arm_mult_q7.c" 45 | #include "arm_negate_f32.c" 46 | #include "arm_negate_q15.c" 47 | #include "arm_negate_q31.c" 48 | #include "arm_negate_q7.c" 49 | #include "arm_offset_f32.c" 50 | #include "arm_offset_q15.c" 51 | #include "arm_offset_q31.c" 52 | #include "arm_offset_q7.c" 53 | #include "arm_scale_f32.c" 54 | #include "arm_scale_q15.c" 55 | #include "arm_scale_q31.c" 56 | #include "arm_scale_q7.c" 57 | #include "arm_shift_q15.c" 58 | #include "arm_shift_q31.c" 59 | #include "arm_shift_q7.c" 60 | #include "arm_sub_f32.c" 61 | #include "arm_sub_q15.c" 62 | #include "arm_sub_q31.c" 63 | #include "arm_sub_q7.c" 64 | -------------------------------------------------------------------------------- /Libraries/dspSource/BasicMathFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.6) 2 | 3 | project(CMSISDSPBasicMath) 4 | 5 | 6 | file(GLOB SRC "./*_*.c") 7 | 8 | add_library(CMSISDSPBasicMath STATIC ${SRC}) 9 | 10 | configdsp(CMSISDSPBasicMath ..) 11 | 12 | ### Includes 13 | target_include_directories(CMSISDSPBasicMath PUBLIC "${DSP}/../../Include") 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Libraries/dspSource/CommonTables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.6) 2 | 3 | project(CMSISDSPCommon) 4 | 5 | 6 | 7 | add_library(CMSISDSPCommon STATIC arm_common_tables.c) 8 | 9 | if (CONFIGTABLE AND ALLFFT) 10 | target_compile_definitions(CMSISDSPCommon PUBLIC ARM_ALL_FFT_TABLES) 11 | endif() 12 | 13 | if (CONFIGTABLE AND ALLFAST) 14 | target_compile_definitions(CMSISDSPCommon PUBLIC ARM_ALL_FAST_TABLES) 15 | endif() 16 | 17 | include(fft) 18 | fft(CMSISDSPCommon) 19 | 20 | include(interpol) 21 | interpol(CMSISDSPCommon) 22 | 23 | target_sources(CMSISDSPCommon PRIVATE arm_const_structs.c) 24 | 25 | configdsp(CMSISDSPCommon ..) 26 | 27 | ### Includes 28 | target_include_directories(CMSISDSPCommon PUBLIC "${DSP}/../../Include") 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Libraries/dspSource/CommonTables/CommonTables.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CommonTables.c 4 | * Description: Combination of all common table source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_common_tables.c" 30 | #include "arm_const_structs.c" 31 | 32 | -------------------------------------------------------------------------------- /Libraries/dspSource/ComplexMathFunctions/ComplexMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CompexMathFunctions.c 4 | * Description: Combination of all comlex math function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_cmplx_conj_f32.c" 30 | #include "arm_cmplx_conj_q15.c" 31 | #include "arm_cmplx_conj_q31.c" 32 | #include "arm_cmplx_dot_prod_f32.c" 33 | #include "arm_cmplx_dot_prod_q15.c" 34 | #include "arm_cmplx_dot_prod_q31.c" 35 | #include "arm_cmplx_mag_f32.c" 36 | #include "arm_cmplx_mag_q15.c" 37 | #include "arm_cmplx_mag_q31.c" 38 | #include "arm_cmplx_mag_squared_f32.c" 39 | #include "arm_cmplx_mag_squared_q15.c" 40 | #include "arm_cmplx_mag_squared_q31.c" 41 | #include "arm_cmplx_mult_cmplx_f32.c" 42 | #include "arm_cmplx_mult_cmplx_q15.c" 43 | #include "arm_cmplx_mult_cmplx_q31.c" 44 | #include "arm_cmplx_mult_real_f32.c" 45 | #include "arm_cmplx_mult_real_q15.c" 46 | #include "arm_cmplx_mult_real_q31.c" 47 | -------------------------------------------------------------------------------- /Libraries/dspSource/ControllerFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.6) 2 | 3 | project(CMSISDSPController) 4 | 5 | add_library(CMSISDSPController STATIC) 6 | 7 | configdsp(CMSISDSPController ..) 8 | 9 | include(interpol) 10 | interpol(CMSISDSPController) 11 | 12 | if (CONFIGTABLE AND ALLFAST) 13 | target_compile_definitions(CMSISDSPController PUBLIC ARM_ALL_FAST_TABLES) 14 | endif() 15 | 16 | target_sources(CMSISDSPController PRIVATE arm_pid_init_f32.c) 17 | target_sources(CMSISDSPController PRIVATE arm_pid_init_q15.c) 18 | target_sources(CMSISDSPController PRIVATE arm_pid_init_q31.c) 19 | target_sources(CMSISDSPController PRIVATE arm_pid_reset_f32.c) 20 | target_sources(CMSISDSPController PRIVATE arm_pid_reset_q15.c) 21 | target_sources(CMSISDSPController PRIVATE arm_pid_reset_q31.c) 22 | 23 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_COS_F32) 24 | target_sources(CMSISDSPController PRIVATE arm_sin_cos_f32.c) 25 | endif() 26 | 27 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_COS_Q31) 28 | target_sources(CMSISDSPController PRIVATE arm_sin_cos_q31.c) 29 | endif() 30 | 31 | 32 | 33 | ### Includes 34 | target_include_directories(CMSISDSPController PUBLIC "${DSP}/../../Include") 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Libraries/dspSource/ControllerFunctions/ControllerFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: ControllerFunctions.c 4 | * Description: Combination of all controller function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_pid_init_f32.c" 30 | #include "arm_pid_init_q15.c" 31 | #include "arm_pid_init_q31.c" 32 | #include "arm_pid_reset_f32.c" 33 | #include "arm_pid_reset_q15.c" 34 | #include "arm_pid_reset_q31.c" 35 | #include "arm_sin_cos_f32.c" 36 | #include "arm_sin_cos_q31.c" 37 | 38 | -------------------------------------------------------------------------------- /Libraries/dspSource/ControllerFunctions/arm_pid_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_init_f32.c 4 | * Description: Floating-point PID Control initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Initialization function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the PID structure 39 | @param[in] resetStateFlag 40 | - value = 0: no change in state 41 | - value = 1: reset state 42 | @return none 43 | 44 | @par Details 45 | The resetStateFlag specifies whether to set state to zero or not. \n 46 | The function computes the structure fields: A0, A1 A2 47 | using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 48 | also sets the state variables to all zeros. 49 | */ 50 | 51 | void arm_pid_init_f32( 52 | arm_pid_instance_f32 * S, 53 | int32_t resetStateFlag) 54 | { 55 | /* Derived coefficient A0 */ 56 | S->A0 = S->Kp + S->Ki + S->Kd; 57 | 58 | /* Derived coefficient A1 */ 59 | S->A1 = (-S->Kp) - ((float32_t) 2.0 * S->Kd); 60 | 61 | /* Derived coefficient A2 */ 62 | S->A2 = S->Kd; 63 | 64 | /* Check whether state needs reset or not */ 65 | if (resetStateFlag) 66 | { 67 | /* Reset state to zero, The size will be always 3 samples */ 68 | memset(S->state, 0, 3U * sizeof(float32_t)); 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of PID group 75 | */ 76 | -------------------------------------------------------------------------------- /Libraries/dspSource/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_f32.c 4 | * Description: Floating-point PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the floating-point PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_f32( 46 | arm_pid_instance_f32 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(float32_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Libraries/dspSource/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q15.c 4 | * Description: Q15 PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q15 PID Control. 38 | @param[in,out] S points to an instance of the Q15 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q15( 46 | arm_pid_instance_q15 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q15_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Libraries/dspSource/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q31.c 4 | * Description: Q31 PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q31 PID Control. 38 | @param[in,out] S points to an instance of the Q31 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q31( 46 | arm_pid_instance_q31 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q31_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Libraries/dspSource/FastMathFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.6) 2 | 3 | project(CMSISDSPFastMath) 4 | 5 | 6 | file(GLOB SRC "./*_*.c") 7 | 8 | add_library(CMSISDSPFastMath STATIC) 9 | 10 | include(interpol) 11 | interpol(CMSISDSPFastMath) 12 | 13 | if (CONFIGTABLE AND ALLFAST) 14 | target_compile_definitions(CMSISDSPFastMath PUBLIC ARM_ALL_FAST_TABLES) 15 | endif() 16 | 17 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_COS_F32) 18 | target_sources(CMSISDSPFastMath PRIVATE arm_cos_f32.c) 19 | endif() 20 | 21 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_COS_Q15) 22 | target_sources(CMSISDSPFastMath PRIVATE arm_cos_q15.c) 23 | endif() 24 | 25 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_COS_Q31) 26 | target_sources(CMSISDSPFastMath PRIVATE arm_cos_q31.c) 27 | endif() 28 | 29 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_F32) 30 | target_sources(CMSISDSPFastMath PRIVATE arm_sin_f32.c) 31 | endif() 32 | 33 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_Q15) 34 | target_sources(CMSISDSPFastMath PRIVATE arm_sin_q15.c) 35 | endif() 36 | 37 | if (NOT CONFIGTABLE OR ALLFAST OR ARM_SIN_Q31) 38 | target_sources(CMSISDSPFastMath PRIVATE arm_sin_q31.c) 39 | endif() 40 | 41 | target_sources(CMSISDSPFastMath PRIVATE arm_sqrt_q15.c) 42 | target_sources(CMSISDSPFastMath PRIVATE arm_sqrt_q31.c) 43 | 44 | 45 | configdsp(CMSISDSPFastMath ..) 46 | 47 | ### Includes 48 | target_include_directories(CMSISDSPFastMath PUBLIC "${DSP}/../../Include") 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Libraries/dspSource/FastMathFunctions/FastMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: FastMathFunctions.c 4 | * Description: Combination of all fast math function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_cos_f32.c" 30 | #include "arm_cos_q15.c" 31 | #include "arm_cos_q31.c" 32 | #include "arm_sin_f32.c" 33 | #include "arm_sin_q15.c" 34 | #include "arm_sin_q31.c" 35 | #include "arm_sqrt_q15.c" 36 | #include "arm_sqrt_q31.c" 37 | 38 | -------------------------------------------------------------------------------- /Libraries/dspSource/FastMathFunctions/arm_cos_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_cos_q15.c 4 | * Description: Fast cosine calculation for Q15 values 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup cos 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric cosine function for Q15 data. 43 | @param[in] x Scaled input value in radians 44 | @return cos(x) 45 | 46 | The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q15_t arm_cos_q15( 50 | q15_t x) 51 | { 52 | q15_t cosVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q15_t a, b; /* Two nearest output values */ 55 | q15_t fract; /* Temporary values for fractional values */ 56 | 57 | /* add 0.25 (pi/2) to read sine table */ 58 | x = (uint16_t)x + 0x2000; 59 | if (x < 0) 60 | { /* convert negative numbers to corresponding positive ones */ 61 | x = (uint16_t)x + 0x8000; 62 | } 63 | 64 | /* Calculate the nearest index */ 65 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 66 | 67 | /* Calculation of fractional value */ 68 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 69 | 70 | /* Read two nearest values of input value from the sin table */ 71 | a = sinTable_q15[index]; 72 | b = sinTable_q15[index+1]; 73 | 74 | /* Linear interpolation process */ 75 | cosVal = (q31_t) (0x8000 - fract) * a >> 16; 76 | cosVal = (q15_t) ((((q31_t) cosVal << 16) + ((q31_t) fract * b)) >> 16); 77 | 78 | /* Return output value */ 79 | return (cosVal << 1); 80 | } 81 | 82 | /** 83 | @} end of cos group 84 | */ 85 | -------------------------------------------------------------------------------- /Libraries/dspSource/FastMathFunctions/arm_cos_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_cos_q31.c 4 | * Description: Fast cosine calculation for Q31 values 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup cos 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric cosine function for Q31 data. 43 | @param[in] x Scaled input value in radians 44 | @return cos(x) 45 | 46 | The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q31_t arm_cos_q31( 50 | q31_t x) 51 | { 52 | q31_t cosVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q31_t a, b; /* Two nearest output values */ 55 | q31_t fract; /* Temporary values for fractional values */ 56 | 57 | /* add 0.25 (pi/2) to read sine table */ 58 | x = (uint32_t)x + 0x20000000; 59 | if (x < 0) 60 | { /* convert negative numbers to corresponding positive ones */ 61 | x = (uint32_t)x + 0x80000000; 62 | } 63 | 64 | /* Calculate the nearest index */ 65 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 66 | 67 | /* Calculation of fractional value */ 68 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 69 | 70 | /* Read two nearest values of input value from the sin table */ 71 | a = sinTable_q31[index]; 72 | b = sinTable_q31[index+1]; 73 | 74 | /* Linear interpolation process */ 75 | cosVal = (q63_t) (0x80000000 - fract) * a >> 32; 76 | cosVal = (q31_t) ((((q63_t) cosVal << 32) + ((q63_t) fract * b)) >> 32); 77 | 78 | /* Return output value */ 79 | return (cosVal << 1); 80 | } 81 | 82 | /** 83 | @} end of cos group 84 | */ 85 | -------------------------------------------------------------------------------- /Libraries/dspSource/FastMathFunctions/arm_sin_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sin_q15.c 4 | * Description: Fast sine calculation for Q15 values 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup sin 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric sine function for Q15 data. 43 | @param[in] x Scaled input value in radians 44 | @return sin(x) 45 | 46 | The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q15_t arm_sin_q15( 50 | q15_t x) 51 | { 52 | q15_t sinVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q15_t a, b; /* Two nearest output values */ 55 | q15_t fract; /* Temporary values for fractional values */ 56 | 57 | /* Calculate the nearest index */ 58 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 59 | 60 | /* Calculation of fractional value */ 61 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 62 | 63 | /* Read two nearest values of input value from the sin table */ 64 | a = sinTable_q15[index]; 65 | b = sinTable_q15[index+1]; 66 | 67 | /* Linear interpolation process */ 68 | sinVal = (q31_t) (0x8000 - fract) * a >> 16; 69 | sinVal = (q15_t) ((((q31_t) sinVal << 16) + ((q31_t) fract * b)) >> 16); 70 | 71 | /* Return output value */ 72 | return (sinVal << 1); 73 | } 74 | 75 | /** 76 | @} end of sin group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/dspSource/FastMathFunctions/arm_sin_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sin_q31.c 4 | * Description: Fast sine calculation for Q31 values 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup sin 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric sine function for Q31 data. 43 | @param[in] x Scaled input value in radians 44 | @return sin(x) 45 | 46 | The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q31_t arm_sin_q31( 50 | q31_t x) 51 | { 52 | q31_t sinVal; /* Temporary variables for input, output */ 53 | int32_t index; /* Index variable */ 54 | q31_t a, b; /* Two nearest output values */ 55 | q31_t fract; /* Temporary values for fractional values */ 56 | 57 | /* Calculate the nearest index */ 58 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 59 | 60 | /* Calculation of fractional value */ 61 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 62 | 63 | /* Read two nearest values of input value from the sin table */ 64 | a = sinTable_q31[index]; 65 | b = sinTable_q31[index+1]; 66 | 67 | /* Linear interpolation process */ 68 | sinVal = (q63_t) (0x80000000 - fract) * a >> 32; 69 | sinVal = (q31_t) ((((q63_t) sinVal << 32) + ((q63_t) fract * b)) >> 32); 70 | 71 | /* Return output value */ 72 | return (sinVal << 1); 73 | } 74 | 75 | /** 76 | @} end of sin group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_fir_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_init_f32.c 4 | * Description: Floating-point FIR filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point FIR filter. 42 | @param[in,out] S points to an instance of the floating-point FIR filter structure 43 | @param[in] numTaps number of filter coefficients in the filter 44 | @param[in] pCoeffs points to the filter coefficients buffer 45 | @param[in] pState points to the state buffer 46 | @param[in] blockSize number of samples processed per call 47 | @return none 48 | 49 | @par Details 50 | pCoeffs points to the array of filter coefficients stored in time reversed order: 51 |
52 |       {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
53 |   
54 | @par 55 | pState points to the array of state variables. 56 | pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_f32(). 57 | */ 58 | 59 | void arm_fir_init_f32( 60 | arm_fir_instance_f32 * S, 61 | uint16_t numTaps, 62 | const float32_t * pCoeffs, 63 | float32_t * pState, 64 | uint32_t blockSize) 65 | { 66 | /* Assign filter taps */ 67 | S->numTaps = numTaps; 68 | 69 | /* Assign coefficient pointer */ 70 | S->pCoeffs = pCoeffs; 71 | 72 | /* Clear state buffer. The size is always (blockSize + numTaps - 1) */ 73 | memset(pState, 0, (numTaps + (blockSize - 1U)) * sizeof(float32_t)); 74 | 75 | /* Assign state pointer */ 76 | S->pState = pState; 77 | } 78 | 79 | /** 80 | @} end of FIR group 81 | */ 82 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_fir_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_init_q31.c 4 | * Description: Q31 FIR filter initialization function. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 FIR filter. 42 | @param[in,out] S points to an instance of the Q31 FIR filter structure 43 | @param[in] numTaps number of filter coefficients in the filter 44 | @param[in] pCoeffs points to the filter coefficients buffer 45 | @param[in] pState points to the state buffer 46 | @param[in] blockSize number of samples processed 47 | @return none 48 | 49 | @par Details 50 | pCoeffs points to the array of filter coefficients stored in time reversed order: 51 |
52 |       {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
53 |   
54 | pState points to the array of state variables. 55 | pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_q31(). 56 | */ 57 | 58 | void arm_fir_init_q31( 59 | arm_fir_instance_q31 * S, 60 | uint16_t numTaps, 61 | const q31_t * pCoeffs, 62 | q31_t * pState, 63 | uint32_t blockSize) 64 | { 65 | /* Assign filter taps */ 66 | S->numTaps = numTaps; 67 | 68 | /* Assign coefficient pointer */ 69 | S->pCoeffs = pCoeffs; 70 | 71 | /* Clear state buffer. The size is always (blockSize + numTaps - 1) */ 72 | memset(pState, 0, (numTaps + (blockSize - 1U)) * sizeof(q31_t)); 73 | 74 | /* Assign state pointer */ 75 | S->pState = pState; 76 | } 77 | 78 | /** 79 | @} end of FIR group 80 | */ 81 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_fir_init_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_init_q7.c 4 | * Description: Q7 FIR filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q7 FIR filter. 42 | @param[in,out] S points to an instance of the Q7 FIR filter structure 43 | @param[in] numTaps number of filter coefficients in the filter 44 | @param[in] pCoeffs points to the filter coefficients buffer 45 | @param[in] pState points to the state buffer 46 | @param[in] blockSize number of samples processed 47 | @return none 48 | 49 | @par Details 50 | pCoeffs points to the array of filter coefficients stored in time reversed order: 51 |
52 |       {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
53 |   
54 | @par 55 | pState points to the array of state variables. 56 | pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_q7(). 57 | */ 58 | 59 | void arm_fir_init_q7( 60 | arm_fir_instance_q7 * S, 61 | uint16_t numTaps, 62 | const q7_t * pCoeffs, 63 | q7_t * pState, 64 | uint32_t blockSize) 65 | { 66 | /* Assign filter taps */ 67 | S->numTaps = numTaps; 68 | 69 | /* Assign coefficient pointer */ 70 | S->pCoeffs = pCoeffs; 71 | 72 | /* Clear state buffer. The size is always (blockSize + numTaps - 1) */ 73 | memset(pState, 0, (numTaps + (blockSize - 1U)) * sizeof(q7_t)); 74 | 75 | /* Assign state pointer */ 76 | S->pState = pState; 77 | } 78 | 79 | /** 80 | @} end of FIR group 81 | */ 82 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_fir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_f32.c 4 | * Description: Floating-point FIR Lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point FIR lattice filter. 42 | @param[in] S points to an instance of the floating-point FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_f32( 50 | arm_fir_lattice_instance_f32 * S, 51 | uint16_t numStages, 52 | const float32_t * pCoeffs, 53 | float32_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(float32_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_fir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q15.c 4 | * Description: Q15 FIR Lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 FIR lattice filter. 42 | @param[in] S points to an instance of the Q15 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q15( 50 | arm_fir_lattice_instance_q15 * S, 51 | uint16_t numStages, 52 | const q15_t * pCoeffs, 53 | q15_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q15_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_fir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q31.c 4 | * Description: Q31 FIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 FIR lattice filter. 42 | @param[in] S points to an instance of the Q31 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q31( 50 | arm_fir_lattice_instance_q31 * S, 51 | uint16_t numStages, 52 | const q31_t * pCoeffs, 53 | q31_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q31_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_iir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_f32.c 4 | * Description: Floating-point IIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point IIR lattice filter. 42 | @param[in] S points to an instance of the floating-point IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_f32( 52 | arm_iir_lattice_instance_f32 * S, 53 | uint16_t numStages, 54 | float32_t * pkCoeffs, 55 | float32_t * pvCoeffs, 56 | float32_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(float32_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_iir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_q15.c 4 | * Description: Q15 IIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 IIR lattice filter. 42 | @param[in] S points to an instance of the Q15 IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_q15( 52 | arm_iir_lattice_instance_q15 * S, 53 | uint16_t numStages, 54 | q15_t * pkCoeffs, 55 | q15_t * pvCoeffs, 56 | q15_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(q15_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/dspSource/FilteringFunctions/arm_iir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_q31.c 4 | * Description: Initialization function for the Q31 IIR lattice filter 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 IIR lattice filter. 42 | @param[in] S points to an instance of the Q31 IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_q31( 52 | arm_iir_lattice_instance_q31 * S, 53 | uint16_t numStages, 54 | q31_t * pkCoeffs, 55 | q31_t * pvCoeffs, 56 | q31_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(q31_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/dspSource/MatrixFunctions/MatrixFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: MatrixFunctions.c 4 | * Description: Combination of all matrix function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_mat_add_f32.c" 30 | #include "arm_mat_add_q15.c" 31 | #include "arm_mat_add_q31.c" 32 | #include "arm_mat_cmplx_mult_f32.c" 33 | #include "arm_mat_cmplx_mult_q15.c" 34 | #include "arm_mat_cmplx_mult_q31.c" 35 | #include "arm_mat_init_f32.c" 36 | #include "arm_mat_init_q15.c" 37 | #include "arm_mat_init_q31.c" 38 | #include "arm_mat_inverse_f32.c" 39 | #include "arm_mat_inverse_f64.c" 40 | #include "arm_mat_mult_f32.c" 41 | #include "arm_mat_mult_fast_q15.c" 42 | #include "arm_mat_mult_fast_q31.c" 43 | #include "arm_mat_mult_q15.c" 44 | #include "arm_mat_mult_q31.c" 45 | #include "arm_mat_scale_f32.c" 46 | #include "arm_mat_scale_q15.c" 47 | #include "arm_mat_scale_q31.c" 48 | #include "arm_mat_sub_f32.c" 49 | #include "arm_mat_sub_q15.c" 50 | #include "arm_mat_sub_q31.c" 51 | #include "arm_mat_trans_f32.c" 52 | #include "arm_mat_trans_q15.c" 53 | #include "arm_mat_trans_q31.c" 54 | -------------------------------------------------------------------------------- /Libraries/dspSource/MatrixFunctions/arm_mat_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_f32.c 4 | * Description: Floating-point matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | Initializes the underlying matrix data structure. 39 | The functions set the numRows, 40 | numCols, and pData fields 41 | of the matrix data structure. 42 | */ 43 | 44 | /** 45 | @addtogroup MatrixInit 46 | @{ 47 | */ 48 | 49 | /** 50 | @brief Floating-point matrix initialization. 51 | @param[in,out] S points to an instance of the floating-point matrix structure 52 | @param[in] nRows number of rows in the matrix 53 | @param[in] nColumns number of columns in the matrix 54 | @param[in] pData points to the matrix data array 55 | @return none 56 | */ 57 | 58 | void arm_mat_init_f32( 59 | arm_matrix_instance_f32 * S, 60 | uint16_t nRows, 61 | uint16_t nColumns, 62 | float32_t * pData) 63 | { 64 | /* Assign Number of Rows */ 65 | S->numRows = nRows; 66 | 67 | /* Assign Number of Columns */ 68 | S->numCols = nColumns; 69 | 70 | /* Assign Data pointer */ 71 | S->pData = pData; 72 | } 73 | 74 | /** 75 | @} end of MatrixInit group 76 | */ 77 | -------------------------------------------------------------------------------- /Libraries/dspSource/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q15.c 4 | * Description: Q15 matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @addtogroup MatrixInit 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Q15 matrix initialization. 42 | @param[in,out] S points to an instance of the floating-point matrix structure 43 | @param[in] nRows number of rows in the matrix 44 | @param[in] nColumns number of columns in the matrix 45 | @param[in] pData points to the matrix data array 46 | @return none 47 | */ 48 | 49 | void arm_mat_init_q15( 50 | arm_matrix_instance_q15 * S, 51 | uint16_t nRows, 52 | uint16_t nColumns, 53 | q15_t * pData) 54 | { 55 | /* Assign Number of Rows */ 56 | S->numRows = nRows; 57 | 58 | /* Assign Number of Columns */ 59 | S->numCols = nColumns; 60 | 61 | /* Assign Data pointer */ 62 | S->pData = pData; 63 | } 64 | 65 | /** 66 | @} end of MatrixInit group 67 | */ 68 | -------------------------------------------------------------------------------- /Libraries/dspSource/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q31.c 4 | * Description: Q31 matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | */ 39 | 40 | /** 41 | @addtogroup MatrixInit 42 | @{ 43 | */ 44 | 45 | /** 46 | @brief Q31 matrix initialization. 47 | @param[in,out] S points to an instance of the Q31 matrix structure 48 | @param[in] nRows number of rows in the matrix 49 | @param[in] nColumns number of columns in the matrix 50 | @param[in] pData points to the matrix data array 51 | @return none 52 | */ 53 | 54 | void arm_mat_init_q31( 55 | arm_matrix_instance_q31 * S, 56 | uint16_t nRows, 57 | uint16_t nColumns, 58 | q31_t * pData) 59 | { 60 | /* Assign Number of Rows */ 61 | S->numRows = nRows; 62 | 63 | /* Assign Number of Columns */ 64 | S->numCols = nColumns; 65 | 66 | /* Assign Data pointer */ 67 | S->pData = pData; 68 | } 69 | 70 | /** 71 | @} end of MatrixInit group 72 | */ 73 | -------------------------------------------------------------------------------- /Libraries/dspSource/StatisticsFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.6) 2 | 3 | project(CMSISDSPStatistics) 4 | 5 | 6 | file(GLOB SRC "./*_*.c") 7 | 8 | add_library(CMSISDSPStatistics STATIC ${SRC}) 9 | 10 | configdsp(CMSISDSPStatistics ..) 11 | 12 | ### Includes 13 | target_include_directories(CMSISDSPStatistics PUBLIC "${DSP}/../../Include") 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Libraries/dspSource/StatisticsFunctions/StatisticsFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: StatisticsFunctions.c 4 | * Description: Combination of all statistics function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_max_f32.c" 30 | #include "arm_max_q15.c" 31 | #include "arm_max_q31.c" 32 | #include "arm_max_q7.c" 33 | #include "arm_mean_f32.c" 34 | #include "arm_mean_q15.c" 35 | #include "arm_mean_q31.c" 36 | #include "arm_mean_q7.c" 37 | #include "arm_min_f32.c" 38 | #include "arm_min_q15.c" 39 | #include "arm_min_q31.c" 40 | #include "arm_min_q7.c" 41 | #include "arm_power_f32.c" 42 | #include "arm_power_q15.c" 43 | #include "arm_power_q31.c" 44 | #include "arm_power_q7.c" 45 | #include "arm_rms_f32.c" 46 | #include "arm_rms_q15.c" 47 | #include "arm_rms_q31.c" 48 | #include "arm_std_f32.c" 49 | #include "arm_std_q15.c" 50 | #include "arm_std_q31.c" 51 | #include "arm_var_f32.c" 52 | #include "arm_var_q15.c" 53 | #include "arm_var_q31.c" 54 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.6) 2 | 3 | project(CMSISDSPSupport) 4 | 5 | 6 | file(GLOB SRC "./*_*.c") 7 | 8 | add_library(CMSISDSPSupport STATIC ${SRC}) 9 | 10 | configdsp(CMSISDSPSupport ..) 11 | 12 | ### Includes 13 | target_include_directories(CMSISDSPSupport PUBLIC "${DSP}/../../Include") 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/SupportFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: SupportFunctions.c 4 | * Description: Combination of all support function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_copy_f32.c" 30 | #include "arm_copy_q15.c" 31 | #include "arm_copy_q31.c" 32 | #include "arm_copy_q7.c" 33 | #include "arm_fill_f32.c" 34 | #include "arm_fill_q15.c" 35 | #include "arm_fill_q31.c" 36 | #include "arm_fill_q7.c" 37 | #include "arm_float_to_q15.c" 38 | #include "arm_float_to_q31.c" 39 | #include "arm_float_to_q7.c" 40 | #include "arm_q15_to_float.c" 41 | #include "arm_q15_to_q31.c" 42 | #include "arm_q15_to_q7.c" 43 | #include "arm_q31_to_float.c" 44 | #include "arm_q31_to_q15.c" 45 | #include "arm_q31_to_q7.c" 46 | #include "arm_q7_to_float.c" 47 | #include "arm_q7_to_q15.c" 48 | #include "arm_q7_to_q31.c" 49 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/arm_copy_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_copy_q15.c 4 | * Description: Copies the elements of a Q15 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup copy 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Copies the elements of a Q15 vector. 42 | @param[in] pSrc points to input vector 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_copy_q15( 49 | const q15_t * pSrc, 50 | q15_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | 57 | /* Loop unrolling: Compute 4 outputs at a time */ 58 | blkCnt = blockSize >> 2U; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A */ 63 | 64 | /* read 2 times 2 samples at a time */ 65 | write_q15x2_ia (&pDst, read_q15x2_ia ((q15_t **) &pSrc)); 66 | write_q15x2_ia (&pDst, read_q15x2_ia ((q15_t **) &pSrc)); 67 | 68 | /* Decrement loop counter */ 69 | blkCnt--; 70 | } 71 | 72 | /* Loop unrolling: Compute remaining outputs */ 73 | blkCnt = blockSize % 0x4U; 74 | 75 | #else 76 | 77 | /* Initialize blkCnt with number of samples */ 78 | blkCnt = blockSize; 79 | 80 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 81 | 82 | while (blkCnt > 0U) 83 | { 84 | /* C = A */ 85 | 86 | /* Copy and store result in destination buffer */ 87 | *pDst++ = *pSrc++; 88 | 89 | /* Decrement loop counter */ 90 | blkCnt--; 91 | } 92 | } 93 | 94 | /** 95 | @} end of BasicCopy group 96 | */ 97 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/arm_copy_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_copy_q31.c 4 | * Description: Copies the elements of a Q31 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup copy 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Copies the elements of a Q31 vector. 42 | @param[in] pSrc points to input vector 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_copy_q31( 49 | const q31_t * pSrc, 50 | q31_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | 57 | /* Loop unrolling: Compute 4 outputs at a time */ 58 | blkCnt = blockSize >> 2U; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A */ 63 | 64 | /* Copy and store result in destination buffer */ 65 | *pDst++ = *pSrc++; 66 | *pDst++ = *pSrc++; 67 | *pDst++ = *pSrc++; 68 | *pDst++ = *pSrc++; 69 | 70 | /* Decrement loop counter */ 71 | blkCnt--; 72 | } 73 | 74 | /* Loop unrolling: Compute remaining outputs */ 75 | blkCnt = blockSize % 0x4U; 76 | 77 | #else 78 | 79 | /* Initialize blkCnt with number of samples */ 80 | blkCnt = blockSize; 81 | 82 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 83 | 84 | while (blkCnt > 0U) 85 | { 86 | /* C = A */ 87 | 88 | /* Copy and store result in destination buffer */ 89 | *pDst++ = *pSrc++; 90 | 91 | /* Decrement loop counter */ 92 | blkCnt--; 93 | } 94 | } 95 | 96 | /** 97 | @} end of BasicCopy group 98 | */ 99 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/arm_copy_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_copy_q7.c 4 | * Description: Copies the elements of a Q7 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup copy 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Copies the elements of a Q7 vector. 42 | @param[in] pSrc points to input vector 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_copy_q7( 49 | const q7_t * pSrc, 50 | q7_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | 57 | /* Loop unrolling: Compute 4 outputs at a time */ 58 | blkCnt = blockSize >> 2U; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A */ 63 | 64 | /* read 4 samples at a time */ 65 | write_q7x4_ia (&pDst, read_q7x4_ia ((q7_t **) &pSrc)); 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | /* Loop unrolling: Compute remaining outputs */ 72 | blkCnt = blockSize % 0x4U; 73 | 74 | #else 75 | 76 | /* Initialize blkCnt with number of samples */ 77 | blkCnt = blockSize; 78 | 79 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 80 | 81 | while (blkCnt > 0U) 82 | { 83 | /* C = A */ 84 | 85 | /* Copy and store result in destination buffer */ 86 | *pDst++ = *pSrc++; 87 | 88 | /* Decrement loop counter */ 89 | blkCnt--; 90 | } 91 | } 92 | 93 | /** 94 | @} end of BasicCopy group 95 | */ 96 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/arm_fill_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fill_q15.c 4 | * Description: Fills a constant value into a Q15 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Fill 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Fills a constant value into a Q15 vector. 42 | @param[in] value input value to be filled 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_fill_q15( 49 | q15_t value, 50 | q15_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | q31_t packedValue; /* value packed to 32 bits */ 57 | 58 | /* Packing two 16 bit values to 32 bit value in order to use SIMD */ 59 | packedValue = __PKHBT(value, value, 16U); 60 | 61 | /* Loop unrolling: Compute 4 outputs at a time */ 62 | blkCnt = blockSize >> 2U; 63 | 64 | while (blkCnt > 0U) 65 | { 66 | /* C = value */ 67 | 68 | /* fill 2 times 2 samples at a time */ 69 | write_q15x2_ia (&pDst, packedValue); 70 | write_q15x2_ia (&pDst, packedValue); 71 | 72 | /* Decrement loop counter */ 73 | blkCnt--; 74 | } 75 | 76 | /* Loop unrolling: Compute remaining outputs */ 77 | blkCnt = blockSize % 0x4U; 78 | 79 | #else 80 | 81 | /* Initialize blkCnt with number of samples */ 82 | blkCnt = blockSize; 83 | 84 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 85 | 86 | while (blkCnt > 0U) 87 | { 88 | /* C = value */ 89 | 90 | /* Fill value in destination buffer */ 91 | *pDst++ = value; 92 | 93 | /* Decrement loop counter */ 94 | blkCnt--; 95 | } 96 | } 97 | 98 | /** 99 | @} end of Fill group 100 | */ 101 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/arm_fill_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fill_q31.c 4 | * Description: Fills a constant value into a Q31 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Fill 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Fills a constant value into a Q31 vector. 42 | @param[in] value input value to be filled 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_fill_q31( 49 | q31_t value, 50 | q31_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | 57 | /* Loop unrolling: Compute 4 outputs at a time */ 58 | blkCnt = blockSize >> 2U; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = value */ 63 | 64 | /* Fill value in destination buffer */ 65 | *pDst++ = value; 66 | *pDst++ = value; 67 | *pDst++ = value; 68 | *pDst++ = value; 69 | 70 | /* Decrement loop counter */ 71 | blkCnt--; 72 | } 73 | 74 | /* Loop unrolling: Compute remaining outputs */ 75 | blkCnt = blockSize % 0x4U; 76 | 77 | #else 78 | 79 | /* Initialize blkCnt with number of samples */ 80 | blkCnt = blockSize; 81 | 82 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 83 | 84 | while (blkCnt > 0U) 85 | { 86 | /* C = value */ 87 | 88 | /* Fill value in destination buffer */ 89 | *pDst++ = value; 90 | 91 | /* Decrement loop counter */ 92 | blkCnt--; 93 | } 94 | } 95 | 96 | /** 97 | @} end of Fill group 98 | */ 99 | -------------------------------------------------------------------------------- /Libraries/dspSource/SupportFunctions/arm_fill_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fill_q7.c 4 | * Description: Fills a constant value into a Q7 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Fill 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Fills a constant value into a Q7 vector. 42 | @param[in] value input value to be filled 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_fill_q7( 49 | q7_t value, 50 | q7_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | q31_t packedValue; /* value packed to 32 bits */ 57 | 58 | /* Packing four 8 bit values to 32 bit value in order to use SIMD */ 59 | packedValue = __PACKq7(value, value, value, value); 60 | 61 | /* Loop unrolling: Compute 4 outputs at a time */ 62 | blkCnt = blockSize >> 2U; 63 | 64 | while (blkCnt > 0U) 65 | { 66 | /* C = value */ 67 | 68 | /* fill 4 samples at a time */ 69 | write_q7x4_ia (&pDst, packedValue); 70 | 71 | /* Decrement loop counter */ 72 | blkCnt--; 73 | } 74 | 75 | /* Loop unrolling: Compute remaining outputs */ 76 | blkCnt = blockSize % 0x4U; 77 | 78 | #else 79 | 80 | /* Initialize blkCnt with number of samples */ 81 | blkCnt = blockSize; 82 | 83 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 84 | 85 | while (blkCnt > 0U) 86 | { 87 | /* C = value */ 88 | 89 | /* Fill value in destination buffer */ 90 | *pDst++ = value; 91 | 92 | /* Decrement loop counter */ 93 | blkCnt--; 94 | } 95 | } 96 | 97 | /** 98 | @} end of Fill group 99 | */ 100 | -------------------------------------------------------------------------------- /Libraries/dspSource/TransformFunctions/TransformFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: TransformFunctions.c 4 | * Description: Combination of all transform function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_bitreversal.c" 30 | #include "arm_bitreversal2.c" 31 | #include "arm_cfft_f32.c" 32 | #include "arm_cfft_q15.c" 33 | #include "arm_cfft_q31.c" 34 | #include "arm_cfft_radix2_f32.c" 35 | #include "arm_cfft_radix2_init_f32.c" 36 | #include "arm_cfft_radix2_init_q15.c" 37 | #include "arm_cfft_radix2_init_q31.c" 38 | #include "arm_cfft_radix2_q15.c" 39 | #include "arm_cfft_radix2_q31.c" 40 | #include "arm_cfft_radix4_f32.c" 41 | #include "arm_cfft_radix4_init_f32.c" 42 | #include "arm_cfft_radix4_init_q15.c" 43 | #include "arm_cfft_radix4_init_q31.c" 44 | #include "arm_cfft_radix4_q15.c" 45 | #include "arm_cfft_radix4_q31.c" 46 | #include "arm_cfft_radix8_f32.c" 47 | #include "arm_dct4_f32.c" 48 | #include "arm_dct4_init_f32.c" 49 | #include "arm_dct4_init_q15.c" 50 | #include "arm_dct4_init_q31.c" 51 | #include "arm_dct4_q15.c" 52 | #include "arm_dct4_q31.c" 53 | #include "arm_rfft_f32.c" 54 | #include "arm_rfft_fast_f32.c" 55 | #include "arm_rfft_fast_init_f32.c" 56 | #include "arm_rfft_init_f32.c" 57 | #include "arm_rfft_init_q15.c" 58 | #include "arm_rfft_init_q31.c" 59 | #include "arm_rfft_q15.c" 60 | #include "arm_rfft_q31.c" 61 | -------------------------------------------------------------------------------- /Libraries/nncu/aiann/aia_cmsisnn_ext.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/nncu/aiann/aia_cmsisnn_ext.h -------------------------------------------------------------------------------- /Libraries/nncu/cmsis_nn/Include/arm_nn_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS NN Library 3 | * Title: arm_nn_tables.h 4 | * Description: Extern declaration for NN tables 5 | * 6 | * $Date: 17. January 2018 7 | * $Revision: V.1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #ifndef _ARM_NN_TABLES_H 30 | #define _ARM_NN_TABLES_H 31 | 32 | #include "arm_math.h" 33 | 34 | /** 35 | * @brief tables for various activation functions 36 | * 37 | */ 38 | 39 | extern const q15_t sigmoidTable_q15[256]; 40 | extern const q7_t sigmoidTable_q7[256]; 41 | 42 | extern const q7_t tanhTable_q7[256]; 43 | extern const q15_t tanhTable_q15[256]; 44 | 45 | /** 46 | * @brief 2-way tables for various activation functions 47 | * 48 | * 2-way table, H table for value larger than 1/4 49 | * L table for value smaller than 1/4, H table for remaining 50 | * We have this only for the q15_t version. It does not make 51 | * sense to have it for q7_t type 52 | */ 53 | extern const q15_t sigmoidHTable_q15[192]; 54 | extern const q15_t sigmoidLTable_q15[128]; 55 | 56 | extern const q15_t sigmoidLTable_q15[128]; 57 | extern const q15_t sigmoidHTable_q15[192]; 58 | 59 | #endif /* ARM_NN_TABLES_H */ 60 | -------------------------------------------------------------------------------- /Libraries/nncu/cmsis_nn/Source/arm_avepool_q7_HWC_nonsquare.c: -------------------------------------------------------------------------------- 1 | #include "arm_math.h" 2 | #include "arm_nnfunctions.h" 3 | 4 | void arm_avepool_q7_HWC_nonsquare ( 5 | const q7_t * Im_in, // input image 6 | const uint16_t dim_im_in_x, // input image dimension 7 | const uint16_t dim_im_in_y, // input image dimension 8 | const uint16_t ch_im_in, // number of input image channels 9 | const uint16_t dim_kernel_x, // window kernel size 10 | const uint16_t dim_kernel_y, // window kernel size 11 | const uint16_t padding_x, // padding sizes 12 | const uint16_t padding_y, // padding sizes 13 | const uint16_t stride_x, // stride 14 | const uint16_t stride_y, // stride 15 | const uint16_t dim_im_out_x, // output image dimension 16 | const uint16_t dim_im_out_y, // output image dimension 17 | q7_t * bufferA, // a buffer for local storage 18 | q7_t * Im_out, // output feature 19 | const uint16_t out_lshift) // output left shift (scaling) 20 | { 21 | int16_t i_ch_in, i_x, i_y; 22 | int16_t k_x, k_y; 23 | 24 | for(i_ch_in=0;i_ch_in= 0 && k_x >= 0 && k_y> shift_size)]; 84 | *pOut++ = out; 85 | i--; 86 | } 87 | } 88 | 89 | /** 90 | * @} end of Acti group 91 | */ 92 | -------------------------------------------------------------------------------- /Libraries/nncu/cmsis_nn/Source/arm_relu_q15.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_relu_q15.c 22 | * Description: Q15 version of ReLU 23 | * 24 | * $Date: 17. January 2018 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "arm_math.h" 32 | #include "arm_nnfunctions.h" 33 | 34 | /** 35 | * @ingroup groupNN 36 | */ 37 | 38 | /** 39 | * @addtogroup Acti 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @brief Q15 RELU function 45 | * @param[in,out] data pointer to input 46 | * @param[in] size number of elements 47 | * @return none. 48 | * 49 | * @details 50 | * 51 | * Optimized relu with QSUB instructions. 52 | * 53 | */ 54 | 55 | void arm_relu_q15(q15_t * data, uint32_t size) 56 | { 57 | 58 | #if defined (ARM_MATH_DSP) 59 | /* Run the following code for Cortex-M4 and Cortex-M7 */ 60 | 61 | uint32_t i = size >> 1; 62 | q15_t *pIn = data; 63 | q15_t *pOut = data; 64 | q31_t in; 65 | q31_t buf; 66 | q31_t mask; 67 | 68 | while (i) 69 | { 70 | in = *__SIMD32(pIn)++; 71 | 72 | /* extract the first bit */ 73 | buf = __ROR(in & 0x80008000, 15); 74 | 75 | /* if MSB=1, mask will be 0xFF, 0x0 otherwise */ 76 | mask = __QSUB16(0x00000000, buf); 77 | 78 | *__SIMD32(pOut)++ = in & (~mask); 79 | i--; 80 | } 81 | 82 | if (size & 0x1) 83 | { 84 | if (*pIn < 0) 85 | { 86 | *pIn = 0; 87 | } 88 | pIn++; 89 | } 90 | #else 91 | /* Run the following code as reference implementation for Cortex-M0 and Cortex-M3 */ 92 | uint32_t i; 93 | 94 | for (i = 0; i < size; i++) 95 | { 96 | if (data[i] < 0) 97 | data[i] = 0; 98 | } 99 | 100 | #endif /* ARM_MATH_DSP */ 101 | 102 | } 103 | 104 | /** 105 | * @} end of Acti group 106 | */ 107 | -------------------------------------------------------------------------------- /Libraries/nncu/cmsis_nn/Source/arm_relu_q7.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /* ---------------------------------------------------------------------- 20 | * Project: CMSIS NN Library 21 | * Title: arm_relu_q7.c 22 | * Description: Q7 version of ReLU 23 | * 24 | * $Date: 17. January 2018 25 | * $Revision: V.1.0.0 26 | * 27 | * Target Processor: Cortex-M cores 28 | * 29 | * -------------------------------------------------------------------- */ 30 | 31 | #include "arm_math.h" 32 | #include "arm_nnfunctions.h" 33 | 34 | /** 35 | * @ingroup groupNN 36 | */ 37 | 38 | /** 39 | * @addtogroup Acti 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @brief Q7 RELU function 45 | * @param[in,out] data pointer to input 46 | * @param[in] size number of elements 47 | * @return none. 48 | * 49 | * @details 50 | * 51 | * Optimized relu with QSUB instructions. 52 | * 53 | */ 54 | 55 | void arm_relu_q7(q7_t * data, int32_t size) 56 | { 57 | 58 | #if defined (ARM_MATH_DSP) 59 | /* Run the following code for Cortex-M4 and Cortex-M7 */ 60 | 61 | int32_t i = size >> 2; 62 | q7_t *pIn = data; 63 | q7_t *pOut = data; 64 | q31_t in; 65 | q31_t buf; 66 | q31_t mask; 67 | 68 | while (i) 69 | { 70 | in = *__SIMD32(pIn)++; 71 | 72 | /* extract the first bit */ 73 | buf = __ROR(in & 0x80808080, 7); 74 | 75 | /* if MSB=1, mask will be 0xFF, 0x0 otherwise */ 76 | mask = __QSUB8(0x00000000, buf); 77 | 78 | *__SIMD32(pOut)++ = in & (~mask); 79 | i--; 80 | } 81 | 82 | i = size & 0x3; 83 | while (i) 84 | { 85 | if (*pIn < 0) 86 | { 87 | *pIn = 0; 88 | } 89 | pIn++; 90 | i--; 91 | } 92 | 93 | #else 94 | /* Run the following code as reference implementation for Cortex-M0 and Cortex-M3 */ 95 | 96 | int32_t i; 97 | 98 | for (i = 0; i < size; i++) 99 | { 100 | if (data[i] < 0) 101 | data[i] = 0; 102 | } 103 | 104 | #endif /* ARM_MATH_DSP */ 105 | 106 | } 107 | 108 | /** 109 | * @} end of Acti group 110 | */ 111 | -------------------------------------------------------------------------------- /Libraries/nncu/nncie_imxrt10x0.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/nncu/nncie_imxrt10x0.lib -------------------------------------------------------------------------------- /Libraries/nncu/nncie_port_nxpsdk.c: -------------------------------------------------------------------------------- 1 | #include "nncie.h" 2 | #include 3 | 4 | __WEAK void *CIPort_Malloc(size_t size) { 5 | void *pv = malloc(size); 6 | if (pv) 7 | return pv; 8 | abort(); 9 | } 10 | 11 | __WEAK void CIPort_Free(void *p) { free(p); } 12 | 13 | __WEAK int CIPort_DefaultReadData(uint32_t modelHandle, 14 | const CI_UserModelHeader *p, uint32_t ofs, 15 | size_t bytes, void *pvBuf) { 16 | return 0; 17 | } 18 | 19 | volatile int s_criticalNest, s_primask; 20 | __WEAK int CIPort_EnterCritical(void) { 21 | int nest; 22 | int primask = __get_PRIMASK(); 23 | __set_PRIMASK(1); 24 | nest = s_criticalNest++; 25 | if (nest == 0) { 26 | s_primask = primask; 27 | } 28 | return nest; 29 | } 30 | 31 | __WEAK int CIPort_LeaveCritical(void) { 32 | if (s_criticalNest == 0) 33 | return -1L; 34 | int nest = --s_criticalNest; 35 | if (0 == nest) { 36 | __set_PRIMASK(s_primask); 37 | } 38 | return nest; 39 | } 40 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.3 5 | * @date 24. June 2019 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 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, WITHOUT 20 | * 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 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 3U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 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, WITHOUT 20 | * 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 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/components/serial_manager/serial_port_swo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 NXP 3 | * All rights reserved. 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #ifndef __SERIAL_PORT_SWO_H__ 9 | #define __SERIAL_PORT_SWO_H__ 10 | 11 | /*! 12 | * @addtogroup serial_port_swo 13 | * @{ 14 | */ 15 | 16 | /******************************************************************************* 17 | * Definitions 18 | ******************************************************************************/ 19 | /*! @brief serial port swo handle size*/ 20 | #define SERIAL_PORT_SWO_HANDLE_SIZE (12U) 21 | 22 | /*! @brief serial port swo protocol*/ 23 | typedef enum _serial_port_swo_protocol 24 | { 25 | kSerialManager_SwoProtocolManchester = 1U, /*!< SWO Manchester protocol */ 26 | kSerialManager_SwoProtocolNrz = 2U, /*!< SWO UART/NRZ protocol */ 27 | } serial_port_swo_protocol_t; 28 | 29 | /*! @brief serial port swo config struct*/ 30 | typedef struct _serial_port_swo_config 31 | { 32 | uint32_t clockRate; /*!< clock rate */ 33 | uint32_t baudRate; /*!< baud rate */ 34 | uint32_t port; /*!< Port used to transfer data */ 35 | serial_port_swo_protocol_t protocol; /*!< SWO protocol */ 36 | } serial_port_swo_config_t; 37 | /*! @} */ 38 | #endif /* __SERIAL_PORT_SWO_H__ */ 39 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/components/serial_manager/serial_port_uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 NXP 3 | * All rights reserved. 4 | * 5 | * 6 | * SPDX-License-Identifier: BSD-3-Clause 7 | */ 8 | 9 | #ifndef __SERIAL_PORT_UART_H__ 10 | #define __SERIAL_PORT_UART_H__ 11 | 12 | #include "uart.h" 13 | 14 | /*! 15 | * @addtogroup serial_port_uart 16 | * @{ 17 | */ 18 | 19 | /******************************************************************************* 20 | * Definitions 21 | ******************************************************************************/ 22 | /*! @brief serial port uart handle size*/ 23 | #if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) 24 | #define SERIAL_PORT_UART_HANDLE_SIZE (76U + HAL_UART_HANDLE_SIZE) 25 | #else 26 | #define SERIAL_PORT_UART_HANDLE_SIZE (HAL_UART_HANDLE_SIZE) 27 | #endif 28 | 29 | /*! @brief serial port uart parity mode*/ 30 | typedef enum _serial_port_uart_parity_mode 31 | { 32 | kSerialManager_UartParityDisabled = 0x0U, /*!< Parity disabled */ 33 | kSerialManager_UartParityEven = 0x1U, /*!< Parity even enabled */ 34 | kSerialManager_UartParityOdd = 0x2U, /*!< Parity odd enabled */ 35 | } serial_port_uart_parity_mode_t; 36 | 37 | /*! @brief serial port uart stop bit count*/ 38 | typedef enum _serial_port_uart_stop_bit_count 39 | { 40 | kSerialManager_UartOneStopBit = 0U, /*!< One stop bit */ 41 | kSerialManager_UartTwoStopBit = 1U, /*!< Two stop bits */ 42 | } serial_port_uart_stop_bit_count_t; 43 | 44 | /*! @brief serial port uart config struct*/ 45 | typedef struct _serial_port_uart_config 46 | { 47 | uint32_t clockRate; /*!< clock rate */ 48 | uint32_t baudRate; /*!< baud rate */ 49 | serial_port_uart_parity_mode_t parityMode; /*!< Parity mode, disabled (default), even, odd */ 50 | serial_port_uart_stop_bit_count_t stopBitCount; /*!< Number of stop bits, 1 stop bit (default) or 2 stop bits */ 51 | uint8_t instance; /*!< Instance (0 - UART0, 1 - UART1, ...), detail information 52 | please refer to the SOC corresponding RM. */ 53 | uint8_t enableRx; /*!< Enable RX */ 54 | uint8_t enableTx; /*!< Enable TX */ 55 | } serial_port_uart_config_t; 56 | /*! @} */ 57 | #endif /* __SERIAL_PORT_UART_H__ */ 58 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/deceive/fsl_device_registers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 Freescale Semiconductor, Inc. 3 | * Copyright 2016-2019 NXP 4 | * All rights reserved. 5 | * 6 | * SPDX-License-Identifier: BSD-3-Clause 7 | * 8 | */ 9 | 10 | #ifndef __FSL_DEVICE_REGISTERS_H__ 11 | #define __FSL_DEVICE_REGISTERS_H__ 12 | 13 | /* 14 | * Include the cpu specific register header files. 15 | * 16 | * The CPU macro should be declared in the project or makefile. 17 | */ 18 | #if (defined(CPU_MIMXRT1064CVJ5A) || defined(CPU_MIMXRT1064CVL5A) || defined(CPU_MIMXRT1064DVJ6A) || \ 19 | defined(CPU_MIMXRT1064DVL6A)) 20 | 21 | #define MIMXRT1064_SERIES 22 | 23 | /* CMSIS-style register definitions */ 24 | #include "MIMXRT1064.h" 25 | /* CPU specific feature definitions */ 26 | #include "MIMXRT1064_features.h" 27 | 28 | #else 29 | #error "No valid CPU defined!" 30 | #endif 31 | 32 | #endif /* __FSL_DEVICE_REGISTERS_H__ */ 33 | 34 | /******************************************************************************* 35 | * EOF 36 | ******************************************************************************/ 37 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/deceive/system_MIMXRT1064.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/nxp_libraries/deceive/system_MIMXRT1064.c -------------------------------------------------------------------------------- /Libraries/nxp_libraries/drives/fsl_src.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * SPDX-License-Identifier: BSD-3-Clause 7 | */ 8 | 9 | #include "fsl_src.h" 10 | 11 | /* Component ID definition, used by tools. */ 12 | #ifndef FSL_COMPONENT_ID 13 | #define FSL_COMPONENT_ID "platform.drivers.src" 14 | #endif 15 | 16 | /******************************************************************************* 17 | * Prototypes 18 | ******************************************************************************/ 19 | 20 | /******************************************************************************* 21 | * Variables 22 | ******************************************************************************/ 23 | 24 | /******************************************************************************* 25 | * Code 26 | ******************************************************************************/ 27 | 28 | /*! 29 | * brief Clear the status flags of SRC. 30 | * 31 | * param base SRC peripheral base address. 32 | * param Mask value of status flags to be cleared, see to #_src_reset_status_flags. 33 | */ 34 | void SRC_ClearResetStatusFlags(SRC_Type *base, uint32_t flags) 35 | { 36 | uint32_t tmp32 = base->SRSR; 37 | 38 | if (0U != (SRC_SRSR_TSR_MASK & flags)) 39 | { 40 | tmp32 &= ~SRC_SRSR_TSR_MASK; /* Write 0 to clear. */ 41 | } 42 | 43 | if (0U != (SRC_SRSR_W1C_BITS_MASK & flags)) 44 | { 45 | tmp32 |= (SRC_SRSR_W1C_BITS_MASK & flags); /* Write 1 to clear. */ 46 | } 47 | 48 | base->SRSR = tmp32; 49 | } 50 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/startup/MDK-ARM/startup_MIMXRT1064.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/nxp_libraries/startup/MDK-ARM/startup_MIMXRT1064.s -------------------------------------------------------------------------------- /Libraries/nxp_libraries/utilities/fsl_assert.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * 7 | * SPDX-License-Identifier: BSD-3-Clause 8 | */ 9 | 10 | #include "fsl_common.h" 11 | #include "fsl_debug_console.h" 12 | 13 | #ifndef NDEBUG 14 | #if (defined(__CC_ARM)) || (defined(__ARMCC_VERSION)) || (defined(__ICCARM__)) 15 | void __aeabi_assert(const char *failedExpr, const char *file, int line) 16 | { 17 | PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" \n", failedExpr, file, line); 18 | for (;;) 19 | { 20 | __BKPT(0); 21 | } 22 | } 23 | #elif (defined(__GNUC__)) 24 | #if defined(__REDLIB__) 25 | void __assertion_failed(char *failedExpr) 26 | { 27 | PRINTF("ASSERT ERROR \" %s \n", failedExpr); 28 | for (;;) 29 | { 30 | __BKPT(0); 31 | } 32 | } 33 | #else 34 | void __assert_func(const char *file, int line, const char *func, const char *failedExpr) 35 | { 36 | PRINTF("ASSERT ERROR \" %s \": file \"%s\" Line \"%d\" function name \"%s\" \n", failedExpr, file, line, func); 37 | for (;;) 38 | { 39 | __BKPT(0); 40 | } 41 | } 42 | #endif /* defined(__REDLIB__) */ 43 | #endif /* (defined(__CC_ARM) || (defined(__ICCARM__)) || (defined(__ARMCC_VERSION)) */ 44 | #endif /* NDEBUG */ 45 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/utilities/fsl_sbrk.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2019 NXP 4 | * All rights reserved. 5 | * 6 | * SPDX-License-Identifier: BSD-3-Clause 7 | */ 8 | #if defined(__GNUC__) 9 | #include 10 | #include 11 | #endif 12 | 13 | #if defined(__GNUC__) 14 | /*! 15 | * @brief Function to override ARMGCC default function _sbrk 16 | * 17 | * _sbrk is called by malloc. ARMGCC default _sbrk compares "SP" register and 18 | * heap end, if heap end is larger than "SP", then _sbrk returns error and 19 | * memory allocation failed. This function changes to compare __HeapLimit with 20 | * heap end. 21 | */ 22 | caddr_t _sbrk(int incr); 23 | caddr_t _sbrk(int incr) 24 | { 25 | extern char end __asm("end"); 26 | extern char heap_limit __asm("__HeapLimit"); 27 | static char *heap_end; 28 | char *prev_heap_end; 29 | caddr_t ret; 30 | 31 | if (heap_end == NULL) 32 | { 33 | heap_end = &end; 34 | } 35 | 36 | prev_heap_end = heap_end; 37 | 38 | if ((unsigned int)heap_end + (unsigned int)incr > (unsigned int)(&heap_limit)) 39 | { 40 | errno = ENOMEM; 41 | 42 | ret = (caddr_t)-1; 43 | } 44 | else 45 | { 46 | heap_end = (char *)((unsigned int)heap_end + (unsigned int)incr); 47 | 48 | ret = (caddr_t)prev_heap_end; 49 | } 50 | 51 | return ret; 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/utilities/str/fsl_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 NXP 3 | * All rights reserved. 4 | * 5 | * 6 | * SPDX-License-Identifier: BSD-3-Clause 7 | * 8 | */ 9 | 10 | #ifndef _FSL_STR_H 11 | #define _FSL_STR_H 12 | 13 | #include "fsl_common.h" 14 | 15 | /*! 16 | * @addtogroup debugconsole 17 | * @{ 18 | */ 19 | 20 | /******************************************************************************* 21 | * Prototypes 22 | ******************************************************************************/ 23 | #if defined(__cplusplus) 24 | extern "C" { 25 | #endif /* __cplusplus */ 26 | 27 | /*! 28 | * @brief A function pointer which is used when format printf log. 29 | */ 30 | typedef void (*printfCb)(char *buf, int32_t *indicator, char val, int len); 31 | 32 | /*! 33 | * @brief This function outputs its parameters according to a formatted string. 34 | * 35 | * @note I/O is performed by calling given function pointer using following 36 | * (*func_ptr)(c); 37 | * 38 | * @param[in] fmt Format string for printf. 39 | * @param[in] ap Arguments to printf. 40 | * @param[in] buf pointer to the buffer 41 | * @param cb print callbck function pointer 42 | * 43 | * @return Number of characters to be print 44 | */ 45 | int StrFormatPrintf(const char *fmt, va_list ap, char *buf, printfCb cb); 46 | 47 | /*! 48 | * @brief Converts an input line of ASCII characters based upon a provided 49 | * string format. 50 | * 51 | * @param[in] line_ptr The input line of ASCII data. 52 | * @param[in] format Format first points to the format string. 53 | * @param[in] args_ptr The list of parameters. 54 | * 55 | * @return Number of input items converted and assigned. 56 | * @retval IO_EOF When line_ptr is empty string "". 57 | */ 58 | int StrFormatScanf(const char *line_ptr, char *format, va_list args_ptr); 59 | 60 | #if defined(__cplusplus) 61 | } 62 | #endif /* __cplusplus */ 63 | 64 | /*! @} */ 65 | 66 | #endif /* _FSL_STR_H */ 67 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/xip/evkmimxrt1064_flexspi_nor_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 NXP 3 | * All rights reserved. 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #include "evkmimxrt1064_flexspi_nor_config.h" 9 | 10 | /******************************************************************************* 11 | * Code 12 | ******************************************************************************/ 13 | #if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) 14 | #if defined(__CC_ARM) || defined(__GNUC__) 15 | __attribute__((section(".boot_hdr.conf"))) 16 | #elif defined(__ICCARM__) 17 | #pragma location = ".boot_hdr.conf" 18 | #endif 19 | 20 | const flexspi_nor_config_t qspiflash_config = { 21 | .memConfig = 22 | { 23 | .tag = FLEXSPI_CFG_BLK_TAG, 24 | .version = FLEXSPI_CFG_BLK_VERSION, 25 | .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, 26 | .csHoldTime = 3u, 27 | .csSetupTime = 3u, 28 | // Enable DDR mode, Wordaddassable, Safe configuration, Differential clock 29 | .sflashPadType = kSerialFlash_4Pads, 30 | .serialClkFreq = kFlexSpiSerialClk_133MHz, 31 | .sflashA1Size = 4u * 1024u * 1024u, 32 | .lookupTable = 33 | { 34 | // Read LUTs 35 | FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18), 36 | FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04), 37 | }, 38 | }, 39 | .pageSize = 256u, 40 | .sectorSize = 4u * 1024u, 41 | .blockSize = 64u * 1024u, 42 | .isUniformBlockSize = false, 43 | }; 44 | #endif /* XIP_BOOT_HEADER_ENABLE */ 45 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/xip/evkmimxrt1064_sdram_ini_dcd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 NXP 3 | * All rights reserved. 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | /*********************************************************************************************************************** 9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file 10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. 11 | **********************************************************************************************************************/ 12 | 13 | #ifndef __EVKMIMXRT1064_SDRAM_INI_DCD__ 14 | #define __EVKMIMXRT1064_SDRAM_INI_DCD__ 15 | 16 | #include 17 | 18 | /*! @name Driver version */ 19 | /*@{*/ 20 | /*! @brief XIP_BOARD driver version 2.0.0. */ 21 | #define FSL_XIP_BOARD_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) 22 | /*@}*/ 23 | 24 | /************************************* 25 | * DCD Data 26 | *************************************/ 27 | #define DCD_TAG_HEADER (0xD2) 28 | #define DCD_VERSION (0x41) 29 | #define DCD_TAG_HEADER_SHIFT (24) 30 | #define DCD_ARRAY_SIZE 1 31 | 32 | #endif /* __EVKMIMXRT1064_SDRAM_INI_DCD__ */ 33 | -------------------------------------------------------------------------------- /Libraries/nxp_libraries/xip/fsl_flexspi_nor_boot.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 NXP 3 | * All rights reserved. 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #include "fsl_flexspi_nor_boot.h" 9 | 10 | /* Component ID definition, used by tools. */ 11 | #ifndef FSL_COMPONENT_ID 12 | #define FSL_COMPONENT_ID "platform.drivers.xip_device" 13 | #endif 14 | 15 | #if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) 16 | #if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) 17 | __attribute__((section(".boot_hdr.ivt"))) 18 | #elif defined(__ICCARM__) 19 | #pragma location=".boot_hdr.ivt" 20 | #endif 21 | /************************************* 22 | * IVT Data 23 | *************************************/ 24 | const ivt image_vector_table = { 25 | IVT_HEADER, /* IVT Header */ 26 | IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ 27 | IVT_RSVD, /* Reserved = 0 */ 28 | (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ 29 | (uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */ 30 | (uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */ 31 | (uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */ 32 | IVT_RSVD /* Reserved = 0 */ 33 | }; 34 | 35 | #if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) 36 | __attribute__((section(".boot_hdr.boot_data"))) 37 | #elif defined(__ICCARM__) 38 | #pragma location=".boot_hdr.boot_data" 39 | #endif 40 | /************************************* 41 | * Boot Data 42 | *************************************/ 43 | const BOOT_DATA_T boot_data = { 44 | FLASH_BASE, /* boot start location */ 45 | FLASH_SIZE, /* size */ 46 | PLUGIN_FLAG, /* Plugin flag*/ 47 | 0xFFFFFFFF /* empty - extra data word */ 48 | }; 49 | #endif 50 | 51 | 52 | -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/common/common.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/common/common.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/common/common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/common/common.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/headfile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/headfile.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_flash.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_flash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_flash.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_gpio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_gpio.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_gpio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_gpio.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_iomuxc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_iomuxc.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_iomuxc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_iomuxc.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_pit.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_pit.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_pit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_pit.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_pwm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_pwm.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_pwm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_pwm.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_qtimer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_qtimer.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_rom_api.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_rom_api.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_rom_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_rom_api.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_spi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_spi.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_spi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_spi.h -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_systick.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_systick.c -------------------------------------------------------------------------------- /Libraries/seekfree_libraries/zf_systick.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_libraries/zf_systick.h -------------------------------------------------------------------------------- /Libraries/seekfree_peripheral/SEEKFREE_FUN.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_peripheral/SEEKFREE_FUN.c -------------------------------------------------------------------------------- /Libraries/seekfree_peripheral/SEEKFREE_FUN.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_peripheral/SEEKFREE_FUN.h -------------------------------------------------------------------------------- /Libraries/seekfree_peripheral/SEEKFREE_IIC.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_peripheral/SEEKFREE_IIC.c -------------------------------------------------------------------------------- /Libraries/seekfree_peripheral/SEEKFREE_IIC.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_peripheral/SEEKFREE_IIC.h -------------------------------------------------------------------------------- /Libraries/seekfree_peripheral/SEEKFREE_VIRSCO.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_peripheral/SEEKFREE_VIRSCO.c -------------------------------------------------------------------------------- /Libraries/seekfree_peripheral/SEEKFREE_VIRSCO.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Libraries/seekfree_peripheral/SEEKFREE_VIRSCO.h -------------------------------------------------------------------------------- /Pictures/IMG_20200511_130902.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_130902.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_130913.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_130913.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_130925.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_130925.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_130935.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_130935.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_131000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_131000.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_131010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_131010.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_131032.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_131032.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_131054.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_131054.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_131122.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_131122.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_131148.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_131148.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_164132.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_164132.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_205727.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_205727.jpg -------------------------------------------------------------------------------- /Pictures/IMG_20200511_210009.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/IMG_20200511_210009.jpg -------------------------------------------------------------------------------- /Pictures/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/config.png -------------------------------------------------------------------------------- /Pictures/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/print.png -------------------------------------------------------------------------------- /Pictures/uper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Pictures/uper.png -------------------------------------------------------------------------------- /Project/CODE/README.md: -------------------------------------------------------------------------------- 1 | 智能车主控代码 2 | ========== 3 | | 文件夹 | 说明 | 4 | | - | - | 5 | | ai | 调用NNCU控制舵机| 6 | | bsp | 与主板相关的硬件| 7 | | car | 全局变量 *Car* | 8 | | control | 车速与方向控制| 9 | | gui | OLED与按键交互| 10 | | utility | 平台无关设施| 11 | # 中文编码 12 | 只有 *car/car_config.h*, *gui/gui.cpp*, *gui/gui.hpp* 三个文件是 **GB2312**,其余文件均为 **UTF-8**. 13 | 14 | 用`写字库.c`替换逐飞Flash例程,将中文字库加载到片上Flash。 15 | # TODO 16 | > 屏幕、串口、ADC改成DMA… 17 | 18 | **car_config.h**一定要按格式写!! 19 | 20 | *注意:* **Car** 全局只有一个!!! 21 | 22 | 原则上全局变量都放Car里。 23 | https://github.com/dachunfree/kernel/blob/master/kernel_xilinx_v4.4/drivers/hwmon/ads8028.c 24 | # 资源分配 25 | **GPT1** 给逐飞systick用。 26 | **GPT2** 给软件定时器用。 27 | 28 | 中文字库用倒数45个flash扇区; 29 | 倒数第46个扇区存调试参数 30 | # 说明书 31 | [doxygen文档](https://github.com/CSU-iMag/ArtificialIntelligenceCar/blob/master/Libraries/doc/html.zip) 32 | -------------------------------------------------------------------------------- /Project/CODE/ai/deep.cpp: -------------------------------------------------------------------------------- 1 | #include "deep.hpp" 2 | #include "car.hpp" 3 | #include "communication.hpp" 4 | #include "nncie.h" 5 | #include "util.h" 6 | 7 | static int8_t cie_data[7]; 8 | static ModelInfo_t info; 9 | static const CI_OutMetricInfo *pOM; 10 | 11 | void deep_init() { 12 | pOM = CI_GetOutMetricInfo(0); 13 | CI_GetModelInfoXIP(Car.Model, &info); 14 | com_log(info.pszString); 15 | // DEBUG_LOG("model info: %d , %s\n", info.quantBits, info.pszString); 16 | } 17 | 18 | __STATIC_INLINE void GetData() { 19 | for (int i(0); i < ARRAY_SIZE(MagForDeep); ++i) 20 | cie_data[i] = Car.MagList[MagForDeep[i]].GetNormalized() - 128; 21 | } 22 | 23 | float deep_predict() { 24 | GetData(); 25 | int16_t g_servoValue; 26 | CI_RunModelXIP(Car.Model, cie_data, &g_servoValue); // 调用模型计算转角 27 | 28 | // 根据获取到的模型参数对计算结果进行右移位 29 | if (info.quantBits > 7) 30 | g_servoValue >>= (info.quantBits - pOM->fracBits - 1); 31 | 32 | return RESCALE_VALUE((float)g_servoValue, STEER_MAX - STEER_MIN, 255) + 33 | STEER_CENTER; 34 | } 35 | -------------------------------------------------------------------------------- /Project/CODE/ai/deep.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEEP_H 2 | #define DEEP_H 3 | 4 | extern "C" const unsigned char model1[]; 5 | extern "C" const unsigned char model2[]; 6 | extern "C" const unsigned char model3[]; 7 | 8 | void deep_init(); 9 | float deep_predict(); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /Project/CODE/bsp/MCP4452.c: -------------------------------------------------------------------------------- 1 | /** @file MCP4452 2 | * @author burst-bao 3 | * @brief Microchip digital resistance driver. 4 | */ 5 | #include "MCP4452.h" 6 | #include "SEEKFREE_IIC.h" //模拟I2C 7 | #include "util.h" 8 | #include "zf_systick.h" 9 | 10 | // 返回0,电阻无误;返回1,电阻1错误;返回2,电阻2错误;返回3,都错误 11 | uint8 MCP4452_self_check(void) { 12 | uint8 i = 0; 13 | MCP4452_set_4on(Res1234); 14 | if ((0x01FF != simiic_read_reg2(Res1234, TCON_0_R, SIMIIC)) && 15 | (0x01FF != simiic_read_reg2(Res1234, TCON_1_R, SIMIIC))) 16 | i++; 17 | return i; //自检无误 18 | } 19 | 20 | // 设置电阻开/关 21 | // MCP4452_ADDR:四路电位器地址. 22 | // sel: TCON_x_W 选择TCON registers寄存器. 23 | // mode: 设置该路电阻模式 24 | // R1R0_ALL_ON/OFF; R3R2_ALL_ON/OFF 25 | // MCP4452_set_mode(Res1234, TCON_0_W, R0_OFF); 26 | void MCP4452_set_mode(uint8 MCP4452_ADDR, uint8 sel, Res_enum mode) { 27 | simiic_write_reg(MCP4452_ADDR, sel, mode); 28 | } 29 | 30 | void MCP4452_set_4on(uint8 MCP4452_ADDR) { 31 | simiic_write_reg(MCP4452_ADDR, TCON_0_W, R1R0_ALL_ON); //电阻0.1打开 32 | simiic_write_reg(MCP4452_ADDR, TCON_1_W, R3R2_ALL_ON); //电阻3.2打开 33 | } 34 | 35 | void mcp_init(void) { 36 | MCP4452_set_4on(MCP4452_ADDR_0); 37 | // MCP4452_set_4on(MCP4452_ADDR_1); 38 | // MCP4452_set_4on(MCP4452_ADDR_2); 39 | 40 | simiic_write_reg(MCP4452_ADDR_0, MCP4452_R1, 0xff); // 车身右 41 | simiic_write_reg(MCP4452_ADDR_0, MCP4452_R2, 0x00); // 车头右横 42 | simiic_write_reg(MCP4452_ADDR_0, MCP4452_R3, 0x00); // 车头中间 43 | simiic_write_reg(MCP4452_ADDR_0, MCP4452_R4, 0x00); // 车头最右 44 | // simiic_write_reg(MCP4452_ADDR_1, MCP4452_R1, 0x00); // 车头左横 45 | // simiic_write_reg(MCP4452_ADDR_1, MCP4452_R2, 0x00); // 车身左 46 | // simiic_write_reg(MCP4452_ADDR_1, MCP4452_R3, 0x00); // 车头最左边 47 | // simiic_write_reg(MCP4452_ADDR_1, MCP4452_R4, 0xff); // 前瞻中 48 | // simiic_write_reg(MCP4452_ADDR_2, MCP4452_R1, 0xff); // 前瞻右 49 | // simiic_write_reg(MCP4452_ADDR_2, MCP4452_R2, 0x60); // 车头右竖 50 | // simiic_write_reg(MCP4452_ADDR_2, MCP4452_R3, 0x00); // 前瞻左 51 | // simiic_write_reg(MCP4452_ADDR_2, MCP4452_R4, 0xff); // 车头左竖 52 | } 53 | -------------------------------------------------------------------------------- /Project/CODE/bsp/RT106X_config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/bsp/RT106X_config.h -------------------------------------------------------------------------------- /Project/CODE/bsp/bat.cpp: -------------------------------------------------------------------------------- 1 | #include "bat.hpp" 2 | #include "filter.hpp" 3 | #include "fsl_tempmon.h" 4 | #include "gui.hpp" 5 | #include "peripherals.h" 6 | #include "timer.hpp" 7 | #include "usage.hpp" 8 | #include "util.h" 9 | 10 | 11 | static void bat_schedule(sched_event_data_t dat) { 12 | ADC_SetChannelConfig(BAT_PERIPHERAL, 0U, 13 | (adc_channel_config_t *)&BAT_channels_config); 14 | 15 | gui_control.UpdateValue(5, std::to_string(cpu_usage_get())); 16 | gui_control.UpdateValue( 17 | 6, std::to_string(TEMPMON_GetCurrentTemperature(TEMPMON))); 18 | } 19 | 20 | static SoftTimer bat_tim(bat_schedule); 21 | 22 | void bat_init() { 23 | bat_tim.Start(999); 24 | } 25 | 26 | extern "C" void BAT_IRQHANDLER(void) { 27 | uint32_t bat_val = ADC_GetChannelConversionValue(BAT_PERIPHERAL, 0U); 28 | CAR_ERROR_CHECK(bat_val < (1 << 13)); // 12bit ADC 29 | 30 | // static filter_movAve_t filter_battery(3); 31 | // bat_val = filter_battery.Moving(bat_val); 32 | bat_val = battery_level_in_percent(ADC12b_TO_mV(bat_val)); 33 | // CAR_ERROR_CHECK(bat_val != lim(bat_val, 3, 9)); 34 | 35 | gui_background.UpdateValue(bat_val); 36 | gui_control.UpdateValue(4, std::to_string(bat_val)); 37 | gui_control.battery_curve.AppendValue(bat_val); 38 | // gui_debug.UpdateValue(1, "Enabled:" + std::to_string(Car.Enabled)); 39 | } 40 | -------------------------------------------------------------------------------- /Project/CODE/bsp/bat.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BAT_H 2 | #define BAT_H 3 | 4 | void bat_init(); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /Project/CODE/bsp/beep.cpp: -------------------------------------------------------------------------------- 1 | #include "beep.hpp" 2 | #include "car.hpp" 3 | #include "zf_pwm.h" 4 | #include "timer.hpp" 5 | 6 | static void beep_onTime(sched_event_data_t dat) { Car.Buzzer.Mute(); } 7 | 8 | static SoftTimer beep_timer(beep_onTime, 1); 9 | 10 | void Beep::Mute() { pwm_freq(BEEP_PWM, 666, 0); } 11 | 12 | void Beep::Init() { pwm_init(BEEP_PWM, 666, 0); } 13 | 14 | void Beep::BeepFreq(uint32_t Freq) { 15 | CAR_ERROR_CHECK(Freq < 10000); 16 | pwm_freq(BEEP_PWM, Freq, PERCENT_TO_TICKS(50)); 17 | } 18 | 19 | void Beep::BeepFreqDelay(uint32_t Freq, uint16_t ms) { 20 | BeepFreq(Freq); 21 | beep_timer.Start(ms); 22 | } -------------------------------------------------------------------------------- /Project/CODE/bsp/beep.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BEEP_H 2 | #define BEEP_H 3 | 4 | #include "fsl_qtmr.h" 5 | #include "music.hpp" 6 | 7 | //! @note 板载蜂鸣器已在MCUXpressoConfigTool初始化 8 | struct Beep { 9 | void Init(); 10 | //! @brief be quiet 11 | void Mute(); 12 | //! @brief start beep with Freq 13 | void BeepFreq(uint32_t Freq); 14 | //! @brief start beep and stop in time 15 | void BeepFreqDelay(uint32_t Freq, uint16_t ms); 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Project/CODE/bsp/encoder.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/bsp/encoder.cpp -------------------------------------------------------------------------------- /Project/CODE/bsp/encoder.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ENCODER_H 2 | #define ENCODER_H 3 | 4 | #include "board.h" 5 | #include "filter.hpp" 6 | #include "pid.hpp" 7 | #include "route.h" 8 | #include "scheduler.hpp" 9 | #include "zf_qtimer.h" 10 | 11 | class Encoder { 12 | friend void pulse_encoder_schedule(); 13 | 14 | filter_movAve_t filter_moving; 15 | const qtmr_channel_selection_t Channel; //编码器计数通道 16 | double distance; //实际距离 17 | float speed; //实际速度 18 | 19 | void CalSpeed(); 20 | void CalDistance(); 21 | 22 | public: 23 | explicit Encoder(qtmr_channel_selection_t QTIMER_Channel); 24 | __inline float GetSpeed() { return speed; } 25 | __inline float GetDistance() { return distance; } 26 | __inline void ClearDistance() { distance = 0; } 27 | }; 28 | 29 | void pulse_encoder_schedule(); 30 | void tmr_init(); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Project/CODE/bsp/key.hpp: -------------------------------------------------------------------------------- 1 | #ifndef KEY_H 2 | #define KEY_H 3 | 4 | #include "fsl_gpio.h" 5 | 6 | enum class key_action { key_down, key_up, key_longPush, key_doubleClick }; 7 | typedef void (*key_event_handler_t)(key_action sta); 8 | 9 | class Button { 10 | enum class ButtonState { 11 | idle, 12 | press_armed, 13 | press_detected, 14 | pressed, 15 | release_detected, 16 | long_push, 17 | click 18 | } state; 19 | 20 | char pin; 21 | uint8_t pressed_cnt, click_cnt; 22 | key_event_handler_t event; 23 | 24 | public: 25 | Button(char PIN, key_event_handler_t Event) 26 | : pin(PIN), event(Event), state(ButtonState::idle), click_cnt(0), 27 | pressed_cnt(0) {} 28 | void Init(); 29 | bool IsPressed(); 30 | void evt_handle(); 31 | }; 32 | 33 | void key_init(); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Project/CODE/bsp/led.cpp: -------------------------------------------------------------------------------- 1 | #include "led.hpp" 2 | #include "car.hpp" 3 | #include "util.h" 4 | #include "timer.hpp" 5 | 6 | void HardLED::Init() { gpio_init(Pin, GPO, !ActiveState, GPIO_PIN_CONFIG); } 7 | 8 | void HardLED::TurnOn() { gpio_set(Pin, ActiveState); } 9 | 10 | void HardLED::TurnOff() { gpio_set(Pin, !ActiveState); } 11 | 12 | void HardLED::Toggle() { gpio_toggle(Pin); } 13 | 14 | //! @brief 渐变LED指示CPU正在运行 15 | void led_schedule(sched_event_data_t dat) { 16 | static bool CountDown; 17 | static uint8_t Duty; 18 | Duty += CountDown ? -10 : 10; 19 | if (Duty <= 66) 20 | CountDown = false; 21 | if (Duty >= 89) 22 | CountDown = true; 23 | // Car.CoreLED.SetBrightness(Duty); 24 | Car.CoreLED.Toggle(); 25 | } 26 | 27 | SoftTimer ledTmr(led_schedule); 28 | 29 | void led_init() { 30 | Car.CoreLED.Init(); 31 | ledTmr.Start(69); 32 | } 33 | -------------------------------------------------------------------------------- /Project/CODE/bsp/led.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LED_H 2 | #define LED_H 3 | 4 | #include "common.h" 5 | #include "zf_gpio.h" 6 | #include "zf_pwm.h" 7 | 8 | class SoftLED { 9 | PWMCH_enum channel; 10 | 11 | public: 12 | void Init(); 13 | void SetBrightness(float percent); 14 | explicit SoftLED(PWMCH_enum ch) : channel(ch) {} 15 | }; 16 | 17 | class HardLED { 18 | PIN_enum Pin; 19 | bool ActiveState; 20 | 21 | public: 22 | void Init(); 23 | void TurnOn(); 24 | void TurnOff(); 25 | void Toggle(); 26 | explicit HardLED(PIN_enum pin, bool active_state = false) 27 | : Pin(pin), ActiveState(active_state) {} 28 | }; 29 | 30 | void led_init(); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /Project/CODE/bsp/route.h: -------------------------------------------------------------------------------- 1 | #ifndef ROUTE_H 2 | #define ROUTE_H 3 | 4 | #include "car_config.h" 5 | #include "zf_pwm.h" 6 | 7 | // S3010舵机 8 | #define S3010_PWM PWM4_MODULE3_CHA_C31 9 | 10 | // RS380电机*2 11 | #define MOTOR_L PWM1_MODULE3_CHA_B10 12 | #define MOTOR_R PWM1_MODULE3_CHB_B11 13 | 14 | #define BEEP_PWM PWM2_MODULE3_CHA_C18 15 | 16 | // #define LED_PWM PWM2_MODULE3_CHA_B9 17 | 18 | static const int MagForDeep[] = {MagLeftL, MagLeftX, MagMiddleM, MagRightX, 19 | MagRightR, MagMiddleL, MagMiddleR}; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /Project/CODE/bsp/storage.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file storage 3 | * @brief flash 4 | */ 5 | #ifndef STORAGE_H 6 | #define STORAGE_H 7 | 8 | void storage_save(unsigned long sector, unsigned long page); 9 | void storage_load(unsigned long sector, unsigned long page); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /Project/CODE/car/car.cpp: -------------------------------------------------------------------------------- 1 | #include "car.hpp" 2 | #include "MCP4452.h" 3 | #include "SEEKFREE_IIC.h" 4 | #include "bat.hpp" 5 | #include "communication.hpp" 6 | #include "deep.hpp" 7 | #include "fsl_src.h" 8 | #include "gui.hpp" 9 | #include "storage.hpp" 10 | #include "timer.hpp" 11 | #include "usage.hpp" 12 | #include "package.hpp" 13 | #include "util.h" 14 | #include "zf_flash.h" 15 | #include "zf_pit.h" 16 | 17 | //! @warning 全局唯一! 18 | AT_SDRAM_SECTION(iMagCar Car); 19 | 20 | void iMagCar::Startup() { 21 | DisableGlobalIRQ(); 22 | board_init(); //!< before all 23 | CAR_ERROR_CHECK(flash_init() == 0); 24 | led_init(); 25 | key_init(); 26 | CarOLED.fnInitialize(); //!< after key 27 | ActiveLayout->Repaint(); //!< after oled 28 | MotorL.Init(); 29 | MotorR.Init(); 30 | Steer3010.Init(); 31 | Buzzer.Init(); 32 | bat_init(); 33 | deep_init(); 34 | magnet_init(); 35 | cpu_usage_init(); 36 | mcp_init(); 37 | EnableGlobalIRQ(0); 38 | 39 | storage_load(SLN_DEBUG_SECTOR, SLN_DEBUG_PAGE); //!< after MCP4452 40 | package_init(); 41 | com_init(); 42 | gui_motor.upd_tmr.Start(62); 43 | com_log("Startup Successfully!\n", LogGreen); 44 | Buzzer.BeepFreqDelay(6666, 233); 45 | } 46 | 47 | void iMagCar::Run() { 48 | cpu_usage_count(); 49 | sched_execute(); 50 | } 51 | 52 | void iMagCar::Launch() { 53 | PIT_StartTimer(PIT, PIT_MOTOR_CH); 54 | PIT_StartTimer(PIT, PIT_STEER_CH); 55 | } 56 | 57 | void iMagCar::Pause() { 58 | Car.MotorL.Stop(); 59 | Car.MotorR.Stop(); 60 | pit_close(PIT_MOTOR_CH); 61 | pit_close(PIT_STEER_CH); 62 | } 63 | 64 | iMagCar::~iMagCar() { 65 | Steer3010.~Steer(); 66 | CAR_ERROR_CHECK(0) 67 | } 68 | 69 | void LaunchDelaySchedule(sched_event_data_t dat) { 70 | static uint8_t cnt; 71 | Car.Buzzer.BeepFreq(++cnt * 1000); 72 | if (cnt < 3) 73 | return; 74 | // SongOfJoy.Start(); 75 | cnt = 0; 76 | Car.Machine.Start(); 77 | } 78 | -------------------------------------------------------------------------------- /Project/CODE/car/car_config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/car/car_config.h -------------------------------------------------------------------------------- /Project/CODE/car/communication.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COMMUNICATION_H 2 | #define COMMUNICATION_H 3 | 4 | #include "fsl_common.h" 5 | #include 6 | 7 | enum log_color_enum { LogBlack, LogRed, LogGreen, LogBlue, LogOrange, LogLime }; 8 | 9 | static const uint8_t SOH = 0x01, EOT = 0x04, ESC = 0x5c; 10 | 11 | void com_init(); 12 | void com_push(uint8_t packID, const uint8_t *payload, uint8_t length); 13 | 14 | /** 15 | * @brief 向上位机发送彩色日志 16 | * @param str [in] 17 | * @param color [in] @ref log_color_enum 18 | * @code 19 | * com_log("Hello, World!\n", LogLime); 20 | * @endcode 21 | */ 22 | __STATIC_INLINE void com_log(std::string str, log_color_enum color = LogBlack) { 23 | str.insert(str.cbegin(), (char)color); 24 | com_push(0x8f, (const uint8_t *)&str[0], str.size()); 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Project/CODE/car/machine.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MACHINE_H 2 | #define MACHINE_H 3 | 4 | #include "StateMachine.hpp" 5 | 6 | //! @brief structure to hold event data passed into state machine 7 | struct CarData : public EventData { 8 | explicit CarData(float speed) : TargetSpeed(speed) {} 9 | float TargetSpeed; 10 | }; 11 | 12 | //! @brief the Car state machine class 13 | class CarMachine : public StateMachine { 14 | public: 15 | CarMachine() : StateMachine(ST_MAX_STATES) {} 16 | 17 | // external events taken by this state machine 18 | 19 | //! @brief set motor speed external event 20 | void SetSpeed(CarData *); 21 | 22 | //! @brief halt motor external event 23 | void Halt(); 24 | 25 | //! @brief 启动电机 26 | void Start(); 27 | 28 | //! @brief 暂停电机 29 | void Pause(); 30 | 31 | //! @brief 稳定运行 32 | void Steady(); 33 | 34 | //! @brief 触发异常 35 | void DetectException(); 36 | 37 | //! @brief 停稳了 38 | void Stopped(); 39 | 40 | private: 41 | // state machine state functions 42 | 43 | //! @brief 空闲时关闭电机 44 | void ST_Idle(EventData *); 45 | 46 | //! @brief 启动时调用Car.Launch()并检测异常 47 | void ST_Launch(CarData *); 48 | 49 | //! @brief 稳定运行,开启保护定时器 50 | void ST_Running(CarData *); 51 | 52 | //! @brief 正在刹车,停稳后转移状态 53 | void ST_Brake(CarData *); 54 | 55 | //! @brief 运行异常:堵转、出轨、离地 56 | void ST_Exception(CarData *); 57 | 58 | //! @brief 自动恢复 59 | void ST_Recover(CarData *); 60 | 61 | // state map to define state function order 62 | BEGIN_STATE_MAP 63 | STATE_MAP_ENTRY(&CarMachine::ST_Idle) 64 | STATE_MAP_ENTRY(&CarMachine::ST_Launch) 65 | STATE_MAP_ENTRY(&CarMachine::ST_Running) 66 | STATE_MAP_ENTRY(&CarMachine::ST_Brake) 67 | STATE_MAP_ENTRY(&CarMachine::ST_Recover) 68 | STATE_MAP_ENTRY(&CarMachine::ST_Exception) 69 | END_STATE_MAP 70 | 71 | /** @warning state enumeration order must match the 72 | * order of state method entries in the state map 73 | */ 74 | enum E_States { 75 | ST_IDLE = 0, 76 | ST_LAUNCH, 77 | ST_RUNNING, 78 | ST_BRAKE, 79 | ST_RECOVER, 80 | ST_EXCEPTION, 81 | ST_MAX_STATES 82 | }; 83 | }; 84 | 85 | #endif 86 | 87 | /* 88 | void CarMachine::(CarData *pData) { 89 | BEGIN_TRANSITION_MAP // - Current State - 90 | , // ST_Idle 91 | , // ST_Launch 92 | , // ST_Running 93 | , // ST_Brake 94 | , // ST_Recover 95 | , // ST_Exception 96 | END_TRANSITION_MAP(pData) 97 | } 98 | */ 99 | -------------------------------------------------------------------------------- /Project/CODE/control/hall.cpp: -------------------------------------------------------------------------------- 1 | #include "car.hpp" 2 | #include "communication.hpp" 3 | #include "peripherals.h" 4 | 5 | /* GPIO3_Combined_0_15_IRQn interrupt handler */ 6 | extern "C" void GPIO3_GPIO_COMB_0_15_IRQHANDLER(void) { 7 | /* Get pins flags */ 8 | uint32_t pins_flags = GPIO_GetPinsInterruptFlags(GPIO3); 9 | 10 | Car.Machine.Halt(); 11 | com_log("gpio3\n\r"); 12 | 13 | /* Clear ins flags */ 14 | GPIO_ClearPinsInterruptFlags(GPIO3, pins_flags); 15 | } 16 | 17 | /* GPIO1_Combined_16_31_IRQn interrupt handler */ 18 | extern "C" void GPIO1_GPIO_COMB_16_31_IRQHANDLER(void) { 19 | /* Get pins flags */ 20 | uint32_t pins_flags = GPIO_GetPinsInterruptFlags(GPIO1); 21 | 22 | Car.Machine.Halt(); 23 | com_log("gpio1\n\r"); 24 | 25 | /* Clear ins flags */ 26 | GPIO_ClearPinsInterruptFlags(GPIO1, pins_flags); 27 | } 28 | -------------------------------------------------------------------------------- /Project/CODE/control/magnet.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file magnet 3 | * @brief 电磁传感器 4 | */ 5 | #ifndef MAGNET_H 6 | #define MAGNET_H 7 | 8 | #include "filter.hpp" 9 | #include "util.h" 10 | 11 | class MagSensor { 12 | friend void storage_load(uint32 sector, uint32 page); 13 | 14 | private: 15 | // filter_movAve_t filter_RawData; 16 | float fValue; 17 | float RawData, MaxRaw = 0.1, MinRaw = INT16_MAX; 18 | void Normalize(); 19 | 20 | public: 21 | void Sample(float raw); 22 | 23 | //! @brief access private readonly 24 | __inline float GetRaw() { return RawData; } 25 | __inline float GetNormalized() { return fValue; } 26 | __inline float GetVoltage() { return ADC12b_TO_mV(RawData); } 27 | __inline float GetMax() { return MaxRaw; } 28 | __inline float GetMin() { return MinRaw; } 29 | __inline void ClearMax() { MaxRaw = 0; } 30 | }; 31 | 32 | struct RingThreshold { 33 | uint8_t island, //进入环岛的阈值 34 | straightR, //平道右瞻ADC 35 | straightL, //平道左瞻ADC 36 | straightM, //平道中瞻ADC 37 | K, //极左电感比例 38 | Q; //竖直电感比例 39 | }; 40 | 41 | //! @brief 平移电感记录归一化用的最大值 42 | extern bool SaveMaxEnabled; 43 | 44 | //! @brief 通过前瞻测到的三个电磁值,一定处理后得到的偏差值,作为舵机pid中的error. 45 | extern volatile float MagErrorForPID; 46 | 47 | void magnet_init(); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /Project/CODE/control/motor.cpp: -------------------------------------------------------------------------------- 1 | #include "motor.hpp" 2 | #include "car.hpp" 3 | #include "communication.hpp" 4 | #include "gui.hpp" 5 | #include "route.h" 6 | #include "util.h" 7 | #include "zf_qtimer.h" 8 | 9 | Motor::Motor(PWMCH_enum ch, float OutMin, float OutMax) 10 | : duty(0), PWM_Channel(ch), speedCtrl(std::make_pair(OutMin, OutMax)) {} 11 | 12 | void Motor::Init() { pwm_init(PWM_Channel, MOTOR_FREQ, 0); } 13 | 14 | /** 15 | * @name 设置电机PWM 16 | * @param duty PWM占空比 range:0-100% 17 | * @note MotorL.SetDuty(50); 18 | */ 19 | void Motor::SetDuty(float Duty) { 20 | uint32 pwm = PERCENT_TO_TICKS(Duty); 21 | CAR_ERROR_CHECK(pwm < PWM_DUTY_MAX); 22 | pwm_duty(PWM_Channel, pwm); 23 | duty = Duty; 24 | } 25 | 26 | void Motor::Stop(void) { 27 | SetDuty(0); 28 | speedCtrl.Reset(); 29 | } 30 | 31 | void motor_pid_schedule() { 32 | CRITICAL_REGION_ENTER(); 33 | auto dutyL = Car.MotorL.speedCtrl.Realize(Car.MotorL.target - Car.EncoderL.GetSpeed()); 34 | auto dutyR = Car.MotorR.speedCtrl.Realize(Car.MotorL.target - Car.EncoderR.GetSpeed()); 35 | Car.MotorL.SetDuty(dutyL); 36 | Car.MotorR.SetDuty(dutyR); 37 | CRITICAL_REGION_EXIT(); 38 | } 39 | -------------------------------------------------------------------------------- /Project/CODE/control/motor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MOTORx_H 2 | #define MOTORx_H 3 | 4 | #include "board.h" 5 | #include "pid.hpp" 6 | #include "route.h" 7 | #include "scheduler.hpp" 8 | #include "zf_pwm.h" 9 | 10 | class Motor { 11 | friend void motor_pid_schedule(); 12 | 13 | private: 14 | PWMCH_enum PWM_Channel; 15 | 16 | public: 17 | PID speedCtrl; 18 | float duty; 19 | float target; 20 | 21 | Motor(PWMCH_enum ch, float OutMin, float OutMax); 22 | void Init(); 23 | void SetDuty(float duty); 24 | void Stop(void); 25 | }; 26 | 27 | void motor_pid_schedule(void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Project/CODE/control/pid.cpp: -------------------------------------------------------------------------------- 1 | #include "pid.hpp" 2 | #include "communication.hpp" 3 | #include "util.h" 4 | #include 5 | 6 | extern "C" { 7 | void arm_pid_reset_f32(arm_pid_instance_f32 *); 8 | void arm_pid_init_f32(arm_pid_instance_f32 *, int32_t); 9 | } 10 | 11 | PID::PID(std::pair OutLim) 12 | : minOut(OutLim.first), maxOut(OutLim.second) { 13 | arm_pid_reset_f32(&instance); 14 | } 15 | 16 | void PID::SetPID(float P, float I, float D) { 17 | instance.Kp = P; 18 | instance.Ki = I; 19 | instance.Kd = D; 20 | arm_pid_init_f32(&instance, 0); 21 | } 22 | 23 | PID &PID::operator=(const pid_coefficient_t &coeff) { 24 | SetPID(coeff.Kp, coeff.Ki, coeff.Kd); 25 | return *this; 26 | } 27 | 28 | void PID::SetK(char index, float32_t varia) { 29 | switch (std::toupper(index)) { 30 | case 'P': 31 | instance.Kp += varia; 32 | break; 33 | case 'I': 34 | instance.Ki += varia; 35 | break; 36 | case 'D': 37 | instance.Kd += varia; 38 | break; 39 | default: 40 | com_log("Invalid parameters!\n"); 41 | return; 42 | } 43 | arm_pid_init_f32(&instance, 0); 44 | } 45 | 46 | void PID::Reset() { arm_pid_reset_f32(&instance); } 47 | 48 | float PID::Realize(float err) { 49 | // float output = arm_pid_f32(&instance, err); 50 | // LIMITING(output, minOut, maxOut); 51 | // return output; 52 | 53 | arm_pid_f32(&instance, err); 54 | return LIMITING(instance.state[2], minOut, maxOut); 55 | } 56 | 57 | float PosPID::Realize(float err) { 58 | integral += err; 59 | float output(coeff.Kp * err + coeff.Ki * integral + 60 | coeff.Kd * (err - last)); 61 | last = err; 62 | return output; 63 | } 64 | 65 | void PosPID::SetPID(float P, float I, float D) { 66 | coeff.Kp = P; 67 | coeff.Ki = I; 68 | coeff.Kd = D; 69 | integral = 0; 70 | } 71 | 72 | PosPID &PosPID::operator=(const pid_coefficient_t &coeff) { 73 | SetPID(coeff.Kp, coeff.Ki, coeff.Kd); 74 | return *this; 75 | } 76 | 77 | void PosPID::SetK(char index, float32_t varia) { 78 | switch (std::toupper(index)) { 79 | case 'P': 80 | coeff.Kp += varia; 81 | break; 82 | case 'I': 83 | coeff.Ki += varia; 84 | break; 85 | case 'D': 86 | coeff.Kd += varia; 87 | break; 88 | default: 89 | com_log("Invalid parameters!\n"); 90 | return; 91 | } 92 | integral = 0; 93 | } 94 | -------------------------------------------------------------------------------- /Project/CODE/control/pid.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PID_H 2 | #define PID_H 3 | 4 | #include 5 | #include 6 | 7 | struct pid_coefficient_t { 8 | float32_t Kp, Ki, Kd; 9 | } __PACKED; 10 | 11 | class PID { 12 | private: 13 | float minOut, maxOut; 14 | 15 | public: 16 | arm_pid_instance_f32 instance = {0x0}; 17 | 18 | explicit PID(std::pair OutMinMax); 19 | PID &operator=(const pid_coefficient_t &coeff); 20 | float Realize(float err); 21 | void SetPID(float Kp, float Ki, float Kd); 22 | void SetK(char index,float32_t varia); 23 | void Reset(); 24 | }; 25 | 26 | class PosPID { 27 | float now, last, integral; 28 | 29 | public: 30 | pid_coefficient_t coeff; 31 | float Realize(float err); 32 | void SetPID(float Kp, float Ki, float Kd); 33 | void SetK(char index,float32_t varia); 34 | PosPID &operator=(const pid_coefficient_t &coeff); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Project/CODE/control/rit.cpp: -------------------------------------------------------------------------------- 1 | #include "car.hpp" 2 | #include "encoder.hpp" 3 | #include "motor.hpp" 4 | #include "peripherals.h" 5 | #include "steer.hpp" 6 | #include "util.h" 7 | #include "zf_pit.h" 8 | 9 | extern "C" void PIT_IRQHandler(void) { 10 | if (PIT_FLAG_GET(PIT_ENCODER_CH)) { 11 | PIT_FLAG_CLEAR(PIT_ENCODER_CH); 12 | pulse_encoder_schedule(); 13 | } 14 | 15 | if (PIT_FLAG_GET(PIT_MOTOR_CH)) { 16 | PIT_FLAG_CLEAR(PIT_MOTOR_CH); 17 | if (IS_SET(Car.Enabled, SW_SPEED)) 18 | motor_pid_schedule(); 19 | } 20 | 21 | if (PIT_FLAG_GET(PIT_STEER_CH)) { 22 | PIT_FLAG_CLEAR(PIT_STEER_CH); 23 | if (IS_SET(Car.Enabled, SW_STEER)) 24 | sched_event_put(steer_schedule); 25 | } 26 | 27 | __DSB(); 28 | } 29 | -------------------------------------------------------------------------------- /Project/CODE/control/steer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STEERx_H 2 | #define STEERx_H 3 | 4 | #include "pid.hpp" 5 | #include "scheduler.hpp" 6 | #include "util.h" 7 | #include "zf_pwm.h" 8 | 9 | class Steer { 10 | PWMCH_enum PWM_Channel; 11 | 12 | public: 13 | float steerOffset; 14 | uint8_t duty; 15 | PosPID steerCtrl; 16 | Steer(PWMCH_enum ch, float OutMin, float OutMax); 17 | void Init(); 18 | void ModifyOffset(int8 varia); 19 | void DutySet(float duty); 20 | __inline void WidthSet(uint16_t us) { DutySet(100 - PULSE_TO_PERCENT(us)); } 21 | }; 22 | 23 | void steer_schedule(sched_event_data_t); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Project/CODE/gui/SEEKFREE_OLED.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/gui/SEEKFREE_OLED.c -------------------------------------------------------------------------------- /Project/CODE/gui/SEEKFREE_OLED.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/gui/SEEKFREE_OLED.h -------------------------------------------------------------------------------- /Project/CODE/gui/gui.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/gui/gui.cpp -------------------------------------------------------------------------------- /Project/CODE/gui/gui.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/gui/gui.hpp -------------------------------------------------------------------------------- /Project/CODE/gui/screen.c: -------------------------------------------------------------------------------- 1 | #include "screen.h" 2 | #include "SEEKFREE_OLED.h" 3 | #include 4 | #include 5 | 6 | SGUI_SCR_DEV CarOLED = {.stSize = {128, 64}, 7 | .fnClear = screen_clear, 8 | .fnSetPixel = screen_setPixel, 9 | .fnGetPixel = screen_getPixel, 10 | .fnInitialize = screen_initialize, 11 | .fnSyncBuffer = screen_refresh}; 12 | 13 | static bool screen_buffer[128][64]; 14 | 15 | void screen_clear(void) { 16 | memset(screen_buffer, 0, sizeof screen_buffer); 17 | oled_fill(0); 18 | } 19 | 20 | void screen_refresh(void) { 21 | for (unsigned i = 0; i < 128; ++i) 22 | for (unsigned j = 0; j < 8; ++j) { 23 | unsigned char dat = 0; 24 | for (unsigned k = 0; k < 8; ++k) 25 | if (screen_buffer[i][j * 8 + k]) 26 | dat |= 1 << k; 27 | oled_putpixel(i, j, dat); 28 | } 29 | } 30 | 31 | int screen_initialize(void) { 32 | oled_init(); 33 | return 0; 34 | } 35 | 36 | SGUI_INT screen_getPixel(SGUI_INT x, SGUI_INT y) { 37 | if (x > 127 || y > 63) 38 | return 0; 39 | return screen_buffer[x][y] ? 1 : 0; 40 | } 41 | 42 | void screen_setPixel(SGUI_INT x, SGUI_INT y, SGUI_INT color) { 43 | screen_buffer[x][y] = color ? true : false; 44 | } 45 | -------------------------------------------------------------------------------- /Project/CODE/gui/screen.h: -------------------------------------------------------------------------------- 1 | // Abstract Layer from OLED to GUI 2 | #ifndef SCREEN_H 3 | #define SCREEN_H 4 | 5 | #include "SGUI_Typedef.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | static SGUI_POINT screen_innerPos = {.iX = 0, .iY = 0}; 12 | static SGUI_RECT screen_full = {.iX = 0, .iY = 0, .iWidth = 128, .iHeight = 64}; 13 | 14 | extern SGUI_SCR_DEV CarOLED; 15 | 16 | void screen_clear(void); 17 | void screen_refresh(void); 18 | SGUI_INT screen_initialize(void); 19 | SGUI_INT screen_getPixel(SGUI_INT x, SGUI_INT y); 20 | void screen_setPixel(SGUI_INT x, SGUI_INT y, SGUI_INT color); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /Project/CODE/gui/tree.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TREE_H 2 | #define TREE_H 3 | 4 | #include "layout.hpp" 5 | #include 6 | 7 | struct TreeNode { 8 | struct LayoutBase *Parent; 9 | std::vectorChildren; 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Project/CODE/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/main.cpp -------------------------------------------------------------------------------- /Project/CODE/utility/filter.cpp: -------------------------------------------------------------------------------- 1 | #include "filter.hpp" 2 | 3 | struct fir_mov_t fir_mov = {3, {0.3333333333, 0.3333333333, 0.3333333333}}; 4 | 5 | struct fir_low1_t fir_low1 = { 6 | 26, {0.0001979996014, -0.0006330574397, 0.001568097738, -0.003304710612, 7 | 0.006254237611, -0.01095288899, 0.01811391674, -0.02876197733, 8 | 0.04459231347, -0.06900795549, 0.1107223779, -0.201850757, 9 | 0.6330996752, 0.6330996752, -0.201850757, 0.1107223779, 10 | -0.06900795549, 0.04459231347, -0.02876197733, 0.01811391674, 11 | -0.01095288899, 0.006254237611, -0.003304710612, 0.001568097738, 12 | -0.0006330574397, 0.0001979996014}}; 13 | 14 | filter_kalman::filter_kalman(float ProcessNiose, float MeasureNoise) 15 | : Q(ProcessNiose), R(MeasureNoise) { 16 | p_last = kalmanGain = 1; 17 | p_middle = p_now = x_last = x_middle = x_now = 0; 18 | } 19 | 20 | float filter_kalman::Filte(float Measurement) { 21 | p_middle = p_last + Q; // x_last=x(k-1|k-1),x_mid=x(k|k-1) 22 | x_middle = x_last; // p_mid=p(k|k-1),p_last=p(k-1|k-1) 23 | kalmanGain = p_middle / (p_middle + R); //计算卡尔曼的增益 24 | x_now = 25 | x_middle + kalmanGain * (Measurement - x_middle); //预测出当前最优解 26 | p_now = (1 - kalmanGain) * p_middle; //最优解所对应的协方差 27 | p_last = p_now; //用于更新当前预测值 28 | x_last = x_now; //用于更新当前协方差 29 | return x_now; 30 | } 31 | 32 | ///** 33 | // * @name 为左轮速度和右轮速度定义的滤波器 34 | // * @brief 35 | // 如果要更换滤波器,只需要将滤波器参数结构体如fir_mov全部替换成另一种滤波器参数结构体 36 | // * @{ 37 | // */ 38 | // filter_fir_t 39 | // filter_fir_speedL(fir_mov.numTaps,fir_mov.pCoeffs,1,&Car.encoderL.speed); 40 | // filter_fir_t 41 | // filter_fir_speedR(fir_mov.numTaps,fir_mov.pCoeffs,1,&Car.encoderR.speed); 42 | 43 | ///** @} 为左轮速度和右轮速度定义的滤波器 */ 44 | -------------------------------------------------------------------------------- /Project/CODE/utility/music.cpp: -------------------------------------------------------------------------------- 1 | #include "music.hpp" 2 | #include "car.hpp" 3 | 4 | #ifdef BEEP_ENABLED 5 | 6 | #define MUSIC_BUZZER Car.beep0 7 | 8 | const static music_t SoJ{ 9 | {MUSIC_MI, 500}, {MUSIC_MI, 500}, {MUSIC_FA, 500}, {MUSIC_SOL, 500}, 10 | {MUSIC_SOL, 500}, {MUSIC_FA, 500}, {MUSIC_MI, 500}, {MUSIC_RE, 500}, 11 | {MUSIC_DO, 500}, {MUSIC_DO, 500}, {MUSIC_RE, 500}, {MUSIC_MI, 500}, 12 | {MUSIC_MI, 750}, {MUSIC_RE, 250}, {MUSIC_RE, 790}, {MUSIC_RE, 500}, 13 | {MUSIC_MI, 500}, {MUSIC_MI, 500}, {MUSIC_FA, 500}, {MUSIC_SOL, 500}, 14 | {MUSIC_SOL, 500}, {MUSIC_FA, 500}, {MUSIC_MI, 500}, {MUSIC_RE, 500}, 15 | {MUSIC_DO, 500}, {MUSIC_DO, 500}, {MUSIC_RE, 500}, {MUSIC_MI, 500}, 16 | {MUSIC_RE, 750}, {MUSIC_DO, 250}, {MUSIC_DO, 790}, {MUSIC_DO, 500}, 17 | }; //!< 《欢乐颂》 18 | 19 | MusicPlayer SongOfJoy(SoJ); 20 | 21 | void MusicPlayer::Play(sched_event_data_t dat) { 22 | MUSIC_BUZZER.BeepFreqDelay(music[ptr].first, music[ptr].second); 23 | ++ptr %= music.size(); 24 | } 25 | 26 | void MusicPlayer::Start() { tmr.Start(tim); } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Project/CODE/utility/music.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MUSIC_H 2 | #define MUSIC_H 3 | 4 | #ifdef BEEP_ENABLED 5 | 6 | #include "timer.hpp" 7 | #include 8 | #include 9 | 10 | enum music_freq { 11 | MUSIC_DO = 1046, 12 | MUSIC_RE = 1175, 13 | MUSIC_MI = 1319, 14 | MUSIC_FA = 1397, 15 | MUSIC_SOL = 1568, 16 | MUSIC_LA = 1760, 17 | MUSIC_SI = 1976 18 | }; 19 | 20 | /** 21 | * @brief 乐谱 22 | * @note first频率,second时长 23 | */ 24 | typedef std::vector> music_t; 25 | 26 | struct MusicPlayer { 27 | MusicPlayer(const music_t &Music) 28 | : tmr(std::bind(&MusicPlayer::Play, this, std::placeholders::_1)), 29 | music(Music), ptr(0) {} 30 | void Start(); 31 | 32 | private: 33 | const unsigned tim = 800; 34 | const music_t &music; 35 | size_t ptr; 36 | SoftTimer tmr; 37 | void Play(sched_event_data_t); 38 | }; 39 | 40 | extern MusicPlayer SongOfJoy; 41 | 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /Project/CODE/utility/package.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PACK 3 | * @brief 与上位机通讯的数据包 4 | */ 5 | #ifndef PACKAGE_H 6 | #define PACKAGE_H 7 | 8 | #include 9 | 10 | void package_receive(std::vector buffer); 11 | void package_init(); 12 | void package_sendDeep(uint8_t); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /Project/CODE/utility/retarget.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/utility/retarget.c -------------------------------------------------------------------------------- /Project/CODE/utility/scheduler.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file scheduler.cpp 3 | * @brief The scheduler is used for transferring execution from the interrupt 4 | * context to the main context. 5 | */ 6 | #include "scheduler.hpp" 7 | #include "util.h" 8 | #include 9 | #include 10 | 11 | // struct sched_buf_t { 12 | // sched_event_data_t event_data; 13 | // sched_event_handler_t event_handler; 14 | // }; 15 | typedef std::pair sched_buf_t; 16 | 17 | SECTION_SDRAM static std::queue sched_q; 18 | 19 | /** @brief Function for scheduling an event. 20 | * 21 | * @details Puts an event into the event queue. 22 | * 23 | * @param[in] data Pointer to event data to be scheduled. 24 | * @param[in] handler Event handler to receive the event. 25 | */ 26 | void sched_event_put(sched_event_handler_t handler, 27 | const sched_event_data_t &data) { 28 | // DEBUG_LOG("sched_q.size= %d\n", sched_q.size()); 29 | // generate the object at tail of queue 30 | sched_q.emplace(std::make_pair(data, handler)); 31 | } 32 | 33 | /** @brief Function for executing all scheduled events. 34 | * 35 | * @details This function must be called from within the main loop. It will 36 | * execute all events scheduled since the last time it was called. 37 | * @note Since this function is only called from the main loop, there is no 38 | * need for a critical region here. 39 | */ 40 | void sched_execute() { 41 | while (!sched_q.empty()) { 42 | auto &tmp(sched_q.front()); 43 | assert(tmp.second); 44 | // DEBUG_LOG("%x\n", tmp.event_handler); 45 | tmp.second(tmp.first); 46 | sched_q.pop(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Project/CODE/utility/scheduler.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SCHEDULER_H 2 | #define SCHEDULER_H 3 | 4 | #include 5 | #include 6 | 7 | typedef std::initializer_list sched_event_data_t; 8 | typedef std::function sched_event_handler_t; 9 | 10 | void sched_execute(); 11 | void sched_event_put(sched_event_handler_t event_handler, 12 | const sched_event_data_t &event_data = {}); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /Project/CODE/utility/timer.cpp: -------------------------------------------------------------------------------- 1 | #include "timer.hpp" 2 | #include "peripherals.h" 3 | #include "util.h" 4 | #include 5 | 6 | volatile static uint32_t _timer_ticks; //!< 单调递增 7 | 8 | struct TimeComparer { 9 | bool operator()(SoftTimer *lhs, SoftTimer *rhs) { return !(*lhs < *rhs); } 10 | }; 11 | 12 | SECTION_SDRAM static std::priority_queue, 13 | TimeComparer> 14 | _q; //!< 这是一棵平衡树 15 | 16 | void SoftTimer::Restart() { 17 | timeout = period + _timer_ticks; 18 | repeat_cnt = repeat; 19 | _q.push(this); 20 | } 21 | 22 | void SoftTimer::Start(uint32_t timeout_ms, sched_event_data_t event_context) { 23 | period = timeout_ms; 24 | context = event_context; 25 | Restart(); 26 | } 27 | 28 | void SoftTimer::Stop() { repeat_cnt = 1; } 29 | 30 | void SoftTimer::Expire() { 31 | sched_event_put(handler, context); 32 | if (repeat_cnt == 1) 33 | return; 34 | if (repeat_cnt > 1) 35 | --repeat_cnt; 36 | Restart(); 37 | } 38 | 39 | void timer_tick() { 40 | ++_timer_ticks; 41 | for (SoftTimer *it; !_q.empty();) { 42 | it = _q.top(); 43 | if (it->timeout <= _timer_ticks) { 44 | _q.pop(); 45 | it->Expire(); 46 | } else 47 | return; 48 | } 49 | } 50 | 51 | extern "C" void SOFTTIMER_GPT_IRQHANDLER(void) { 52 | if (GPT_GetStatusFlags(SOFTTIMER_PERIPHERAL, kGPT_OutputCompare1Flag)) { 53 | timer_tick(); 54 | GPT_ClearStatusFlags(SOFTTIMER_PERIPHERAL, kGPT_OutputCompare1Flag); 55 | } 56 | __DSB(); 57 | } 58 | -------------------------------------------------------------------------------- /Project/CODE/utility/timer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_H 2 | #define TIMER_H 3 | 4 | #include "scheduler.hpp" 5 | #include 6 | 7 | struct SoftTimer { 8 | friend void timer_tick(); 9 | 10 | explicit SoftTimer(sched_event_handler_t EventHandler, uint8_t Repeat = 0) 11 | : repeat(Repeat), handler(EventHandler) {} 12 | 13 | /** 14 | * @brief 开始定时 15 | * @param[in] timeout_us 定时周期 16 | * @param[in] context 事件的参数,默认空 17 | * @note 重复次数在初始化时指定 18 | */ 19 | void Start(uint32_t timeout_ms, 20 | sched_event_data_t context = {}); 21 | //! @brief 暂停定时器,重启后只能单次触发 22 | void Stop(); 23 | //! @note 暂停后重新开始,而不是继续! 24 | void Restart(); 25 | 26 | bool operator<(const SoftTimer &rhs) { 27 | return timeout < rhs.timeout; 28 | } 29 | 30 | private: 31 | uint32_t timeout; //!< 还有多久触发事件 32 | uint16_t repeat, repeat_cnt; //!< 还需要触发几次事件 @note 0为无限循环 33 | sched_event_handler_t handler; //!< 要触发的事件 34 | sched_event_data_t context; //!< 给事件传参数 35 | uint32_t period; //!< 事件触发间隔 36 | 37 | //! @brief 调度事件 38 | void Expire(); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Project/CODE/utility/usage.cpp: -------------------------------------------------------------------------------- 1 | #include "car_config.h" 2 | #include "route.h" 3 | #include "timer.hpp" 4 | #include "util.h" 5 | #include 6 | 7 | std::uint_fast64_t cpu_usage_cnt, cpu_usage_raw; 8 | 9 | void no_memory() { 10 | abort(); 11 | } 12 | 13 | unsigned cpu_usage_get() { return cpu_usage_raw; } 14 | 15 | void cpu_usage_count() { ++cpu_usage_cnt; } 16 | 17 | void cpu_usage_sched(sched_event_data_t dat) { 18 | cpu_usage_raw = cpu_usage_cnt; 19 | cpu_usage_cnt = 0; 20 | } 21 | 22 | static SoftTimer cpu_usage_tim(cpu_usage_sched); 23 | 24 | void cpu_usage_init() { 25 | cpu_usage_tim.Start(CPU_USAGE_PERIOD); 26 | std::set_new_handler(no_memory); 27 | } 28 | -------------------------------------------------------------------------------- /Project/CODE/utility/usage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef USAGE_H 2 | #define USAGE_H 3 | 4 | void cpu_usage_count(); 5 | 6 | void cpu_usage_init(); 7 | 8 | unsigned cpu_usage_get(); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Project/CODE/写字库.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/CODE/写字库.cpp -------------------------------------------------------------------------------- /Project/MDK/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ForceImpTypeAny = 0 3 | ShowInfoWin = 1 4 | EnableFlashBP = 2 5 | BPDuringExecution = 0 6 | [CFI] 7 | CFISize = 0x00 8 | CFIAddr = 0x00 9 | [CPU] 10 | MonModeVTableAddr = 0xFFFFFFFF 11 | MonModeDebug = 0 12 | MaxNumAPs = 0 13 | LowPowerHandlingMode = 0 14 | OverrideMemMap = 0 15 | AllowSimulation = 1 16 | ScriptFile="" 17 | [FLASH] 18 | CacheExcludeSize = 0x00 19 | CacheExcludeAddr = 0x00 20 | MinNumBytesFlashDL = 0 21 | SkipProgOnCRCMatch = 1 22 | VerifyDownload = 1 23 | AllowCaching = 1 24 | EnableFlashDL = 2 25 | Override = 0 26 | Device="ARM7" 27 | [GENERAL] 28 | WorkRAMSize = 0x00 29 | WorkRAMAddr = 0x00 30 | RAMUsageLimit = 0x00 31 | [SWO] 32 | SWOLogFile="" 33 | [MEM] 34 | RdOverrideOrMask = 0x00 35 | RdOverrideAndMask = 0xFFFFFFFF 36 | RdOverrideAddr = 0xFFFFFFFF 37 | WrOverrideOrMask = 0x00 38 | WrOverrideAndMask = 0xFFFFFFFF 39 | WrOverrideAddr = 0xFFFFFFFF 40 | -------------------------------------------------------------------------------- /Project/MDK/MDK删除临时文件.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/MDK/MDK删除临时文件.bat -------------------------------------------------------------------------------- /Project/MDK/RTE/Compiler/EventRecorderConf.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | * MDK - Component ::Event Recorder 3 | * Copyright (c) 2016-2018 ARM Germany GmbH. All rights reserved. 4 | *------------------------------------------------------------------------------ 5 | * Name: EventRecorderConf.h 6 | * Purpose: Event Recorder Configuration 7 | * Rev.: V1.1.0 8 | *----------------------------------------------------------------------------*/ 9 | 10 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 11 | 12 | // Event Recorder 13 | 14 | // Number of Records 15 | // <8=>8 <16=>16 <32=>32 <64=>64 <128=>128 <256=>256 <512=>512 <1024=>1024 16 | // <2048=>2048 <4096=>4096 <8192=>8192 <16384=>16384 <32768=>32768 17 | // <65536=>65536 18 | // Configures size of Event Record Buffer (each record is 16 bytes) 19 | // Must be 2^n (min=8, max=65536) 20 | #define EVENT_RECORD_COUNT 64U 21 | 22 | // Time Stamp Source 23 | // <0=> DWT Cycle Counter <1=> SysTick <2=> CMSIS-RTOS2 System Timer 24 | // <3=> User Timer (Normal Reset) <4=> User Timer (Power-On Reset) 25 | // Selects source for 32-bit time stamp 26 | #define EVENT_TIMESTAMP_SOURCE 1 27 | 28 | // Time Stamp Clock Frequency [Hz] <0-1000000000> 29 | // Defines initial time stamp clock frequency (0 when not used) 30 | #define EVENT_TIMESTAMP_FREQ 600000000U 31 | 32 | // 33 | 34 | //------------- <<< end of configuration section >>> --------------------------- 35 | -------------------------------------------------------------------------------- /Project/MDK/RTE/_nor_sdram_zf_dtcm_v6/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'RT106X' 7 | * Target: 'nor_sdram_zf_dtcm_v6' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "fsl_device_registers.h" 18 | 19 | /* Keil.ARM Compiler::Compiler:I/O:STDOUT:Breakpoint:1.2.0 */ 20 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 21 | #define RTE_Compiler_IO_STDOUT_BKPT /* Compiler I/O: STDOUT Breakpoint */ 22 | 23 | 24 | #endif /* RTE_COMPONENTS_H */ 25 | -------------------------------------------------------------------------------- /Project/MDK/board/board.h: -------------------------------------------------------------------------------- 1 | #ifndef _BOARD_H_ 2 | #define _BOARD_H_ 3 | 4 | #include "RT106X_config.h" 5 | #include "clock_config.h" 6 | #include "fsl_common.h" 7 | #include "fsl_gpio.h" 8 | #include "fsl_clock.h" 9 | 10 | /* The UART to use for debug messages. */ 11 | #define BOARD_DEBUG_UART_TYPE kSerialPort_Uart 12 | #define BOARD_DEBUG_UART_INSTANCE 1 13 | 14 | #if (BOARD_DEBUG_UART_INSTANCE == 1) 15 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART1 16 | #define BOARD_UART_IRQ LPUART1_IRQn 17 | #define BOARD_UART_IRQ_HANDLER LPUART1_IRQHandler 18 | 19 | #elif (BOARD_DEBUG_UART_INSTANCE == 2) 20 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART2 21 | #define BOARD_UART_IRQ LPUART2_IRQn 22 | #define BOARD_UART_IRQ_HANDLER LPUART2_IRQHandler 23 | 24 | #elif (BOARD_DEBUG_UART_INSTANCE == 3) 25 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART3 26 | #define BOARD_UART_IRQ LPUART3_IRQn 27 | #define BOARD_UART_IRQ_HANDLER LPUART3_IRQHandler 28 | 29 | #elif (BOARD_DEBUG_UART_INSTANCE == 4) 30 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART4 31 | #define BOARD_UART_IRQ LPUART4_IRQn 32 | #define BOARD_UART_IRQ_HANDLER LPUART4_IRQHandler 33 | 34 | #elif (BOARD_DEBUG_UART_INSTANCE == 5) 35 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART5 36 | #define BOARD_UART_IRQ LPUART5_IRQn 37 | #define BOARD_UART_IRQ_HANDLER LPUART5_IRQHandler 38 | 39 | #elif (BOARD_DEBUG_UART_INSTANCE == 6) 40 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART6 41 | #define BOARD_UART_IRQ LPUART6_IRQn 42 | #define BOARD_UART_IRQ_HANDLER LPUART6_IRQHandler 43 | 44 | #elif (BOARD_DEBUG_UART_INSTANCE == 7) 45 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART7 46 | #define BOARD_UART_IRQ LPUART7_IRQn 47 | #define BOARD_UART_IRQ_HANDLER LPUART7_IRQHandler 48 | 49 | #elif (BOARD_DEBUG_UART_INSTANCE == 8) 50 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART8 51 | #define BOARD_UART_IRQ LPUART8_IRQn 52 | #define BOARD_UART_IRQ_HANDLER LPUART8_IRQHandler 53 | 54 | #endif 55 | 56 | #define BOARD_DEBUG_UART_CLK_FREQ BOARD_DebugConsoleSrcFreq() 57 | 58 | #ifndef BOARD_DEBUG_UART_BAUDRATE 59 | #define BOARD_DEBUG_UART_BAUDRATE (DEBUG_UART_BAUD) 60 | #endif /* BOARD_DEBUG_UART_BAUDRATE */ 61 | 62 | /*! @brief The board flash size */ 63 | #define BOARD_FLASH_SIZE (0x400000U) 64 | 65 | #if defined(__cplusplus) 66 | extern "C" { 67 | #endif /* __cplusplus */ 68 | 69 | uint32_t BOARD_DebugConsoleSrcFreq(void); 70 | void BOARD_InitDebugConsole(void); 71 | void BOARD_ConfigMPU(void); 72 | 73 | void board_init(void); 74 | 75 | #if defined(__cplusplus) 76 | } 77 | #endif /* __cplusplus */ 78 | 79 | #endif /* _BOARD_H_ */ 80 | -------------------------------------------------------------------------------- /Project/MDK/scf/MIMXRT1064xxxxx_flexspi_nor.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/MDK/scf/MIMXRT1064xxxxx_flexspi_nor.scf -------------------------------------------------------------------------------- /Project/MDK/scf/MIMXRT1064xxxxx_flexspi_nor_v5.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSU-iMag/ArtificialIntelligenceCar/8a8c2453d4102895c697e1068efd8200b471a309/Project/MDK/scf/MIMXRT1064xxxxx_flexspi_nor_v5.scf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 别看了 2 | ## 没用 3 | --------------------------------------------------------------------------------