From a575b1b02a0fe37e282da23828ed254de54c848d Mon Sep 17 00:00:00 2001 From: LibDriver <704839379@qq.com> Date: Thu, 25 Jul 2024 17:13:57 +0800 Subject: [PATCH] feat: first upload --- .github/ISSUE_TEMPLATE/1_bug_report.yml | 32 + .github/ISSUE_TEMPLATE/2_feature_request.yml | 28 + .../3_documentation_problem.yml | 30 + .github/ISSUE_TEMPLATE/4_ask_question.yml | 20 + .github/ISSUE_TEMPLATE/5_general_issues.yml | 20 + .github/ISSUE_TEMPLATE/config.yml | 1 + .github/PULL_REQUEST_TEMPLATE.md | 7 + CHANGELOG.md | 5 + CODE_OF_CONDUCT.md | 134 + CONTRIBUTING.md | 2080 ++ Doxyfile | 2664 +++ LICENSE | 21 + README.md | 153 + README_de.md | 152 + README_ja.md | 121 + README_ko.md | 121 + README_zh-Hans.md | 121 + README_zh-Hant.md | 121 + SECURITY.md | 33 + datasheet/qmc5883l_datasheet.pdf | Bin 0 -> 1149189 bytes doc/html/Doxygen.png | Bin 0 -> 2049 bytes doc/html/annotated.html | 106 + doc/html/annotated_dup.js | 5 + doc/html/bc_s.png | Bin 0 -> 676 bytes doc/html/bdwn.png | Bin 0 -> 147 bytes doc/html/classes.html | 106 + doc/html/closed.png | Bin 0 -> 132 bytes .../dir_11ec664f88f5f079ad4de1adb8458c37.html | 107 + .../dir_11ec664f88f5f079ad4de1adb8458c37.js | 4 + .../dir_13e138d54eb8818da29c3992edef070a.html | 117 + .../dir_13e138d54eb8818da29c3992edef070a.js | 7 + .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 111 + .../dir_68267d1309a1af8e8297ef4c3efbcdba.js | 5 + .../dir_b31d54d5631803016a26f28213a41162.html | 111 + .../dir_b31d54d5631803016a26f28213a41162.js | 5 + .../dir_cfafba98a580ce4b62f8a6fa96d7cbb0.html | 111 + .../dir_cfafba98a580ce4b62f8a6fa96d7cbb0.js | 5 + .../dir_e68e8157741866f444e17edd764ebbae.html | 107 + .../dir_e68e8157741866f444e17edd764ebbae.js | 4 + doc/html/doc.png | Bin 0 -> 746 bytes doc/html/doxygen.css | 1793 ++ doc/html/doxygen.svg | 26 + doc/html/driver__qmc5883l_8c.html | 633 + doc/html/driver__qmc5883l_8c.js | 48 + doc/html/driver__qmc5883l_8c_source.html | 950 + doc/html/driver__qmc5883l_8h.html | 287 + doc/html/driver__qmc5883l_8h.js | 64 + doc/html/driver__qmc5883l_8h_source.html | 309 + doc/html/driver__qmc5883l__basic_8c.html | 141 + doc/html/driver__qmc5883l__basic_8c.js | 6 + .../driver__qmc5883l__basic_8c_source.html | 258 + doc/html/driver__qmc5883l__basic_8h.html | 158 + doc/html/driver__qmc5883l__basic_8h.js | 12 + .../driver__qmc5883l__basic_8h_source.html | 132 + doc/html/driver__qmc5883l__interface_8h.html | 150 + doc/html/driver__qmc5883l__interface_8h.js | 9 + ...driver__qmc5883l__interface_8h_source.html | 135 + ...ver__qmc5883l__interface__template_8c.html | 150 + ...river__qmc5883l__interface__template_8c.js | 9 + ...c5883l__interface__template_8c_source.html | 140 + doc/html/driver__qmc5883l__read__test_8c.html | 135 + doc/html/driver__qmc5883l__read__test_8c.js | 4 + ...river__qmc5883l__read__test_8c_source.html | 356 + doc/html/driver__qmc5883l__read__test_8h.html | 135 + doc/html/driver__qmc5883l__read__test_8h.js | 4 + ...river__qmc5883l__read__test_8h_source.html | 120 + .../driver__qmc5883l__register__test_8c.html | 136 + .../driver__qmc5883l__register__test_8c.js | 4 + ...r__qmc5883l__register__test_8c_source.html | 620 + .../driver__qmc5883l__register__test_8h.html | 137 + .../driver__qmc5883l__register__test_8h.js | 4 + ...r__qmc5883l__register__test_8h_source.html | 120 + doc/html/dynsections.js | 128 + doc/html/files.html | 121 + doc/html/files_dup.js | 8 + doc/html/folderclosed.png | Bin 0 -> 616 bytes doc/html/folderopen.png | Bin 0 -> 597 bytes doc/html/functions.html | 146 + doc/html/functions_vars.html | 146 + doc/html/globals.html | 436 + doc/html/globals_defs.html | 225 + doc/html/globals_enum.html | 116 + doc/html/globals_eval.html | 149 + doc/html/globals_func.html | 236 + doc/html/globals_type.html | 104 + doc/html/group__qmc5883l__base__driver.html | 1380 ++ doc/html/group__qmc5883l__base__driver.js | 75 + doc/html/group__qmc5883l__driver.html | 129 + doc/html/group__qmc5883l__driver.js | 9 + .../group__qmc5883l__example__driver.html | 333 + doc/html/group__qmc5883l__example__driver.js | 12 + doc/html/group__qmc5883l__extend__driver.html | 240 + doc/html/group__qmc5883l__extend__driver.js | 5 + .../group__qmc5883l__interface__driver.html | 372 + .../group__qmc5883l__interface__driver.js | 9 + doc/html/group__qmc5883l__link__driver.html | 413 + doc/html/group__qmc5883l__link__driver.js | 10 + doc/html/group__qmc5883l__test__driver.html | 180 + doc/html/group__qmc5883l__test__driver.js | 5 + doc/html/index.html | 115 + doc/html/jquery.js | 35 + doc/html/mainpage_8h.html | 103 + doc/html/mainpage_8h_source.html | 102 + doc/html/menu.js | 51 + doc/html/menudata.js | 55 + doc/html/modules.html | 111 + doc/html/modules.js | 4 + doc/html/nav_f.png | Bin 0 -> 153 bytes doc/html/nav_g.png | Bin 0 -> 95 bytes doc/html/nav_h.png | Bin 0 -> 98 bytes doc/html/navtree.css | 146 + doc/html/navtree.js | 546 + doc/html/navtreedata.js | 58 + doc/html/navtreeindex0.js | 253 + doc/html/navtreeindex1.js | 20 + doc/html/open.png | Bin 0 -> 123 bytes doc/html/resize.js | 140 + doc/html/search/all_0.html | 37 + doc/html/search/all_0.js | 5 + doc/html/search/all_1.html | 37 + doc/html/search/all_1.js | 24 + doc/html/search/all_2.html | 37 + doc/html/search/all_2.js | 9 + doc/html/search/all_3.html | 37 + doc/html/search/all_3.js | 4 + doc/html/search/all_4.html | 37 + doc/html/search/all_4.js | 8 + doc/html/search/all_5.html | 37 + doc/html/search/all_5.js | 91 + doc/html/search/all_6.html | 37 + doc/html/search/all_6.js | 7 + doc/html/search/all_7.html | 37 + doc/html/search/all_7.js | 7 + doc/html/search/classes_0.html | 37 + doc/html/search/classes_0.js | 5 + doc/html/search/close.svg | 31 + doc/html/search/defines_0.html | 37 + doc/html/search/defines_0.js | 4 + doc/html/search/defines_1.html | 37 + doc/html/search/defines_1.js | 4 + doc/html/search/defines_2.html | 37 + doc/html/search/defines_2.js | 5 + doc/html/search/defines_3.html | 37 + doc/html/search/defines_3.js | 17 + doc/html/search/defines_4.html | 37 + doc/html/search/defines_4.js | 5 + doc/html/search/defines_5.html | 37 + doc/html/search/defines_5.js | 5 + doc/html/search/enums_0.html | 37 + doc/html/search/enums_0.js | 9 + doc/html/search/enumvalues_0.html | 37 + doc/html/search/enumvalues_0.js | 20 + doc/html/search/files_0.html | 37 + doc/html/search/files_0.js | 13 + doc/html/search/files_1.html | 37 + doc/html/search/files_1.js | 4 + doc/html/search/functions_0.html | 37 + doc/html/search/functions_0.js | 37 + doc/html/search/groups_0.html | 37 + doc/html/search/groups_0.js | 10 + doc/html/search/mag_sel.svg | 74 + doc/html/search/nomatches.html | 13 + doc/html/search/pages_0.html | 37 + doc/html/search/pages_0.js | 4 + doc/html/search/search.css | 257 + doc/html/search/search.js | 816 + doc/html/search/search_l.png | Bin 0 -> 567 bytes doc/html/search/search_m.png | Bin 0 -> 158 bytes doc/html/search/search_r.png | Bin 0 -> 553 bytes doc/html/search/searchdata.js | 45 + doc/html/search/typedefs_0.html | 37 + doc/html/search/typedefs_0.js | 5 + doc/html/search/variables_0.html | 37 + doc/html/search/variables_0.js | 4 + doc/html/search/variables_1.html | 37 + doc/html/search/variables_1.js | 6 + doc/html/search/variables_2.html | 37 + doc/html/search/variables_2.js | 9 + doc/html/search/variables_3.html | 37 + doc/html/search/variables_3.js | 5 + doc/html/search/variables_4.html | 37 + doc/html/search/variables_4.js | 5 + doc/html/search/variables_5.html | 37 + doc/html/search/variables_5.js | 5 + doc/html/splitbar.png | Bin 0 -> 314 bytes doc/html/structqmc5883l__handle__s.html | 253 + doc/html/structqmc5883l__handle__s.js | 10 + doc/html/structqmc5883l__info__s.html | 291 + doc/html/structqmc5883l__info__s.js | 12 + doc/html/sync_off.png | Bin 0 -> 853 bytes doc/html/sync_on.png | Bin 0 -> 845 bytes doc/html/tab_a.png | Bin 0 -> 142 bytes doc/html/tab_b.png | Bin 0 -> 169 bytes doc/html/tab_h.png | Bin 0 -> 177 bytes doc/html/tab_s.png | Bin 0 -> 184 bytes doc/html/tabs.css | 1 + doc/image/doxygen.png | Bin 0 -> 2049 bytes doc/image/logo.svg | 1 + doc/image/misra.svg | 6 + doc/mainpage/mainpage.h | 35 + example/driver_qmc5883l_basic.c | 180 + example/driver_qmc5883l_basic.h | 99 + interface/driver_qmc5883l_interface.h | 119 + .../driver_qmc5883l_interface_template.c | 113 + misra/README.md | 51 + misra/qmc5883l_polyspace_report.pdf | Bin 0 -> 757814 bytes project/raspberrypi4b/CMakeLists.txt | 212 + project/raspberrypi4b/J8Header.jpg | Bin 0 -> 89332 bytes project/raspberrypi4b/Makefile | 149 + project/raspberrypi4b/README.md | 276 + project/raspberrypi4b/cmake/VERSION | 1 + project/raspberrypi4b/cmake/config.cmake.in | 44 + project/raspberrypi4b/cmake/uninstall.cmake | 58 + .../raspberrypi4b_driver_qmc5883l_interface.c | 135 + project/raspberrypi4b/interface/inc/iic.h | 167 + project/raspberrypi4b/interface/src/iic.c | 365 + project/raspberrypi4b/src/main.c | 310 + project/stm32f407/EW/stm32f407.dep | 24 + project/stm32f407/EW/stm32f407.ewd | 1517 ++ project/stm32f407/EW/stm32f407.ewp | 1394 ++ project/stm32f407/EW/stm32f407.ewt | 1763 ++ project/stm32f407/EW/stm32f407.eww | 7 + project/stm32f407/MDK/stm32f407.uvprojx | 973 + project/stm32f407/README.md | 242 + project/stm32f407/cmsis/cmsis_armcc.h | 865 + project/stm32f407/cmsis/cmsis_armclang.h | 1869 ++ project/stm32f407/cmsis/cmsis_compiler.h | 266 + project/stm32f407/cmsis/cmsis_gcc.h | 2085 +++ project/stm32f407/cmsis/cmsis_iccarm.h | 935 + project/stm32f407/cmsis/cmsis_version.h | 39 + project/stm32f407/cmsis/core_armv8mbl.h | 1918 ++ project/stm32f407/cmsis/core_armv8mml.h | 2927 +++ project/stm32f407/cmsis/core_cm0.h | 949 + project/stm32f407/cmsis/core_cm0plus.h | 1083 ++ project/stm32f407/cmsis/core_cm1.h | 976 + project/stm32f407/cmsis/core_cm23.h | 1993 ++ project/stm32f407/cmsis/core_cm3.h | 1941 ++ project/stm32f407/cmsis/core_cm33.h | 3002 +++ project/stm32f407/cmsis/core_cm4.h | 2129 +++ project/stm32f407/cmsis/core_cm7.h | 2671 +++ project/stm32f407/cmsis/core_sc000.h | 1022 + project/stm32f407/cmsis/core_sc300.h | 1915 ++ project/stm32f407/cmsis/mpu_armv7.h | 270 + project/stm32f407/cmsis/mpu_armv8.h | 333 + project/stm32f407/cmsis/tz_context.h | 70 + .../src/stm32f407_driver_qmc5883l_interface.c | 127 + .../hal/asm/startup_stm32f407xx_ew.s | 621 + .../hal/asm/startup_stm32f407xx_mdk.s | 422 + .../hal/inc/Legacy/stm32_hal_legacy.h | 4014 ++++ .../hal/inc/Legacy/stm32f4xx_hal_can_legacy.h | 765 + .../hal/inc/Legacy/stm32f4xx_hal_eth_legacy.h | 2209 +++ .../stm32f407/hal/inc/stm32_assert_template.h | 56 + project/stm32f407/hal/inc/stm32f4xx_hal.h | 297 + project/stm32f407/hal/inc/stm32f4xx_hal_adc.h | 898 + .../stm32f407/hal/inc/stm32f4xx_hal_adc_ex.h | 407 + project/stm32f407/hal/inc/stm32f4xx_hal_can.h | 844 + project/stm32f407/hal/inc/stm32f4xx_hal_cec.h | 792 + .../hal/inc/stm32f4xx_hal_conf_template.h | 500 + .../stm32f407/hal/inc/stm32f4xx_hal_cortex.h | 407 + project/stm32f407/hal/inc/stm32f4xx_hal_crc.h | 181 + .../stm32f407/hal/inc/stm32f4xx_hal_cryp.h | 683 + .../stm32f407/hal/inc/stm32f4xx_hal_cryp_ex.h | 142 + project/stm32f407/hal/inc/stm32f4xx_hal_dac.h | 480 + .../stm32f407/hal/inc/stm32f4xx_hal_dac_ex.h | 205 + .../stm32f407/hal/inc/stm32f4xx_hal_dcmi.h | 563 + .../stm32f407/hal/inc/stm32f4xx_hal_dcmi_ex.h | 208 + project/stm32f407/hal/inc/stm32f4xx_hal_def.h | 210 + .../stm32f407/hal/inc/stm32f4xx_hal_dfsdm.h | 1141 ++ project/stm32f407/hal/inc/stm32f4xx_hal_dma.h | 802 + .../stm32f407/hal/inc/stm32f4xx_hal_dma2d.h | 638 + .../stm32f407/hal/inc/stm32f4xx_hal_dma_ex.h | 102 + project/stm32f407/hal/inc/stm32f4xx_hal_dsi.h | 1377 ++ project/stm32f407/hal/inc/stm32f4xx_hal_eth.h | 2144 +++ .../stm32f407/hal/inc/stm32f4xx_hal_exti.h | 366 + .../stm32f407/hal/inc/stm32f4xx_hal_flash.h | 425 + .../hal/inc/stm32f4xx_hal_flash_ex.h | 1063 ++ .../hal/inc/stm32f4xx_hal_flash_ramfunc.h | 76 + .../stm32f407/hal/inc/stm32f4xx_hal_fmpi2c.h | 837 + .../hal/inc/stm32f4xx_hal_fmpi2c_ex.h | 150 + .../hal/inc/stm32f4xx_hal_fmpsmbus.h | 790 + .../hal/inc/stm32f4xx_hal_fmpsmbus_ex.h | 136 + .../stm32f407/hal/inc/stm32f4xx_hal_gpio.h | 325 + .../stm32f407/hal/inc/stm32f4xx_hal_gpio_ex.h | 1590 ++ .../stm32f407/hal/inc/stm32f4xx_hal_hash.h | 634 + .../stm32f407/hal/inc/stm32f4xx_hal_hash_ex.h | 175 + project/stm32f407/hal/inc/stm32f4xx_hal_hcd.h | 316 + project/stm32f407/hal/inc/stm32f4xx_hal_i2c.h | 741 + .../stm32f407/hal/inc/stm32f4xx_hal_i2c_ex.h | 115 + project/stm32f407/hal/inc/stm32f4xx_hal_i2s.h | 618 + .../stm32f407/hal/inc/stm32f4xx_hal_i2s_ex.h | 183 + .../stm32f407/hal/inc/stm32f4xx_hal_irda.h | 682 + .../stm32f407/hal/inc/stm32f4xx_hal_iwdg.h | 220 + .../stm32f407/hal/inc/stm32f4xx_hal_lptim.h | 857 + .../stm32f407/hal/inc/stm32f4xx_hal_ltdc.h | 719 + .../stm32f407/hal/inc/stm32f4xx_hal_ltdc_ex.h | 83 + project/stm32f407/hal/inc/stm32f4xx_hal_mmc.h | 747 + .../stm32f407/hal/inc/stm32f4xx_hal_nand.h | 388 + project/stm32f407/hal/inc/stm32f4xx_hal_nor.h | 330 + .../stm32f407/hal/inc/stm32f4xx_hal_pccard.h | 285 + project/stm32f407/hal/inc/stm32f4xx_hal_pcd.h | 459 + .../stm32f407/hal/inc/stm32f4xx_hal_pcd_ex.h | 88 + project/stm32f407/hal/inc/stm32f4xx_hal_pwr.h | 427 + .../stm32f407/hal/inc/stm32f4xx_hal_pwr_ex.h | 340 + .../stm32f407/hal/inc/stm32f4xx_hal_qspi.h | 750 + project/stm32f407/hal/inc/stm32f4xx_hal_rcc.h | 1459 ++ .../stm32f407/hal/inc/stm32f4xx_hal_rcc_ex.h | 7111 +++++++ project/stm32f407/hal/inc/stm32f4xx_hal_rng.h | 361 + project/stm32f407/hal/inc/stm32f4xx_hal_rtc.h | 915 + .../stm32f407/hal/inc/stm32f4xx_hal_rtc_ex.h | 1079 ++ project/stm32f407/hal/inc/stm32f4xx_hal_sai.h | 895 + .../stm32f407/hal/inc/stm32f4xx_hal_sai_ex.h | 114 + project/stm32f407/hal/inc/stm32f4xx_hal_sd.h | 758 + .../stm32f407/hal/inc/stm32f4xx_hal_sdram.h | 238 + .../hal/inc/stm32f4xx_hal_smartcard.h | 755 + .../stm32f407/hal/inc/stm32f4xx_hal_smbus.h | 731 + .../stm32f407/hal/inc/stm32f4xx_hal_spdifrx.h | 604 + project/stm32f407/hal/inc/stm32f4xx_hal_spi.h | 729 + .../stm32f407/hal/inc/stm32f4xx_hal_sram.h | 236 + project/stm32f407/hal/inc/stm32f4xx_hal_tim.h | 2146 +++ .../stm32f407/hal/inc/stm32f4xx_hal_tim_ex.h | 354 + .../stm32f407/hal/inc/stm32f4xx_hal_uart.h | 884 + .../stm32f407/hal/inc/stm32f4xx_hal_usart.h | 648 + .../stm32f407/hal/inc/stm32f4xx_hal_wwdg.h | 298 + project/stm32f407/hal/inc/stm32f4xx_ll_adc.h | 4779 +++++ project/stm32f407/hal/inc/stm32f4xx_ll_bus.h | 2105 +++ .../stm32f407/hal/inc/stm32f4xx_ll_cortex.h | 637 + project/stm32f407/hal/inc/stm32f4xx_ll_crc.h | 201 + project/stm32f407/hal/inc/stm32f4xx_ll_dac.h | 1455 ++ project/stm32f407/hal/inc/stm32f4xx_ll_dma.h | 2868 +++ .../stm32f407/hal/inc/stm32f4xx_ll_dma2d.h | 1901 ++ project/stm32f407/hal/inc/stm32f4xx_ll_exti.h | 954 + project/stm32f407/hal/inc/stm32f4xx_ll_fmc.h | 1416 ++ .../stm32f407/hal/inc/stm32f4xx_ll_fmpi2c.h | 2234 +++ project/stm32f407/hal/inc/stm32f4xx_ll_fsmc.h | 1086 ++ project/stm32f407/hal/inc/stm32f4xx_ll_gpio.h | 981 + project/stm32f407/hal/inc/stm32f4xx_ll_i2c.h | 1890 ++ project/stm32f407/hal/inc/stm32f4xx_ll_iwdg.h | 302 + .../stm32f407/hal/inc/stm32f4xx_ll_lptim.h | 1378 ++ project/stm32f407/hal/inc/stm32f4xx_ll_pwr.h | 985 + project/stm32f407/hal/inc/stm32f4xx_ll_rcc.h | 7096 +++++++ project/stm32f407/hal/inc/stm32f4xx_ll_rng.h | 335 + project/stm32f407/hal/inc/stm32f4xx_ll_rtc.h | 3663 ++++ .../stm32f407/hal/inc/stm32f4xx_ll_sdmmc.h | 1141 ++ project/stm32f407/hal/inc/stm32f4xx_ll_spi.h | 2027 ++ .../stm32f407/hal/inc/stm32f4xx_ll_system.h | 1711 ++ project/stm32f407/hal/inc/stm32f4xx_ll_tim.h | 4093 ++++ .../stm32f407/hal/inc/stm32f4xx_ll_usart.h | 2521 +++ project/stm32f407/hal/inc/stm32f4xx_ll_usb.h | 536 + .../stm32f407/hal/inc/stm32f4xx_ll_utils.h | 307 + project/stm32f407/hal/inc/stm32f4xx_ll_wwdg.h | 316 + .../hal/src/Legacy/stm32f4xx_hal_can.c | 1679 ++ .../hal/src/Legacy/stm32f4xx_hal_eth.c | 2307 +++ project/stm32f407/hal/src/stm32f4xx_hal.c | 615 + project/stm32f407/hal/src/stm32f4xx_hal_adc.c | 2110 +++ .../stm32f407/hal/src/stm32f4xx_hal_adc_ex.c | 1112 ++ project/stm32f407/hal/src/stm32f4xx_hal_can.c | 2462 +++ project/stm32f407/hal/src/stm32f4xx_hal_cec.c | 996 + .../stm32f407/hal/src/stm32f4xx_hal_cortex.c | 502 + project/stm32f407/hal/src/stm32f4xx_hal_crc.c | 328 + .../stm32f407/hal/src/stm32f4xx_hal_cryp.c | 7132 +++++++ .../stm32f407/hal/src/stm32f4xx_hal_cryp_ex.c | 680 + project/stm32f407/hal/src/stm32f4xx_hal_dac.c | 1341 ++ .../stm32f407/hal/src/stm32f4xx_hal_dac_ex.c | 495 + .../stm32f407/hal/src/stm32f4xx_hal_dcmi.c | 1161 ++ .../stm32f407/hal/src/stm32f4xx_hal_dcmi_ex.c | 182 + .../stm32f407/hal/src/stm32f4xx_hal_dfsdm.c | 4423 +++++ project/stm32f407/hal/src/stm32f4xx_hal_dma.c | 1305 ++ .../stm32f407/hal/src/stm32f4xx_hal_dma2d.c | 2126 +++ .../stm32f407/hal/src/stm32f4xx_hal_dma_ex.c | 313 + project/stm32f407/hal/src/stm32f4xx_hal_dsi.c | 2760 +++ project/stm32f407/hal/src/stm32f4xx_hal_eth.c | 3220 ++++ .../stm32f407/hal/src/stm32f4xx_hal_exti.c | 547 + .../stm32f407/hal/src/stm32f4xx_hal_flash.c | 775 + .../hal/src/stm32f4xx_hal_flash_ex.c | 1347 ++ .../hal/src/stm32f4xx_hal_flash_ramfunc.c | 172 + .../stm32f407/hal/src/stm32f4xx_hal_fmpi2c.c | 6864 +++++++ .../hal/src/stm32f4xx_hal_fmpi2c_ex.c | 258 + .../hal/src/stm32f4xx_hal_fmpsmbus.c | 2749 +++ .../hal/src/stm32f4xx_hal_fmpsmbus_ex.c | 145 + .../stm32f407/hal/src/stm32f4xx_hal_gpio.c | 533 + .../stm32f407/hal/src/stm32f4xx_hal_hash.c | 3514 ++++ .../stm32f407/hal/src/stm32f4xx_hal_hash_ex.c | 1040 + project/stm32f407/hal/src/stm32f4xx_hal_hcd.c | 1728 ++ project/stm32f407/hal/src/stm32f4xx_hal_i2c.c | 7524 ++++++++ .../stm32f407/hal/src/stm32f4xx_hal_i2c_ex.c | 182 + project/stm32f407/hal/src/stm32f4xx_hal_i2s.c | 2094 +++ .../stm32f407/hal/src/stm32f4xx_hal_i2s_ex.c | 1135 ++ .../stm32f407/hal/src/stm32f4xx_hal_irda.c | 2687 +++ .../stm32f407/hal/src/stm32f4xx_hal_iwdg.c | 262 + .../stm32f407/hal/src/stm32f4xx_hal_lptim.c | 2484 +++ .../stm32f407/hal/src/stm32f4xx_hal_ltdc.c | 2215 +++ .../stm32f407/hal/src/stm32f4xx_hal_ltdc_ex.c | 151 + project/stm32f407/hal/src/stm32f4xx_hal_mmc.c | 3201 ++++ .../hal/src/stm32f4xx_hal_msp_template.c | 100 + .../stm32f407/hal/src/stm32f4xx_hal_nand.c | 2405 +++ project/stm32f407/hal/src/stm32f4xx_hal_nor.c | 1543 ++ .../stm32f407/hal/src/stm32f4xx_hal_pccard.c | 946 + project/stm32f407/hal/src/stm32f4xx_hal_pcd.c | 2387 +++ .../stm32f407/hal/src/stm32f4xx_hal_pcd_ex.c | 341 + project/stm32f407/hal/src/stm32f4xx_hal_pwr.c | 571 + .../stm32f407/hal/src/stm32f4xx_hal_pwr_ex.c | 600 + .../stm32f407/hal/src/stm32f4xx_hal_qspi.c | 2915 +++ project/stm32f407/hal/src/stm32f4xx_hal_rcc.c | 1122 ++ .../stm32f407/hal/src/stm32f4xx_hal_rcc_ex.c | 3784 ++++ project/stm32f407/hal/src/stm32f4xx_hal_rng.c | 867 + project/stm32f407/hal/src/stm32f4xx_hal_rtc.c | 1896 ++ .../stm32f407/hal/src/stm32f4xx_hal_rtc_ex.c | 1878 ++ project/stm32f407/hal/src/stm32f4xx_hal_sai.c | 2554 +++ .../stm32f407/hal/src/stm32f4xx_hal_sai_ex.c | 310 + project/stm32f407/hal/src/stm32f4xx_hal_sd.c | 3277 ++++ .../stm32f407/hal/src/stm32f4xx_hal_sdram.c | 1308 ++ .../hal/src/stm32f4xx_hal_smartcard.c | 2364 +++ .../stm32f407/hal/src/stm32f4xx_hal_smbus.c | 2784 +++ .../stm32f407/hal/src/stm32f4xx_hal_spdifrx.c | 1627 ++ project/stm32f407/hal/src/stm32f4xx_hal_spi.c | 3915 ++++ .../stm32f407/hal/src/stm32f4xx_hal_sram.c | 1110 ++ project/stm32f407/hal/src/stm32f4xx_hal_tim.c | 7621 ++++++++ .../stm32f407/hal/src/stm32f4xx_hal_tim_ex.c | 2428 +++ ...tm32f4xx_hal_timebase_rtc_alarm_template.c | 318 + ...m32f4xx_hal_timebase_rtc_wakeup_template.c | 293 + .../src/stm32f4xx_hal_timebase_tim_template.c | 177 + .../stm32f407/hal/src/stm32f4xx_hal_uart.c | 3751 ++++ .../stm32f407/hal/src/stm32f4xx_hal_usart.c | 2838 +++ .../stm32f407/hal/src/stm32f4xx_hal_wwdg.c | 420 + project/stm32f407/hal/src/stm32f4xx_ll_adc.c | 922 + project/stm32f407/hal/src/stm32f4xx_ll_crc.c | 103 + project/stm32f407/hal/src/stm32f4xx_ll_dac.c | 280 + project/stm32f407/hal/src/stm32f4xx_ll_dma.c | 423 + .../stm32f407/hal/src/stm32f4xx_ll_dma2d.c | 594 + project/stm32f407/hal/src/stm32f4xx_ll_exti.c | 212 + project/stm32f407/hal/src/stm32f4xx_ll_fmc.c | 1498 ++ .../stm32f407/hal/src/stm32f4xx_ll_fmpi2c.c | 217 + project/stm32f407/hal/src/stm32f4xx_ll_fsmc.c | 1062 ++ project/stm32f407/hal/src/stm32f4xx_ll_gpio.c | 303 + project/stm32f407/hal/src/stm32f4xx_ll_i2c.c | 251 + .../stm32f407/hal/src/stm32f4xx_ll_lptim.c | 301 + project/stm32f407/hal/src/stm32f4xx_ll_pwr.c | 81 + project/stm32f407/hal/src/stm32f4xx_ll_rcc.c | 1660 ++ project/stm32f407/hal/src/stm32f4xx_ll_rng.c | 111 + project/stm32f407/hal/src/stm32f4xx_ll_rtc.c | 838 + .../stm32f407/hal/src/stm32f4xx_ll_sdmmc.c | 1578 ++ project/stm32f407/hal/src/stm32f4xx_ll_spi.c | 624 + project/stm32f407/hal/src/stm32f4xx_ll_tim.c | 1189 ++ .../stm32f407/hal/src/stm32f4xx_ll_usart.c | 500 + project/stm32f407/hal/src/stm32f4xx_ll_usb.c | 2224 +++ .../stm32f407/hal/src/stm32f4xx_ll_utils.c | 749 + project/stm32f407/interface/inc/clock.h | 66 + project/stm32f407/interface/inc/delay.h | 82 + project/stm32f407/interface/inc/iic.h | 152 + project/stm32f407/interface/inc/uart.h | 206 + project/stm32f407/interface/src/clock.c | 92 + project/stm32f407/interface/src/delay.c | 109 + project/stm32f407/interface/src/iic.c | 613 + project/stm32f407/interface/src/uart.c | 436 + project/stm32f407/output/mdk/obj_delete.bat | 25 + project/stm32f407/usr/inc/getopt.h | 127 + project/stm32f407/usr/inc/shell.h | 123 + project/stm32f407/usr/inc/stm32f407xx.h | 15607 ++++++++++++++++ project/stm32f407/usr/inc/stm32f4xx.h | 301 + .../stm32f407/usr/inc/stm32f4xx_hal_conf.h | 394 + project/stm32f407/usr/inc/stm32f4xx_it.h | 125 + project/stm32f407/usr/inc/system_stm32f4xx.h | 104 + project/stm32f407/usr/src/getopt.c | 754 + project/stm32f407/usr/src/main.c | 351 + project/stm32f407/usr/src/shell.c | 215 + project/stm32f407/usr/src/stm32f4xx_hal_msp.c | 152 + project/stm32f407/usr/src/stm32f4xx_it.c | 213 + project/stm32f407/usr/src/system_stm32f4xx.c | 747 + src/driver_qmc5883l.c | 1091 ++ src/driver_qmc5883l.h | 553 + test/driver_qmc5883l_read_test.c | 254 + test/driver_qmc5883l_read_test.h | 69 + test/driver_qmc5883l_register_test.c | 498 + test/driver_qmc5883l_register_test.h | 71 + 474 files changed, 343336 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/1_bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/2_feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/3_documentation_problem.yml create mode 100644 .github/ISSUE_TEMPLATE/4_ask_question.yml create mode 100644 .github/ISSUE_TEMPLATE/5_general_issues.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Doxyfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 README_de.md create mode 100644 README_ja.md create mode 100644 README_ko.md create mode 100644 README_zh-Hans.md create mode 100644 README_zh-Hant.md create mode 100644 SECURITY.md create mode 100644 datasheet/qmc5883l_datasheet.pdf create mode 100644 doc/html/Doxygen.png create mode 100644 doc/html/annotated.html create mode 100644 doc/html/annotated_dup.js create mode 100644 doc/html/bc_s.png create mode 100644 doc/html/bdwn.png create mode 100644 doc/html/classes.html create mode 100644 doc/html/closed.png create mode 100644 doc/html/dir_11ec664f88f5f079ad4de1adb8458c37.html create mode 100644 doc/html/dir_11ec664f88f5f079ad4de1adb8458c37.js create mode 100644 doc/html/dir_13e138d54eb8818da29c3992edef070a.html create mode 100644 doc/html/dir_13e138d54eb8818da29c3992edef070a.js create mode 100644 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html create mode 100644 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.js create mode 100644 doc/html/dir_b31d54d5631803016a26f28213a41162.html create mode 100644 doc/html/dir_b31d54d5631803016a26f28213a41162.js create mode 100644 doc/html/dir_cfafba98a580ce4b62f8a6fa96d7cbb0.html create mode 100644 doc/html/dir_cfafba98a580ce4b62f8a6fa96d7cbb0.js create mode 100644 doc/html/dir_e68e8157741866f444e17edd764ebbae.html create mode 100644 doc/html/dir_e68e8157741866f444e17edd764ebbae.js create mode 100644 doc/html/doc.png create mode 100644 doc/html/doxygen.css create mode 100644 doc/html/doxygen.svg create mode 100644 doc/html/driver__qmc5883l_8c.html create mode 100644 doc/html/driver__qmc5883l_8c.js create mode 100644 doc/html/driver__qmc5883l_8c_source.html create mode 100644 doc/html/driver__qmc5883l_8h.html create mode 100644 doc/html/driver__qmc5883l_8h.js create mode 100644 doc/html/driver__qmc5883l_8h_source.html create mode 100644 doc/html/driver__qmc5883l__basic_8c.html create mode 100644 doc/html/driver__qmc5883l__basic_8c.js create mode 100644 doc/html/driver__qmc5883l__basic_8c_source.html create mode 100644 doc/html/driver__qmc5883l__basic_8h.html create mode 100644 doc/html/driver__qmc5883l__basic_8h.js create mode 100644 doc/html/driver__qmc5883l__basic_8h_source.html create mode 100644 doc/html/driver__qmc5883l__interface_8h.html create mode 100644 doc/html/driver__qmc5883l__interface_8h.js create mode 100644 doc/html/driver__qmc5883l__interface_8h_source.html create mode 100644 doc/html/driver__qmc5883l__interface__template_8c.html create mode 100644 doc/html/driver__qmc5883l__interface__template_8c.js create mode 100644 doc/html/driver__qmc5883l__interface__template_8c_source.html create mode 100644 doc/html/driver__qmc5883l__read__test_8c.html create mode 100644 doc/html/driver__qmc5883l__read__test_8c.js create mode 100644 doc/html/driver__qmc5883l__read__test_8c_source.html create mode 100644 doc/html/driver__qmc5883l__read__test_8h.html create mode 100644 doc/html/driver__qmc5883l__read__test_8h.js create mode 100644 doc/html/driver__qmc5883l__read__test_8h_source.html create mode 100644 doc/html/driver__qmc5883l__register__test_8c.html create mode 100644 doc/html/driver__qmc5883l__register__test_8c.js create mode 100644 doc/html/driver__qmc5883l__register__test_8c_source.html create mode 100644 doc/html/driver__qmc5883l__register__test_8h.html create mode 100644 doc/html/driver__qmc5883l__register__test_8h.js create mode 100644 doc/html/driver__qmc5883l__register__test_8h_source.html create mode 100644 doc/html/dynsections.js create mode 100644 doc/html/files.html create mode 100644 doc/html/files_dup.js create mode 100644 doc/html/folderclosed.png create mode 100644 doc/html/folderopen.png create mode 100644 doc/html/functions.html create mode 100644 doc/html/functions_vars.html create mode 100644 doc/html/globals.html create mode 100644 doc/html/globals_defs.html create mode 100644 doc/html/globals_enum.html create mode 100644 doc/html/globals_eval.html create mode 100644 doc/html/globals_func.html create mode 100644 doc/html/globals_type.html create mode 100644 doc/html/group__qmc5883l__base__driver.html create mode 100644 doc/html/group__qmc5883l__base__driver.js create mode 100644 doc/html/group__qmc5883l__driver.html create mode 100644 doc/html/group__qmc5883l__driver.js create mode 100644 doc/html/group__qmc5883l__example__driver.html create mode 100644 doc/html/group__qmc5883l__example__driver.js create mode 100644 doc/html/group__qmc5883l__extend__driver.html create mode 100644 doc/html/group__qmc5883l__extend__driver.js create mode 100644 doc/html/group__qmc5883l__interface__driver.html create mode 100644 doc/html/group__qmc5883l__interface__driver.js create mode 100644 doc/html/group__qmc5883l__link__driver.html create mode 100644 doc/html/group__qmc5883l__link__driver.js create mode 100644 doc/html/group__qmc5883l__test__driver.html create mode 100644 doc/html/group__qmc5883l__test__driver.js create mode 100644 doc/html/index.html create mode 100644 doc/html/jquery.js create mode 100644 doc/html/mainpage_8h.html create mode 100644 doc/html/mainpage_8h_source.html create mode 100644 doc/html/menu.js create mode 100644 doc/html/menudata.js create mode 100644 doc/html/modules.html create mode 100644 doc/html/modules.js create mode 100644 doc/html/nav_f.png create mode 100644 doc/html/nav_g.png create mode 100644 doc/html/nav_h.png create mode 100644 doc/html/navtree.css create mode 100644 doc/html/navtree.js create mode 100644 doc/html/navtreedata.js create mode 100644 doc/html/navtreeindex0.js create mode 100644 doc/html/navtreeindex1.js create mode 100644 doc/html/open.png create mode 100644 doc/html/resize.js create mode 100644 doc/html/search/all_0.html create mode 100644 doc/html/search/all_0.js create mode 100644 doc/html/search/all_1.html create mode 100644 doc/html/search/all_1.js create mode 100644 doc/html/search/all_2.html create mode 100644 doc/html/search/all_2.js create mode 100644 doc/html/search/all_3.html create mode 100644 doc/html/search/all_3.js create mode 100644 doc/html/search/all_4.html create mode 100644 doc/html/search/all_4.js create mode 100644 doc/html/search/all_5.html create mode 100644 doc/html/search/all_5.js create mode 100644 doc/html/search/all_6.html create mode 100644 doc/html/search/all_6.js create mode 100644 doc/html/search/all_7.html create mode 100644 doc/html/search/all_7.js create mode 100644 doc/html/search/classes_0.html create mode 100644 doc/html/search/classes_0.js create mode 100644 doc/html/search/close.svg create mode 100644 doc/html/search/defines_0.html create mode 100644 doc/html/search/defines_0.js create mode 100644 doc/html/search/defines_1.html create mode 100644 doc/html/search/defines_1.js create mode 100644 doc/html/search/defines_2.html create mode 100644 doc/html/search/defines_2.js create mode 100644 doc/html/search/defines_3.html create mode 100644 doc/html/search/defines_3.js create mode 100644 doc/html/search/defines_4.html create mode 100644 doc/html/search/defines_4.js create mode 100644 doc/html/search/defines_5.html create mode 100644 doc/html/search/defines_5.js create mode 100644 doc/html/search/enums_0.html create mode 100644 doc/html/search/enums_0.js create mode 100644 doc/html/search/enumvalues_0.html create mode 100644 doc/html/search/enumvalues_0.js create mode 100644 doc/html/search/files_0.html create mode 100644 doc/html/search/files_0.js create mode 100644 doc/html/search/files_1.html create mode 100644 doc/html/search/files_1.js create mode 100644 doc/html/search/functions_0.html create mode 100644 doc/html/search/functions_0.js create mode 100644 doc/html/search/groups_0.html create mode 100644 doc/html/search/groups_0.js create mode 100644 doc/html/search/mag_sel.svg create mode 100644 doc/html/search/nomatches.html create mode 100644 doc/html/search/pages_0.html create mode 100644 doc/html/search/pages_0.js create mode 100644 doc/html/search/search.css create mode 100644 doc/html/search/search.js create mode 100644 doc/html/search/search_l.png create mode 100644 doc/html/search/search_m.png create mode 100644 doc/html/search/search_r.png create mode 100644 doc/html/search/searchdata.js create mode 100644 doc/html/search/typedefs_0.html create mode 100644 doc/html/search/typedefs_0.js create mode 100644 doc/html/search/variables_0.html create mode 100644 doc/html/search/variables_0.js create mode 100644 doc/html/search/variables_1.html create mode 100644 doc/html/search/variables_1.js create mode 100644 doc/html/search/variables_2.html create mode 100644 doc/html/search/variables_2.js create mode 100644 doc/html/search/variables_3.html create mode 100644 doc/html/search/variables_3.js create mode 100644 doc/html/search/variables_4.html create mode 100644 doc/html/search/variables_4.js create mode 100644 doc/html/search/variables_5.html create mode 100644 doc/html/search/variables_5.js create mode 100644 doc/html/splitbar.png create mode 100644 doc/html/structqmc5883l__handle__s.html create mode 100644 doc/html/structqmc5883l__handle__s.js create mode 100644 doc/html/structqmc5883l__info__s.html create mode 100644 doc/html/structqmc5883l__info__s.js create mode 100644 doc/html/sync_off.png create mode 100644 doc/html/sync_on.png create mode 100644 doc/html/tab_a.png create mode 100644 doc/html/tab_b.png create mode 100644 doc/html/tab_h.png create mode 100644 doc/html/tab_s.png create mode 100644 doc/html/tabs.css create mode 100644 doc/image/doxygen.png create mode 100644 doc/image/logo.svg create mode 100644 doc/image/misra.svg create mode 100644 doc/mainpage/mainpage.h create mode 100644 example/driver_qmc5883l_basic.c create mode 100644 example/driver_qmc5883l_basic.h create mode 100644 interface/driver_qmc5883l_interface.h create mode 100644 interface/driver_qmc5883l_interface_template.c create mode 100644 misra/README.md create mode 100644 misra/qmc5883l_polyspace_report.pdf create mode 100644 project/raspberrypi4b/CMakeLists.txt create mode 100644 project/raspberrypi4b/J8Header.jpg create mode 100644 project/raspberrypi4b/Makefile create mode 100644 project/raspberrypi4b/README.md create mode 100644 project/raspberrypi4b/cmake/VERSION create mode 100644 project/raspberrypi4b/cmake/config.cmake.in create mode 100644 project/raspberrypi4b/cmake/uninstall.cmake create mode 100644 project/raspberrypi4b/driver/src/raspberrypi4b_driver_qmc5883l_interface.c create mode 100644 project/raspberrypi4b/interface/inc/iic.h create mode 100644 project/raspberrypi4b/interface/src/iic.c create mode 100644 project/raspberrypi4b/src/main.c create mode 100644 project/stm32f407/EW/stm32f407.dep create mode 100644 project/stm32f407/EW/stm32f407.ewd create mode 100644 project/stm32f407/EW/stm32f407.ewp create mode 100644 project/stm32f407/EW/stm32f407.ewt create mode 100644 project/stm32f407/EW/stm32f407.eww create mode 100644 project/stm32f407/MDK/stm32f407.uvprojx create mode 100644 project/stm32f407/README.md create mode 100644 project/stm32f407/cmsis/cmsis_armcc.h create mode 100644 project/stm32f407/cmsis/cmsis_armclang.h create mode 100644 project/stm32f407/cmsis/cmsis_compiler.h create mode 100644 project/stm32f407/cmsis/cmsis_gcc.h create mode 100644 project/stm32f407/cmsis/cmsis_iccarm.h create mode 100644 project/stm32f407/cmsis/cmsis_version.h create mode 100644 project/stm32f407/cmsis/core_armv8mbl.h create mode 100644 project/stm32f407/cmsis/core_armv8mml.h create mode 100644 project/stm32f407/cmsis/core_cm0.h create mode 100644 project/stm32f407/cmsis/core_cm0plus.h create mode 100644 project/stm32f407/cmsis/core_cm1.h create mode 100644 project/stm32f407/cmsis/core_cm23.h create mode 100644 project/stm32f407/cmsis/core_cm3.h create mode 100644 project/stm32f407/cmsis/core_cm33.h create mode 100644 project/stm32f407/cmsis/core_cm4.h create mode 100644 project/stm32f407/cmsis/core_cm7.h create mode 100644 project/stm32f407/cmsis/core_sc000.h create mode 100644 project/stm32f407/cmsis/core_sc300.h create mode 100644 project/stm32f407/cmsis/mpu_armv7.h create mode 100644 project/stm32f407/cmsis/mpu_armv8.h create mode 100644 project/stm32f407/cmsis/tz_context.h create mode 100644 project/stm32f407/driver/src/stm32f407_driver_qmc5883l_interface.c create mode 100644 project/stm32f407/hal/asm/startup_stm32f407xx_ew.s create mode 100644 project/stm32f407/hal/asm/startup_stm32f407xx_mdk.s create mode 100644 project/stm32f407/hal/inc/Legacy/stm32_hal_legacy.h create mode 100644 project/stm32f407/hal/inc/Legacy/stm32f4xx_hal_can_legacy.h create mode 100644 project/stm32f407/hal/inc/Legacy/stm32f4xx_hal_eth_legacy.h create mode 100644 project/stm32f407/hal/inc/stm32_assert_template.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_adc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_adc_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_can.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_cec.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_conf_template.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_cortex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_crc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_cryp.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_cryp_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dac.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dac_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dcmi.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dcmi_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_def.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dfsdm.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dma.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dma2d.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dma_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_dsi.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_eth.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_exti.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_flash.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_flash_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_flash_ramfunc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_fmpi2c.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_fmpi2c_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_fmpsmbus.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_fmpsmbus_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_gpio.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_gpio_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_hash.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_hash_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_hcd.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_i2c.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_i2c_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_i2s.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_i2s_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_irda.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_iwdg.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_lptim.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_ltdc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_ltdc_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_mmc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_nand.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_nor.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_pccard.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_pcd.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_pcd_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_pwr.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_pwr_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_qspi.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_rcc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_rcc_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_rng.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_rtc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_rtc_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_sai.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_sai_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_sd.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_sdram.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_smartcard.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_smbus.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_spdifrx.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_spi.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_sram.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_tim.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_tim_ex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_uart.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_usart.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_hal_wwdg.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_adc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_bus.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_cortex.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_crc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_dac.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_dma.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_dma2d.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_exti.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_fmc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_fmpi2c.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_fsmc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_gpio.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_i2c.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_iwdg.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_lptim.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_pwr.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_rcc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_rng.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_rtc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_sdmmc.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_spi.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_system.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_tim.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_usart.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_usb.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_utils.h create mode 100644 project/stm32f407/hal/inc/stm32f4xx_ll_wwdg.h create mode 100644 project/stm32f407/hal/src/Legacy/stm32f4xx_hal_can.c create mode 100644 project/stm32f407/hal/src/Legacy/stm32f4xx_hal_eth.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_adc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_adc_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_can.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_cec.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_cortex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_crc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_cryp.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_cryp_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dac.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dac_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dcmi.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dcmi_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dfsdm.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dma.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dma2d.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dma_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_dsi.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_eth.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_exti.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_flash.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_flash_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_flash_ramfunc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_fmpi2c.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_fmpi2c_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_fmpsmbus.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_fmpsmbus_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_gpio.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_hash.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_hash_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_hcd.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_i2c.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_i2c_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_i2s.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_i2s_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_irda.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_iwdg.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_lptim.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_ltdc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_ltdc_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_mmc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_msp_template.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_nand.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_nor.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_pccard.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_pcd.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_pcd_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_pwr.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_pwr_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_qspi.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_rcc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_rcc_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_rng.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_rtc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_rtc_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_sai.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_sai_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_sd.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_sdram.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_smartcard.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_smbus.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_spdifrx.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_spi.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_sram.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_tim.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_tim_ex.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_timebase_rtc_alarm_template.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_timebase_rtc_wakeup_template.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_timebase_tim_template.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_uart.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_usart.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_hal_wwdg.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_adc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_crc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_dac.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_dma.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_dma2d.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_exti.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_fmc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_fmpi2c.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_fsmc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_gpio.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_i2c.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_lptim.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_pwr.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_rcc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_rng.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_rtc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_sdmmc.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_spi.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_tim.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_usart.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_usb.c create mode 100644 project/stm32f407/hal/src/stm32f4xx_ll_utils.c create mode 100644 project/stm32f407/interface/inc/clock.h create mode 100644 project/stm32f407/interface/inc/delay.h create mode 100644 project/stm32f407/interface/inc/iic.h create mode 100644 project/stm32f407/interface/inc/uart.h create mode 100644 project/stm32f407/interface/src/clock.c create mode 100644 project/stm32f407/interface/src/delay.c create mode 100644 project/stm32f407/interface/src/iic.c create mode 100644 project/stm32f407/interface/src/uart.c create mode 100644 project/stm32f407/output/mdk/obj_delete.bat create mode 100644 project/stm32f407/usr/inc/getopt.h create mode 100644 project/stm32f407/usr/inc/shell.h create mode 100644 project/stm32f407/usr/inc/stm32f407xx.h create mode 100644 project/stm32f407/usr/inc/stm32f4xx.h create mode 100644 project/stm32f407/usr/inc/stm32f4xx_hal_conf.h create mode 100644 project/stm32f407/usr/inc/stm32f4xx_it.h create mode 100644 project/stm32f407/usr/inc/system_stm32f4xx.h create mode 100644 project/stm32f407/usr/src/getopt.c create mode 100644 project/stm32f407/usr/src/main.c create mode 100644 project/stm32f407/usr/src/shell.c create mode 100644 project/stm32f407/usr/src/stm32f4xx_hal_msp.c create mode 100644 project/stm32f407/usr/src/stm32f4xx_it.c create mode 100644 project/stm32f407/usr/src/system_stm32f4xx.c create mode 100644 src/driver_qmc5883l.c create mode 100644 src/driver_qmc5883l.h create mode 100644 test/driver_qmc5883l_read_test.c create mode 100644 test/driver_qmc5883l_read_test.h create mode 100644 test/driver_qmc5883l_register_test.c create mode 100644 test/driver_qmc5883l_register_test.h diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.yml b/.github/ISSUE_TEMPLATE/1_bug_report.yml new file mode 100644 index 0000000..0ebfaea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug_report.yml @@ -0,0 +1,32 @@ +name: 🐛 Bug report +description: Create a report to help us improve +labels: [bug report] +body: + - type: markdown + attributes: + value: | + Thank you for your report. + + Please fill in as much of the following form as you're able. + - type: input + attributes: + label: Version + description: Code version. + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. + validations: + required: true + - type: textarea + attributes: + label: Reproduce + description: Steps to reproduce the behavior. + - type: textarea + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + - type: textarea + attributes: + label: Additional context + description: Add any other context about the bug report here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/2_feature_request.yml b/.github/ISSUE_TEMPLATE/2_feature_request.yml new file mode 100644 index 0000000..e3494c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_feature_request.yml @@ -0,0 +1,28 @@ +name: 🚀 Feature request +description: Suggest an idea for this project +labels: [feature request] +body: + - type: markdown + attributes: + value: | + Thank you for suggesting an idea to make LibDriver better. + + Please fill in as much of the following form as you're able. + - type: textarea + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + - type: textarea + attributes: + label: Describe the idea you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + - type: textarea + attributes: + label: Additional context + description: Add any other context about the feature request here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/3_documentation_problem.yml b/.github/ISSUE_TEMPLATE/3_documentation_problem.yml new file mode 100644 index 0000000..b97b371 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3_documentation_problem.yml @@ -0,0 +1,30 @@ +name: 📄 Documentation problem +description: Report a documentation problem +labels: [documentation problem] +body: + - type: markdown + attributes: + value: | + Thank you for reporting the documentation problem to make LibDriver better. + + Please fill in as much of the following form as you're able. + - type: input + attributes: + label: Document Links + description: Please fill in the link of the online documentation or the path of the offline documentation. + validations: + required: true + - type: textarea + attributes: + label: Description of the problem + description: A clear and concise description of the documentation problem. + validations: + required: true + - type: textarea + attributes: + label: Please give your suggestion + description: Please tell us how you would like to improve this documentation. + - type: textarea + attributes: + label: Additional context + description: Add any other context about the documentation problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/4_ask_question.yml b/.github/ISSUE_TEMPLATE/4_ask_question.yml new file mode 100644 index 0000000..d8a53ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4_ask_question.yml @@ -0,0 +1,20 @@ +name: ❓ Ask question +description: Ask a usage or consultation question +labels: [ask question] +body: + - type: markdown + attributes: + value: | + Thank you for your question. + + Please fill in as much of the following form as you're able. + - type: textarea + attributes: + label: Please ask your question + description: Enter your question as detailed as possible. + validations: + required: true + - type: textarea + attributes: + label: Additional context + description: Add any other context about the question here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/5_general_issues.yml b/.github/ISSUE_TEMPLATE/5_general_issues.yml new file mode 100644 index 0000000..d32cba1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/5_general_issues.yml @@ -0,0 +1,20 @@ +name: 🏆 General issues +description: Report any other non-support related issues +labels: [general issues] +body: + - type: markdown + attributes: + value: | + Thank you for your report. + + Please fill in as much of the following form as you're able. + - type: textarea + attributes: + label: Description of the issues + description: Please describe the issues as much detail as possible. + validations: + required: true + - type: textarea + attributes: + label: Additional context + description: Add any other context about the issues here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..a49eab2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..2b7e9d5 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +## PR type(fix, feat, docs, style, etc.) + + + +## PR change and describe + + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b63ba57 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## 1.0.0 (2024-07-30) + +## Features + +- first upload \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..4e2473b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,134 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[INSERT CONTACT METHOD]. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +at [https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cd10a53 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,2080 @@ +# Contributing to LibDriver + +### Table of Contents + + - [Code of Conduct](#Code-of-Conduct) + - [Contributor License Agreement](#Contributor-License-Agreement) + - [Design of Driver](#Design-of-Driver) + - [Code Style](#Code-Style) + - [MISRA Compliant](#MISRA-Compliant) + - [Comment Style](#Comment-Style) + - [Makefile Style](#Makefile-Style) + - [CMake Style](#CMake-Style) + - [IDE Project Structure](#IDE-Project-Structure) + - [Commit Messages Style](#Commit-Messages-Style) + - [Example](#Example) + - [Unit Test](#Unit-Test) + - [Project](#Project) + - [Documentation](#Documentation) + +### Code of Conduct + +The LibDriver has a [Code of Conduct](/CODE_OF_CONDUCT.md) to which all contributors should adhere. + +### Contributor License Agreement + +In order to clarify the intellectual property license granted with Contributions from any person or entity, LibDriver("LibDriver") must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of LibDriver; it does not change your rights to use your own Contributions for any other purpose. + +You accept and agree to the following terms and conditions for Your present and future Contributions submitted to LibDriver. Except for the license granted herein to LibDriver and recipients of software distributed by LibDriver, You reserve all right, title, and interest in and to Your Contributions. + +1. Definitions. + + "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with LibDriver. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to LibDriver for inclusion in, or documentation of, any of the products owned or managed by LibDriver (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to LibDriver or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, LibDriver for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." + +2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to LibDriver and to recipients of software distributed by LibDriver a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. + +3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to LibDriver and to recipients of software distributed by LibDriver a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. + +4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to LibDriver, or that your employer has executed a separate Corporate CLA with LibDriver. + +5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions. + +6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + +7. Should You wish to submit work that is not Your original creation, You may submit it to LibDriver separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]". + +8. You agree to notify LibDriver of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect. + +### Design of Driver + +LibDriver adopts the separate design of driver and driver interface, the driver interface shields the differences of systems and hardwares and the driver provides a unified interface upward. + +```mermaid +graph BT; + A[Interface]-->B[Driver]; + B[Driver]-->C[User]; +``` + +### Code Style + +All code needs to follow the LibDriver code style and its content is as follows: + +1. Include and use int8_t, uint8_t, int16_t, uint16_t, int32_t and uint32_t instead of int and long. float, double and char are unchanged. + +2. For pointer variables, put the * side close to the variable, such as "uint8_t *p". + +3. All functions and variables are named in lowercase using the "x_xx_xxx" format, such as "uint8_t set_config(uint8_t config)". Function and variable naming rules are noun + verb + object. + +4. Local variables are separated from the program line. + +5. {}, if, while, for, etc. each occupy a line and each level of structure is separated by four spaces. + +6. The program uses one tab distance between each level and uses four spaces instead of tab. + +7. Interrupt or exit statements such as return and break are separated from the program by one line. + +8. In a single program, the program can be divided into blocks according to functions and each function block is separated by a line. + +9. Leave a blank line between each function. + +10. Add a space between binary operation symbols =, +, -, /, >, <, >=, <=, ==, &, |, &&, ||, &=, |=, etc. + +11. Each structure, enumeration and macro definition has a blank line. + +12. The internal use of the file must use the static type and add "a_" before the function name to distinguish it from external functions, such as "static uint8_t a_set_way(uint8_t way)". + +13. The program design must include the return execution result and judge the execution result to deal with the error. + +14. Macro definitions must be capitalized. + +15. The structure is uniformly named "typedef struct xx_s()xx_t" and "xx_t" is uniformly used as the name. + +16. The enumeration is uniformly named "typedef enum {}xx_t" and "xx_t" is uniformly used as the name. + +17. The header file definition must use the following structure. + + ```c + #ifndef XXX_H + #define XXX_H + + #ifdef __cplusplus + extern "C"{ + #endif + + #ifdef __cplusplus + } + #endif + + #endif + ``` + +18. The header file should be included before extern "C". + + ```c + #ifndef XXX_H + #define XXX_H + + #include + + #ifdef __cplusplus + extern "C"{ + #endif + + #ifdef __cplusplus + } + #endif + + #endif + ``` + +19. Use <> for system headers and " " for users headers. + +20. Try to use the macro definition to express the length of array. + +21. Global variables and static variables need to be added in front of "g_" and "s_". + +22. The unified format of macro definition function operation is "XXXX (HANDLE, FUC)", macro definitions and variables are all capitalized and there are no underscores before and after. + +23. Header files only contain external declarations and structures. Do not expose internal information and define variables in header files. + +24. Include only required references, redundant references should be removed. + +25. The program needs to be designed in layers. The header file can only include the lower-level program in the upper-level program. It is strictly forbidden for the lower-level program to include the upper-level program. If necessary, a public interface should be defined. + +26. Each .c file needs to have an .h file counterpart with the same name. + +27. Header files prohibit circular dependencies. + +28. A header file must be self-contained and compile independently. + +29. The function can only be used by including the .h file and the use of the function by extern is strictly prohibited. + +30. The program needs to be modularized and divided into multiple .c combinations. + +31. Including multiple headers should be sorted by stability and ascending order. + + ```c + #include + #include + #include + #include + #include + #include + #include + ``` + +32. A function should complete only one function. + +33. Duplicate code requires refinement of common function implementations. + +34. A single line should not be too long, no more than 128 characters and a single function should not be too long. If it exceeds, it must be written in multiple lines and a new line is divided at the low-priority operator. The operator is placed at the beginning of a new line, the divided new line should be properly indented and matched with the previous line of code. + +35. Function nesting should not exceed three layers. + +36. For functions that can be called by multiple threads, multi-thread calling problem needs to be considered. + +37. The legality of function parameters is implemented by the calling function itself and the return value is returned to the caller. + +38. Unused variables, functions, etc. are deleted in time. + +39. Constants should be modified with const. + +40. Try to avoid using global variables and static variables in the function and pay attention to add volatile to protect the program when optimizing with -O3. + +41. Check the validity of all non-parameter inputs, such as files, handle addresses, etc. + +42. Don't exceed five function parameters and use structures if there are more. + +43. Variable length parameter functions cannot be used except printf function. + +44. In addition to common consensus abbreviations, function variables use full names whenever possible. + + ```sh + argument: arg + buffer: buff + clock: clk + command: cmd + compare: cmp + configuration: cfg + device: dev + error: err + hexadecimal: hex + increment: inc + initialize: init + maximum: max + message: msg + minimum: min + parameter: para + previous: prev + register: reg + semaphore: sem + statistic: stat + synchronize: sync + temp: tmp + ``` + +45. .c and .h names are all lowercase. + +46. Macro definitions don't start with an underscore. + +47. Using an uninitialized value as an right value is strictly prohibited. + +48. Operations defined by macros must be enclosed in parentheses. + +49. If there are too many macro definition operations, you need to use "do{}while(0)" to define. + +50. Array out of bounds is prohibited. + +51. Disable memory leaks. + +52. The else if statement must end with an else statement and the switch statement must have a default branch. + +53. Functions that are called many times or frequently are defined using inline. + +54. Comments should be placed above or to the right. + +55. Single-line variables cannot be assigned multiple values and each line can only be assigned once. + +56. Unary operators don't add spaces. + +57. Assignment statements should not be written in statements such as if nor should they be used as parameters. + +58. Multivariate operations bracket each part. + +59. Make sure that the strings are all NULL terminated. + +60. Octal is not allowed. + +### MISRA Compliant + +All driver sources, tests and examples must be MISRA compliant and need to be scanned with at least one software tool that claims to check code for "MISRA conformance".The scan report needs to be saved to \misra. LibDriver uses the MISRA C:2012 specification standard and its content is as follows: + +Dir 1.1 Any implementation-defined behaviour on which the output of the program depends shall be documented and understood + +Category Required + +------ + +Dir 2.1 All source files shall compile without any compilation errors + +Category Required + +------ + +Dir 3.1 All code shall be traceable to documented requirements + +Category Required + +------ + +Dir 4.1 Run-time failures shall be minimized + +Category Required + +------ + +Dir 4.2 All usage of assembly language should be documented + +Category Advisory + +------ + +Dir 4.3 Assembly language shall be encapsulated and isolated + +Category Required + +------ + +Dir 4.4 Sections of code should not be “commented out” + +Category Advisory + +------ + +Dir 4.5 Identifiers in the same name space with overlapping visibility should be typographically unambiguous + +Category Advisory + +------ + +Dir 4.6 typedefs that indicate size and signedness should be used in place of the basic numerical types + +Category Advisory + +------ + +Dir 4.7 If a function returns error information, then that error information shall be tested + +Category Required + +------ + +Dir 4.8 If a pointer to a structure or union is never dereferenced within a translation unit, then the implementation of the object should be hidden + +Category Advisory + +------ + +Dir 4.9 A function should be used in preference to a function-like macro where they are interchangeable + +Category Advisory + +------ + +Dir 4.10 Precautions shall be taken in order to prevent the contents of a header file being included more than once + +Category Required + +------ + +Dir 4.11 The validity of values passed to library functions shall be checked + +Category Required + +------ + +Dir 4.12 Dynamic memory allocation shall not be used + +Category Required + +------ + +Dir 4.13 Functions which are designed to provide operations on a resource should be called in an appropriate sequence + +Category Advisory + +------ + +Rule 1.1 The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation’s translation limits + +Category Required + +------ + +Rule 1.2 Language extensions should not be used + +Category Advisory + +------ + +Rule 1.3 There shall be no occurrence of undefined or critical unspecified behaviour + +Category Required + +------ + +Rule 2.1 A project shall not contain unreachable code + +Category Required + +------ + +Rule 2.2 There shall be no dead code + +Category Required + +------ + +Rule 2.3 A project should not contain unused type declarations + +Category Advisory + +------ + +Rule 2.4 A project should not contain unused tag declarations + +Category Advisory + +------ + +Rule 2.5 A project should not contain unused macro declarations + +Category Advisory + +------ + +Rule 2.6 A function should not contain unused label declarations + +Category Advisory + +------ + +Rule 2.7 There should be no unused parameters in functions + +Category Advisory + +------ + +Rule 3.1 The character sequences /* and // shall not be used within a comment + +Category Required + +------ + +Rule 3.2 Line-splicing shall not be used in // comments + +Category Required + +------ + +Rule 4.1 Octal and hexadecimal escape sequences shall be terminated + +Category Required + +------ + +Rule 4.2 Trigraphs should not be used + +Category Advisory + +------ + +Rule 5.1 External identifiers shall be distinct + +Category Required + +------ + +Rule 5.2 Identifiers declared in the same scope and name space shall be distinct + +Category Required + +------ + +Rule 5.3 An identifier declared in an inner scope shall not hide an identifier declared in an outer scope + +Category Required + +------ + +Rule 5.4 Macro identifiers shall be distinct + +Category Required + +------ + +Rule 5.5 Identifiers shall be distinct from macro names + +Category Required + +------ + +Rule 5.6 A typedef name shall be a unique identifier + +Category Required + +------ + +Rule 5.7 A tag name shall be a unique identifier + +Category Required + +------ + +Rule 5.8 Identifiers that define objects or functions with external linkage shall be unique + +Category Required + +------ + +Rule 5.9 Identifiers that define objects or functions with internal linkage should be unique + +Category Advisory + +------ + +Rule 6.1 Bit-fields shall only be declared with an appropriate type + +Category Required + +------ + +Rule 6.2 Single-bit named bit fields shall not be of a signed type + +Category Required + +------ + +Rule 7.1 Octal constants shall not be used + +Category Required + +------ + +Rule 7.2 A “u” or “U” suffix shall be applied to all integer constants that are represented in an unsigned type + +Category Required + +------ + +Rule 7.3 The lowercase character “l” shall not be used in a literal suffix + +Category Required + +------ + +Rule 7.4 A string literal shall not be assigned to an object unless the object’s type is “pointer to const-qualified char” + +Category Required + +------ + +Rule 8.1 Types shall be explicitly specified + +Category Required + +------ + +Rule 8.2 Function types shall be in prototype form with named parameters + +Category Required + +------ + +Rule 8.3 All declarations of an object or function shall use the same names and type qualifiers + +Category Required + +------ + +Rule 8.4 A compatible declaration shall be visible when an object or function with external linkage is defined + +Category Required + +------ + +Rule 8.5 An external object or function shall be declared once in one and only one file + +Category Required + +------ + +Rule 8.6 An identifier with external linkage shall have exactly one external definition + +Category Required + +------ + +Rule 8.7 Functions and objects should not be defined with external linkage if they are referenced in only one translation unit + +Category Advisory + +------ + +Rule 8.8 The static storage class specifier shall be used in all declarations of objects and functions that have internal linkage + +Category Required + +------ + +Rule 8.9 An object should be defined at block scope if its identifier only appears in a single function + +Category Advisory + +------ + +Rule 8.10 An inline function shall be declared with the static storage class + +Category Required + +------ + +Rule 8.11 When an array with external linkage is declared, its size should be explicitly specified + +Category Advisory + +------ + +Rule 8.12 Within an enumerator list, the value of an implicitly-specified enumeration constant shall be unique + +Category Required + +------ + +Rule 8.13 A pointer should point to a const-qualified type whenever possible + +Category Advisory + +------ + +Rule 8.14 The restrict type qualifier shall not be used + +Category Required + +------ + +Rule 9.1 The value of an object with automatic storage duration shall not be read before it has been set + +Category Mandatory + +------ + +Rule 9.2 The initializer for an aggregate or union shall be enclosed in braces + +Category Required + +------ + +Rule 9.3 Arrays shall not be partially initialized + +Category Required + +------ + +Rule 9.4 An element of an object shall not be initialized more than once + +Category Required + +------ + +Rule 9.5 Where designated initializers are used to initialize an array object the size of the array shall be specified explicitly + +Category Required + +------ + +Rule 10.1 Operands shall not be of an inappropriate essential type + +Category Required + +------ + +Rule 10.2 Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations + +Category Required + +------ + +Rule 10.3 The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category + +Category Required + +------ + +Rule 10.4 Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category + +Category Required + +------ + +Rule 10.5 The value of an expression should not be cast to an inappropriate essential type + +Category Advisory + +------ + +Rule 10.6 The value of a composite expression shall not be assigned to an object with wider essential type + +Category Required + +------ + +Rule 10.7 If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type + +Category Required + +------ + +Rule 10.8 The value of a composite expression shall not be cast to a different essential type category or a wider essential type + +Category Required + +------ + +Rule 11.1 Conversions shall not be performed between a pointer to a function and any other type + +Category Required + +------ + +Rule 11.2 Conversions shall not be performed between a pointer to an incomplete type and any other type + +Category Required + +------ + +Rule 11.3 A cast shall not be performed between a pointer to object type and a pointer to a different object type + +Category Required + +------ + +Rule 11.4 A conversion should not be performed between a pointer to object and an integer type + +Category Advisory + +------ + +Rule 11.5 A conversion should not be performed from pointer to void into pointer to object + +Category Advisory + +------ + +Rule 11.6 A cast shall not be performed between pointer to void and an arithmetic type + +Category Required + +------ + +Rule 11.7 A cast shall not be performed between pointer to object and a non-integer arithmetic type + +Category Required + +------ + +Rule 11.8 A cast shall not remove any const or volatile qualification from the type pointed to by a pointer + +Category Required + +------ + +Rule 11.9 The macro NULL shall be the only permitted form of integer null pointer constant + +Category Required + +------ + +Rule 12.1 The precedence of operators within expressions should be made explicit + +Category Advisory + +------ + +Rule 12.2 The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operand + +Category Required + +------ + +Rule 12.3 The comma operator should not be used + +Category Advisory + +------ + +Rule 12.4 Evaluation of constant expressions should not lead to unsigned integer wrap-around + +Category Advisory + +------ + +Rule 13.1 Initializer lists shall not contain persistent side effects + +Category Required + +------ + +Rule 13.2 The value of an expression and its persistent side effects shall be the same under all permitted evaluation orders + +Category Required + +------ + +Rule 13.3 A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator + +Category Advisory + +------ + +Rule 13.4 The result of an assignment operator should not be used + +Category Advisory + +------ + +Rule 13.5 The right hand operand of a logical && or || operator shall not contain persistent side effects + +Category Required + +------ + +Rule 13.6 The operand of the sizeof operator shall not contain any expression which has potential side effects + +Category Mandatory + +------ + +Rule 14.1 A loop counter shall not have essentially floating type + +Category Required + +------ + +Rule 14.2 A for loop shall be well-formed + +Category Required + +------ + +Rule 14.3 Controlling expressions shall not be invariant + +Category Required + +------ + +Rule 14.4 The controlling expression of an if statement and the controlling expression of an iteration- statement shall have essentially Boolean type + +Category Required + +------ + +Rule 15.1 The goto statement should not be used + +Category Advisory + +------ + +Rule 15.2 The goto statement shall jump to a label declared later in the same function + +Category Required + +------ + +Rule 15.3 Any label referenced by a goto statement shall be declared in the same block, or in any block enclosing the goto statement + +Category Required + +------ + +Rule 15.4 There should be no more than one break or goto statement used to terminate any iteration statement + +Category Advisory + +------ + +Rule 15.5 A function should have a single point of exit at the end + +Category Advisory + +------ + +Rule 15.6 The body of an iteration-statement or a selection-statement shall be a compound-statement + +Category Required + +------ + +Rule 15.7 All if … else if constructs shall be terminated with an else statement + +Category Required + +------ + +Rule 16.1 All switch statements shall be well-formed + +Category Required + +------ + +Rule 16.2 A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement + +Category Required + +------ + +Rule 16.3 An unconditional break statement shall terminate every switch-clause + +Category Required + +------ + +Rule 16.4 Every switch statement shall have a default label + +Category Required + +------ + +Rule 16.5 A default label shall appear as either the first or the last switch label of a switch statement + +Category Required + +------ + +Rule 16.6 Every switch statement shall have at least two switch-clauses + +Category Required + +------ + +Rule 16.7 A switch-expression shall not have essentially Boolean type + +Category Required + +------ + +Rule 17.1 The features of shall not be used + +Category Required + +------ + +Rule 17.2 Functions shall not call themselves, either directly or indirectly + +Category Required + +------ + +Rule 17.3 A function shall not be declared implicitly + +Category Mandatory + +------ + +Rule 17.4 All exit paths from a function with non-void return type shall have an explicit return statement with an expression + +Category Mandatory + +------ + +Rule 17.5 The function argument corresponding to a parameter declared to have an array type shall have an appropriate number of elements + +Category Advisory + +------ + +Rule 17.6 The declaration of an array parameter shall not contain the static keyword between the [ ] + +Category Mandatory + +------ + +Rule 17.7 The value returned by a function having non-void return type shall be used + +Category Required + +------ + +Rule 17.8 A function parameter should not be modified + +Category Advisory + +------ + +Rule 18.1 A pointer resulting from arithmetic on a pointer operand shall address an element of the same array as that pointer operand + +Category Required + +------ + +Rule 18.2 Subtraction between pointers shall only be applied to pointers that address elements of the same array + +Category Required + +------ + +Rule 18.3 The relational operators >, >=, < and <= shall not be applied to objects of pointer type except where they point into the same object + +Category Required + +------ + +Rule 18.4 The +, -, += and -= operators should not be applied to an expression of pointer type + +Category Advisory + +------ + +Rule 18.5 Declarations should contain no more than two levels of pointer nesting + +Category Advisory + +------ + +Rule 18.6 The address of an object with automatic storage shall not be copied to another object that persists after the first object has ceased to exist + +Category Required + +------ + +Rule 18.7 Flexible array members shall not be declared + +Category Required + +------ + +Rule 18.8 Variable-length array types shall not be used + +Category Required + +------ + +Rule 19.1 An object shall not be assigned or copied to an overlapping object + +Category Mandatory + +------ + +Rule 19.2 The union keyword should not be used + +Category Advisory + +------ + +Rule 20.1 #include directives should only be preceded by preprocessor directives or comments + +Category Advisory + +------ + +Rule 20.2 The ', " or \ characters and the /* or // character sequences shall not occur in a header file name + +Category Required + +------ + +Rule 20.3 The #include directive shall be followed by either a or "filename" sequence + +Category Required + +------ + +Rule 20.4 A macro shall not be defined with the same name as a keyword + +Category Required + +------ + +Rule 20.5 #undef should not be used + +Category Advisory + +------ + +Rule 20.6 Tokens that look like a preprocessing directive shall not occur within a macro argument + +Category Required + +------ + +Rule 20.7 Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses + +Category Required + +------ + +Rule 20.8 The controlling expression of a #if or #elif preprocessing directive shall evaluate to 0 or 1 + +Category Required + +------ + +Rule 20.9 All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define’d before evaluation + +Category Required + +------ + +Rule 20.10 The # and ## preprocessor operators should not be used + +Category Advisory + +------ + +Rule 20.11 A macro parameter immediately following a # operator shall not immediately be followed by a ## operator + +Category Required + +------ + +Rule 20.12 A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators + +Category Required + +------ + +Rule 20.13 A line whose first token is # shall be a valid preprocessing directive + +Category Required + +------ + +Rule 20.14 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related + +Category Required + +------ + +Rule 21.1 #define and #undef shall not be used on a reserved identifier or reserved macro name + +Category Required + +------ + +Rule 21.2 A reserved identifier or macro name shall not be declared + +Category Required + +------ + +Rule 21.3 The memory allocation and deallocation functions of shall not be used + +Category Required + +------ + +Rule 21.4 The standard header file shall not be used + +Category Required + +------ + +Rule 21.5 The standard header file shall not be used + +Category Required + +------ + +Rule 21.6 The Standard Library input/output functions shall not be used + +Category Required + +------ + +Rule 21.7 The atof, atoi, atol and atoll functions of shall not be used + +Category Required + +------ + +Rule 21.8 The library functions abort, exit, getenv and system of shall not be used + +Category Required + +------ + +Rule 21.9 The library functions bsearch and qsort of shall not be used + +Category Required + +------ + +Rule 21.10 The Standard Library time and date functions shall not be used + +Category Required + +------ + +Rule 21.11 The standard header file shall not be used + +Category Required + +------ + +Rule 21.12 The exception handling features of should not be used + +Category Advisory + +------ + +Rule 22.1 All resources obtained dynamically by means of Standard Library functions shall be explicitly released + +Category Required + +------ + +Rule 22.2 A block of memory shall only be freed if it was allocated by means of a Standard Library function + +Category Mandatory + +------ + +Rule 22.3 The same file shall not be open for read and write access at the same time on different streams + +Category Required + +------ + +Rule 22.4 There shall be no attempt to write to a stream which has been opened as read-only + +Category Mandatory + +------ + +Rule 22.5 A pointer to a FILE object shall not be dereferenced + +Category Mandatory + +------ + +Rule 22.6 The value of a pointer to a FILE shall not be used after the associated stream has been closed + +Category Mandatory + +### Comment Style + +All code needs to be commented and the comment style is as follows: + +1. Comments must be in English. + +2. Use /* */ for single-line comments. If you write on a function, you need to have a blank line with the above program. Multi-line comments use the following style. + + ```c + /* + * xxx...xx..xxx.xxx + * xxx..xx..xx.xx.xxx + */ + ``` + +3. Each function needs to include @brief (brief description), @param[in], @param[out], @param[int, out] (parameter description), @return (return description), and @note (note description), in the order of @brief, @param, @return, and @note. Among them, @return needs to indicate the meaning of each return value. + +4. @param[in], @param[out], @param[int, out] need to specify the direction of parameter passing, the format is parameter name + meaning of the parameter, if not, do not write. + +5. If there are several types of return values, write several return values. The format is return value + meaning of the return value. If there is no return value, do not write. + +6. Enumerations require @brief, and add /**< */ enumeration type description to the right of each enumeration. + +7. The structure needs @brief, and add /**< */ structure type description to the right of each member. + +8. Macro-defined functions are annotated like regular functions. + +9. Macro definition requires @brief, and add /**< */ function description on the right. + +10. Functions need to be grouped with annotations and subgrouped if necessary. + + ```c + /** + * @defgroup tag name + * @brief xxx modules + * @{ + */ + + /** + * @} + */ + ``` + +11. The file header needs to include copyright, license, @file, @brief, @version, @author, @data and modification history. + + ```c + /** + * Copyright (c) 2015 - present XXXXX All rights reserved + * + * The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @file xxx.h + * @brief xxx + * @version x.x.x + * @author xxx + * @date xxxx-x-xx + * + *

history

+ * + *
Date Version Author Description + *
xxxx/xx/xx x.x xxx xxx + *
xxxx/xx/xx x.x xxx xxx + *
+ */ + ``` + +12. The home page needs to be written separately in a mainpage.h, including @mainpage, @brief, @version, @author, historical description, copyright and license. + + ```c + /** + * @mainpage xxx + * @brief xxx + * @version x.x.x + * @author xx + * + *

history

+ * + *
Date Version Author Description + *
xxxx/xx/xx x.x xxx xxx + *
xxxx/xx/xx x.x xxx xxx + *
+ * + *

Copyright (C) XXXXX + * All rights reserved.

+ * + * The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + ``` + +### Makefile Style + +Makefile needs to follow the LibDriver Makefile style and its content is as follows: + +1. Each Makefile must contain copyright information. + + ```makefile + # + # Copyright (c) 2015 - present XXX All rights reserved + # + # The MIT License (MIT) + # + # Permission is hereby granted, free of charge, to any person obtaining a copy + # of this software and associated documentation files (the "Software"), to deal + # in the Software without restriction, including without limitation the rights + # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + # copies of the Software, and to permit persons to whom the Software is + # furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included in all + # copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + # SOFTWARE. + # + ``` + +2. Each command in the Makefile must contain English comments. + +3. The comment should be above the command, the format is # + space + comment. + +4. There should be a blank line between every two commands. + +5. Makefile is placed in the root directory of the source code. + +6. Compilation should include version, application name, static library name, dynamic library name, installation directory (header files, static dynamic library and binary files), compiler, etc. + + ```makefile + # set the project version + VERSION := 2.1.0 + + # set the application name + APP_NAME := demo + + # set the shared libraries name + SHARED_LIB_NAME := libdemo.so + + # set the static libraries name + STATIC_LIB_NAME := libdemo.a + + # set the install directories + INSTL_DIRS := /usr/local + + # set the include directories + INC_INSTL_DIRS := $(INSTL_DIRS)/include/$(APP_NAME) + + # set the library directories + LIB_INSTL_DIRS := $(INSTL_DIRS)/lib + + # set the bin directories + BIN_INSTL_DIRS := $(INSTL_DIRS)/bin + + # set the compiler + CC := gcc + + # set the ar tool + AR := ar + ``` + +7. Dependent libraries are prioritized to use pkg-config to discover and set the environment and you can also directly set dependent libs and include header file directories. + + ```makefile + # set the packages name + PKGS := libcurl opencv4 + + # set the pck-config header directories + LIB_INC_DIRS := $(shell pkg-config --cflags $(PKGS)) + + # set the linked libraries + LIBS := -lm \ + -lz + + # add the linked libraries + LIBS += $(shell pkg-config --libs $(PKGS)) + ``` + +8. Compilation definition LIB_INC_DIRS is a collection of dependent library header file directories, LIBS is a collection of dependent libraries, INC_DIRS is a collection of compiled source file directories, INSTL_INCS is a collection of installation files, SRCS is a collection of compiled source files, and MAIN is a collection of compiled executable program source files. + + ```makefile + # set the pck-config header directories + LIB_INC_DIRS := $(shell pkg-config --cflags $(PKGS)) + + # set the linked libraries + LIBS := -lm \ + -lz + + # add the linked libraries + LIBS += $(shell pkg-config --libs $(PKGS)) + + # set all header directories + INC_DIRS := -I ./src \ + -I ./interface \ + -I ./example \ + -I ./test + + # add the linked libraries header directories + INC_DIRS += $(LIB_INC_DIRS) + + # set the installing headers + INSTL_INCS := $(wildcard ./src/*.h) \ + $(wildcard ./interface/*.h) \ + $(wildcard ./example/*.h) \ + $(wildcard ./test/*.h) + + # set all sources files + SRCS := $(wildcard ./src/*.c) \ + $(wildcard ./interface/*.c) \ + $(wildcard ./example/*.c) \ + $(wildcard ./test/*.c) + + # set the main source + MAIN := $(wildcard ./project/main.c) \ + $(SRCS) + ``` + +9. Macro definitions are defined using DEFS and compilation flags are defined using CFLAGS. + + ```makefile + # set the definitions + DEFS := -D MATH_CONFIG_USE_HARDWARE_BLAS=MATH_CONFIG_BLAS_HARDWARE_ACCELERATION_INTEL_MKL \ + -D MATH_TEST + + # set flags of the compiler + CFLAGS := -O3 \ + -DNDEBUG + ``` + +10. Any target needs to be protected by .PHONY. + +11. Application, dynamic library and static library templates are as follows. + + ```makefile + # set all .PHONY + .PHONY: all + + # set the output list + all: $(APP_NAME) $(SHARED_LIB_NAME).$(VERSION) $(STATIC_LIB_NAME) + + # set the main app + $(APP_NAME) : $(MAIN) + $(CC) $(CFLAGS) $(DEFS) $^ $(INC_DIRS) $(LIBS) -o $@ + + # set the shared lib + $(SHARED_LIB_NAME).$(VERSION) : $(SRCS) + $(CC) $(CFLAGS) -shared -fPIC $(DEFS) $^ $(INC_DIRS) $(LIBS) -o $@ + + # set the *.o for the static libraries + OBJS := $(patsubst %.c, %.o, $(SRCS)) + + # set the static lib + $(STATIC_LIB_NAME) : $(OBJS) + $(AR) -r $@ $^ + + # .*o used by the static lib + $(OBJS) : $(SRCS) + $(CC) $(CFLAGS) -c $(DEFS) $^ $(INC_DIRS) -o $@ + ``` + +12. Install, uninstall and clear templates are as follows. + + ```makefile + # set install .PHONY + .PHONY: install + + # install files + install : + $(shell if [ ! -d $(INC_INSTL_DIRS) ]; then mkdir $(INC_INSTL_DIRS); fi;) + cp -rv $(INSTL_INCS) $(INC_INSTL_DIRS) + cp -rv $(SHARED_LIB_NAME).$(VERSION) $(LIB_INSTL_DIRS) + ln -sf $(LIB_INSTL_DIRS)/$(SHARED_LIB_NAME).$(VERSION) $(LIB_INSTL_DIRS)/$(SHARED_LIB_NAME) + cp -rv $(STATIC_LIB_NAME) $(LIB_INSTL_DIRS) + cp -rv $(APP_NAME) $(BIN_INSTL_DIRS) + + # set install .PHONY + .PHONY: uninstall + + # uninstall files + uninstall : + rm -rf $(INC_INSTL_DIRS) + rm -rf $(LIB_INSTL_DIRS)/$(SHARED_LIB_NAME).$(VERSION) + rm -rf $(LIB_INSTL_DIRS)/$(SHARED_LIB_NAME) + rm -rf $(LIB_INSTL_DIRS)/$(STATIC_LIB_NAME) + rm -rf $(BIN_INSTL_DIRS)/$(APP_NAME) + + # set clean .PHONY + .PHONY: clean + + # clean the project + clean : + rm -rf $(APP_NAME) $(SHARED_LIB_NAME).$(VERSION) $(STATIC_LIB_NAME) + ``` + +### CMake Style + +CMakeLists.txt needs to follow the LibDriver CMake style and its content is as follows: + +1. Each CMakeLists.txt must contain copyright information. + + ```cmake + # + # Copyright (c) 2015 - present XXX All rights reserved + # + # The MIT License (MIT) + # + # Permission is hereby granted, free of charge, to any person obtaining a copy + # of this software and associated documentation files (the "Software"), to deal + # in the Software without restriction, including without limitation the rights + # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + # copies of the Software, and to permit persons to whom the Software is + # furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included in all + # copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + # SOFTWARE. + # + ``` + +2. Each command in CMakeLists.txt must contain English comments. + +3. The comment should be above the command, the format is # + space + comment. + +4. There should be a blank line between every two commands. + +5. The CMakeList.txt is placed in the root directory of the source code and a cmake folder is created to store the VERSION, config.cmake.in and uninstall.cmake files. + +6. Each CMake project needs to create a compiled version file named VERSION under the cmake/ folder. + + ```cmake + 1.0.0 + ``` + +7. Each project needs to include CMake minimum version requirements, set the project name (writing language), set the version number, set the C/C++ language standard, set the compile flag and set the debug or release statement. + + ```cmake + # set the cmake minimum version + cmake_minimum_required(VERSION 3.0) + + # set the project name and language + project(demo C CXX) + + # read the version from files + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/VERSION ${CMAKE_PROJECT_NAME}_VERSION) + + # set the project version + set(PROJECT_VERSION ${${CMAKE_PROJECT_NAME}_VERSION}) + + # set c standard c99 + set(CMAKE_C_STANDARD 99) + + # enable c standard required + set(CMAKE_C_STANDARD_REQUIRED True) + + # set c++ standard c++11 + set(CMAKE_CXX_STANDARD 11) + + # enable c++ standard required + set(CMAKE_CXX_STANDARD_REQUIRED True) + + # set debug level + # set(CMAKE_BUILD_TYPE Debug) + + # set the debug flags of c + # set(CMAKE_C_FLAGS_DEBUG "-O0 -g") + + # set the debug flags of c++ + # set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") + + # set release level + set(CMAKE_BUILD_TYPE Release) + + # set the release flags of c + set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") + + # set the release flags of c++ + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") + ``` + +8. To include the reference library, you must first include CMakePackageConfigHelpers and add "find_package(PkgConfig REQUIRED)". After discovering the package command, you need to add all discovered INCLUDE_DIRS to the collection LIB_INC_DIRS and all discovered LIBRARIES to the collection LIBS. + + ```cmake + # include cmake package config helpers + include(CMakePackageConfigHelpers) + + # find the pkgconfig and use this tool to find the third party packages + find_package(PkgConfig REQUIRED) + + # find the linked libraries + find_package(OpenCV REQUIRED) + + # find the third party packages with pkgconfig + pkg_search_module(GSL REQUIRED gsl) + + # include all library header directories + set(LIB_INC_DIRS + ${OpenCV_INCLUDE_DIRS} + ${GSL_INCLUDE_DIRS} + ) + + # include all linked libraries + set(LIBS + ${OpenCV_LIBRARIES} + ${GSL_LIBRARIES} + ) + ``` + +9. Define the CMake variable LIB_INC_DIRS as the directory of all found library header files, LIBS as the name directory of all found libraries, INC_DIRS as the directory of all header files required for compilation (need to include ${LIB_INC_DIRS}), INSTL_INCS as the name of all header files that need to be installed , SRCS as the name of all source files required to generate libraries and MAIN as the collection of source files required to generate the program. + + ```cmake + # include all library header directories + set(LIB_INC_DIRS + ${OpenCV_INCLUDE_DIRS} + ${GSL_INCLUDE_DIRS} + ) + + # include all linked libraries + set(LIBS + ${OpenCV_LIBRARIES} + ${GSL_LIBRARIES} + ) + + # include all header directories + set(INC_DIRS + ${LIB_INC_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/interface + ${CMAKE_CURRENT_SOURCE_DIR}/example + ${CMAKE_CURRENT_SOURCE_DIR}/test + ) + + # include all installed headers + file(GLOB INSTL_INCS + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/interface/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/example/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/test/*.h + ) + + # include all sources files + file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/interface/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/example/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/test/*.c + ) + + # include executable source + file(GLOB MAIN + ${CMAKE_CURRENT_SOURCE_DIR}/project/main.c + ${SRCS} + ) + ``` + +10. The static library needs to set the version number, add "_static" at the end of the generation, and finally use the renaming function to name it. + + ```cmake + # enable output as a static library + add_library(${CMAKE_PROJECT_NAME}_static STATIC ${SRCS}) + + # add the definitions + target_compile_definitions(${CMAKE_PROJECT_NAME}_static PRIVATE TEST_LIB_STATIC_DEF) + + # set the static library include directories + target_include_directories(${CMAKE_PROJECT_NAME}_static PRIVATE ${INC_DIRS}) + + # rename as ${CMAKE_PROJECT_NAME} + set_target_properties(${CMAKE_PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${CMAKE_PROJECT_NAME}) + + # don't delete ${CMAKE_PROJECT_NAME} libs + set_target_properties(${CMAKE_PROJECT_NAME}_static PROPERTIES CLEAN_DIRECT_OUTPUT 1) + + # set the static library version + set_target_properties(${CMAKE_PROJECT_NAME}_static PROPERTIES VERSION ${${CMAKE_PROJECT_NAME}_VERSION}) + ``` + +11. The dynamic library needs to set the version number, set the PUBLIC_HEADER installation file and set the link libraries. + + ```cmake + # enable output as a dynamic library + add_library(${CMAKE_PROJECT_NAME} SHARED ${SRCS}) + + # add the definitions + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE TEST_LIB_DEF) + + # set the executable program include directories + target_include_directories(${CMAKE_PROJECT_NAME} + PUBLIC $ + PRIVATE ${INC_DIRS} + ) + + # set the dynamic library link libraries + target_link_libraries(${CMAKE_PROJECT_NAME} + ${LIBS} + ) + + # rename as ${CMAKE_PROJECT_NAME} + set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${CMAKE_PROJECT_NAME}) + + # don't delete ${CMAKE_PROJECT_NAME} libs + set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES CLEAN_DIRECT_OUTPUT 1) + + # include the public header + set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${INSTL_INCS}") + + # set the dynamic library version + set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VERSION ${${CMAKE_PROJECT_NAME}_VERSION}) + ``` + +12. Executable programs needs to set up link libraries. + + ```cmake + # enable the executable program + add_executable(${CMAKE_PROJECT_NAME}_exe ${MAIN}) + + # add the definitions + target_compile_definitions(${CMAKE_PROJECT_NAME}_exe PRIVATE TEST_EXE_DEF=1) + + # set the executable program include directories + target_include_directories(${CMAKE_PROJECT_NAME}_exe PRIVATE ${INC_DIRS}) + + # set the executable program link libraries + target_link_libraries(${CMAKE_PROJECT_NAME}_exe + ${LIBS} + m + ) + + # rename as ${CMAKE_PROJECT_NAME} + set_target_properties(${CMAKE_PROJECT_NAME}_exe PROPERTIES OUTPUT_NAME ${CMAKE_PROJECT_NAME}) + + # don't delete ${CMAKE_PROJECT_NAME} exe + set_target_properties(${CMAKE_PROJECT_NAME}_exe PROPERTIES CLEAN_DIRECT_OUTPUT 1) + ``` + +13. File installation needs to set header files, dynamic libraries, static libraries and executable programs. + + ```cmake + # install the binary + install(TARGETS ${CMAKE_PROJECT_NAME}_exe + RUNTIME DESTINATION bin + ) + + # install the static library + install(TARGETS ${CMAKE_PROJECT_NAME}_static + ARCHIVE DESTINATION lib + ) + + # install the dynamic library + install(TARGETS ${CMAKE_PROJECT_NAME} + EXPORT ${CMAKE_PROJECT_NAME}-targets + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/${CMAKE_PROJECT_NAME} + ) + ``` + +14. In order for other CMake projects to use the generated library directly, a CMake package discovery file needs to be generated with the help of config.cmake.in. + + ```cmake + # make the cmake config file + configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake/${CMAKE_PROJECT_NAME}-config.cmake + INSTALL_DESTINATION cmake + ) + + # write the cmake config version + write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/cmake/${CMAKE_PROJECT_NAME}-config-version.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion + ) + + # install the cmake files + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/${CMAKE_PROJECT_NAME}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/${CMAKE_PROJECT_NAME}-config-version.cmake" + DESTINATION cmake + ) + + # set the export items + install(EXPORT ${CMAKE_PROJECT_NAME}-targets + DESTINATION cmake + ) + ``` + The following config.cmake.in is a reference template. It needs to add "find_package" check and the others do not need to be modified. + ```cmake + # + # Copyright (c) 2015 - present XXX All rights reserved + # + # The MIT License (MIT) + # + # Permission is hereby granted, free of charge, to any person obtaining a copy + # of this software and associated documentation files (the "Software"), to deal + # in the Software without restriction, including without limitation the rights + # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + # copies of the Software, and to permit persons to whom the Software is + # furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included in all + # copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + # SOFTWARE. + # + + # set the package init + @PACKAGE_INIT@ + + # include dependency macro + include(CMakeFindDependencyMacro) + + # find the pkgconfig and use this tool to find the third party packages + find_package(PkgConfig REQUIRED) + + # find the third party packages with pkgconfig + pkg_search_module(GPIOD REQUIRED xxx) + + # include the cmake targets + include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) + + # get the include header directories + get_target_property(@CMAKE_PROJECT_NAME@_INCLUDE_DIRS @CMAKE_PROJECT_NAME@ INTERFACE_INCLUDE_DIRECTORIES) + + # get the library directories + get_target_property(@CMAKE_PROJECT_NAME@_LIBRARIES @CMAKE_PROJECT_NAME@ IMPORTED_LOCATION_RELEASE) + ``` + +15. In order to uninstall the installation files, the uninstall custom command needs to be added with the help of uninstall.cmake. + + ```cmake + # add uninstall command + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake + ) + ``` + + The following uninstall.cmake is an uninstall template. + + ```cmake + # + # Copyright (c) 2015 - present LibDriver All rights reserved + # + # The MIT License (MIT) + # + # Permission is hereby granted, free of charge, to any person obtaining a copy + # of this software and associated documentation files (the "Software"), to deal + # in the Software without restriction, including without limitation the rights + # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + # copies of the Software, and to permit persons to whom the Software is + # furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included in all + # copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + # SOFTWARE. + # + + # check the install_manifest.txt + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") + # output the error + message(FATAL_ERROR "cannot find install manifest: ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") + endif() + + # read install_manifest.txt to uninstall_list + file(READ "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt" ${CMAKE_PROJECT_NAME}_uninstall_list) + + # replace '\n' to ';' + string(REGEX REPLACE "\n" ";" ${CMAKE_PROJECT_NAME}_uninstall_list "${${CMAKE_PROJECT_NAME}_uninstall_list}") + + # uninstall the list files + foreach(${CMAKE_PROJECT_NAME}_uninstall_list ${${CMAKE_PROJECT_NAME}_uninstall_list}) + # if a link or a file + if(IS_SYMLINK "$ENV{DESTDIR}${${CMAKE_PROJECT_NAME}_uninstall_list}" OR EXISTS "$ENV{DESTDIR}${${CMAKE_PROJECT_NAME}_uninstall_list}") + # delete the file + execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${${CMAKE_PROJECT_NAME}_uninstall_list} + RESULT_VARIABLE rm_retval + ) + + # check the retval + if(NOT "${rm_retval}" STREQUAL 0) + # output the error + message(FATAL_ERROR "failed to remove file: '${${CMAKE_PROJECT_NAME}_uninstall_list}'.") + else() + # uninstalling files + message(STATUS "uninstalling: $ENV{DESTDIR}${${CMAKE_PROJECT_NAME}_uninstall_list}") + endif() + else() + # output the error + message(STATUS "file: $ENV{DESTDIR}${${CMAKE_PROJECT_NAME}_uninstall_list} does not exist.") + endif() + endforeach() + ``` + +16. Unit tests need to include CTest, set test commands and result regular expressions. + + ``` cmake + #include ctest module + include(CTest) + + # creat a test + add_test(NAME ${CMAKE_PROJECT_NAME}_test_1 COMMAND ${CMAKE_PROJECT_NAME}_exe -p) + + # set the pass regular expression + set_tests_properties(${CMAKE_PROJECT_NAME}_test_1 PROPERTIES PASS_REGULAR_EXPRESSION "\n") + ``` + +17. To package the installation program, you need to modify the contact information, modify the package description, set the CPU architecture and set the dependent packages. + + ```cmake + # set the cpack package name + set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + + # set the package version + set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + + # set the package contact + set(CPACK_PACKAGE_CONTACT "xxxx@xxx.com") + + # set the package description + set(CPACK_PACKAGE_DESCRIPTION "cpack demo program") + + # deb output + set(CPACK_GENERATOR "DEB") + + # set the package maintainer + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "XXX") + + # set the cpu type + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf") + + # set the package name + set(CPACK_DEBIAN_FILE_NAME ${CMAKE_PROJECT_NAME}_${PROJECT_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb) + + # set the package depends + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6") + + # .tar.gz output + # set(CPACK_GENERATOR TGZ) + + # set the package name + # set(CPACK_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}_${PROJECT_VERSION}) + + # include the CPack + include(CPack) + ``` + +### IDE Project Structure + +The IDE project of LibDriver needs to have a good structure. Each project should be built in the order of board support package, middleware and application structure. Higher level code can use a lower level code, but lower level code can't use higher level code. + +```mermaid +graph BT; + A[Board Support Package]-->B[Middleware]; + B[Middleware]-->C[Application]; +``` + +### Commit Messages Style + +1. For each git commit, the commit message includes three parts: header, body and footer. + + ```shell + (): + + # skip a line + + + + # skip a line + + ... + +