diff --git a/README.md b/README.md index 21fb98e..498f741 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,15 @@ LibDriver MPU6050 is the full function driver of mpu6050 launched by LibDriver. /src includes LibDriver MPU6050 source files. -/interface includes LibDriver MPU6050 IIC platform independent template。 +/interface includes LibDriver MPU6050 IIC platform independent template. -/test includes LibDriver MPU6050 driver test code and this code can test the chip necessary function simply。 +/test includes LibDriver MPU6050 driver test code and this code can test the chip necessary function simply. /example includes LibDriver MPU6050 sample code. /doc includes LibDriver MPU6050 offline document. -/datasheet includes MPU6050 datasheet。 +/datasheet includes MPU6050 datasheet. /project includes the common Linux and MCU development board sample code. All projects use the shell script to debug the driver and the detail instruction can be found in each project's README.md. @@ -52,6 +52,8 @@ Add /src, /interface and /example to your project. #### example basic ```C +#include "driver_mpu6050_basic.h" + uint8_t res; uint32_t i; uint32_t times; @@ -122,6 +124,8 @@ return 0; #### example fifo ```C +#include "driver_mpu6050_fifo.h" + uint32_t i; uint32_t times; uint16_t len; @@ -203,6 +207,8 @@ return 0; #### example dmp ```C +#include "driver_mpu6050_dmp.h" + uint32_t i; uint32_t times; uint32_t cnt; diff --git a/README_de.md b/README_de.md index 0138411..b02e8b4 100644 --- a/README_de.md +++ b/README_de.md @@ -52,6 +52,8 @@ Fügen Sie /src, /interface und /example zu Ihrem Projekt hinzu. #### example basic ```C +#include "driver_mpu6050_basic.h" + uint8_t res; uint32_t i; uint32_t times; @@ -122,6 +124,8 @@ return 0; #### example fifo ```c +#include "driver_mpu6050_fifo.h" + uint32_t i; uint32_t times; uint16_t len; @@ -203,6 +207,8 @@ return 0; #### example dmp ```C +#include "driver_mpu6050_dmp.h" + uint32_t i; uint32_t times; uint32_t cnt; diff --git a/README_ja.md b/README_ja.md index 95ae809..a92b988 100644 --- a/README_ja.md +++ b/README_ja.md @@ -52,6 +52,8 @@ LibDriver MPU6050は、LibDriverによって起動されたmpu6050の全機能 #### example basic ```C +#include "driver_mpu6050_basic.h" + uint8_t res; uint32_t i; uint32_t times; @@ -122,6 +124,8 @@ return 0; #### example fifo ```c +#include "driver_mpu6050_fifo.h" + uint32_t i; uint32_t times; uint16_t len; @@ -203,6 +207,8 @@ return 0; #### example dmp ```C +#include "driver_mpu6050_dmp.h" + uint32_t i; uint32_t times; uint32_t cnt; diff --git a/README_ko.md b/README_ko.md index 78e7b9b..31e6fe3 100644 --- a/README_ko.md +++ b/README_ko.md @@ -52,6 +52,8 @@ LibDriver MPU6050은 LibDriver에서 출시한 mpu6050의 전체 기능 드라 #### example basic ```C +#include "driver_mpu6050_basic.h" + uint8_t res; uint32_t i; uint32_t times; @@ -122,6 +124,8 @@ return 0; #### example fifo ```c +#include "driver_mpu6050_fifo.h" + uint32_t i; uint32_t times; uint16_t len; @@ -203,6 +207,8 @@ return 0; #### example dmp ```C +#include "driver_mpu6050_dmp.h" + uint32_t i; uint32_t times; uint32_t cnt; diff --git a/README_zh-Hans.md b/README_zh-Hans.md index 8d13040..dc5e10a 100644 --- a/README_zh-Hans.md +++ b/README_zh-Hans.md @@ -52,6 +52,8 @@ LibDriver MPU6050是LibDriver推出的MPU6050的全功能驱动,该驱动提 #### example basic ```C +#include "driver_mpu6050_basic.h" + uint8_t res; uint32_t i; uint32_t times; @@ -122,6 +124,8 @@ return 0; #### example fifo ```C +#include "driver_mpu6050_fifo.h" + uint32_t i; uint32_t times; uint16_t len; @@ -203,6 +207,8 @@ return 0; #### example dmp ```C +#include "driver_mpu6050_dmp.h" + uint32_t i; uint32_t times; uint32_t cnt; diff --git a/README_zh-Hant.md b/README_zh-Hant.md index f2ed9dc..c8655d3 100644 --- a/README_zh-Hant.md +++ b/README_zh-Hant.md @@ -52,6 +52,8 @@ LibDriver MPU6050是LibDriver推出的MPU6050的全功能驅動,該驅動提 #### example basic ```C +#include "driver_mpu6050_basic.h" + uint8_t res; uint32_t i; uint32_t times; @@ -122,6 +124,8 @@ return 0; #### example fifo ```C +#include "driver_mpu6050_fifo.h" + uint32_t i; uint32_t times; uint16_t len; @@ -203,6 +207,8 @@ return 0; #### example dmp ```C +#include "driver_mpu6050_dmp.h" + uint32_t i; uint32_t times; uint32_t cnt; diff --git a/project/raspberrypi4b/CMakeLists.txt b/project/raspberrypi4b/CMakeLists.txt new file mode 100644 index 0000000..20eaf22 --- /dev/null +++ b/project/raspberrypi4b/CMakeLists.txt @@ -0,0 +1,212 @@ +# +# 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. +# + +# set the cmake minimum version +cmake_minimum_required(VERSION 3.0) + +# set the project name and language +project(mpu6050 C) + +# 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 release level +set(CMAKE_BUILD_TYPE Release) + +# set the release flags of c +set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") + +# 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 third party packages with pkgconfig +pkg_search_module(GPIOD REQUIRED libgpiod) + +# include all library header directories +set(LIB_INC_DIRS + ${GPIOD_INCLUDE_DIRS} + ) + +# include all linked libraries +set(LIBS + ${GPIOD_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 + ${CMAKE_CURRENT_SOURCE_DIR}/interface/inc + ) + +# include all installed headers +file(GLOB INSTL_INCS + ${CMAKE_CURRENT_SOURCE_DIR}/../../src/*.h + ) + +# include all sources files +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/../../src/*.c + ) + +# include executable source +file(GLOB MAIN + ${SRCS} + ${CMAKE_CURRENT_SOURCE_DIR}/../../example/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/../../test/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/driver/src/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c + ) + +# enable output as a static library +add_library(${CMAKE_PROJECT_NAME}_static STATIC ${SRCS}) + +# set the static library include directories +target_include_directories(${CMAKE_PROJECT_NAME}_static PRIVATE ${INC_DIRS}) + +# set the static library link libraries +target_link_libraries(${CMAKE_PROJECT_NAME}_static + m + ) + +# 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}) + +# enable output as a dynamic library +add_library(${CMAKE_PROJECT_NAME} SHARED ${SRCS}) + +# 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} + m + ) + +# 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}) + +# enable the executable program +add_executable(${CMAKE_PROJECT_NAME}_exe ${MAIN}) + +# 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 + pthread + ) + +# 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) + +# 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} + ) + +# 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 + ) + +# add uninstall command +add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake + ) + +#include ctest module +include(CTest) + +# creat a test +add_test(NAME ${CMAKE_PROJECT_NAME}_test COMMAND ${CMAKE_PROJECT_NAME}_exe -p) diff --git a/project/raspberrypi4b/Makefile b/project/raspberrypi4b/Makefile index b5205c3..0eac24b 100644 --- a/project/raspberrypi4b/Makefile +++ b/project/raspberrypi4b/Makefile @@ -1,18 +1,149 @@ -CC := gcc -SRC := $(wildcard ./interface/src/*.c) \ - $(wildcard ./driver/src/*.c) \ - $(wildcard ./src/*.c) \ - $(wildcard ../../src/*.c) \ - $(wildcard ../../test/*.c) \ - $(wildcard ../../example/*.c) -LIBS := -lpthread \ - -lgpiod \ - -lm +# +# 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. +# + +# set the project version +VERSION := 1.0.0 + +# set the application name +APP_NAME := mpu6050 + +# set the shared libraries name +SHARED_LIB_NAME := libmpu6050.so + +# set the static libraries name +STATIC_LIB_NAME := libmpu6050.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 + +# set the packages name +PKGS := libgpiod + +# set the pck-config header directories +LIB_INC_DIRS := $(shell pkg-config --cflags $(PKGS)) + +# set the linked libraries +LIBS := -lm \ + -lpthread + +# add the linked libraries +LIBS += $(shell pkg-config --libs $(PKGS)) + +# set all header directories +INC_DIRS := -I ../../src/ \ + -I ../../interface/ \ + -I ../../example/ \ + -I ../../test/ \ + -I ./interface/inc/ + +# add the linked libraries header directories +INC_DIRS += $(LIB_INC_DIRS) + +# set the installing headers +INSTL_INCS := $(wildcard ../../src/*.h) + +# set all sources files +SRCS := $(wildcard ../../src/*.c) + +# set the main source +MAIN := $(SRCS) \ + $(wildcard ../../example/*.c) \ + $(wildcard ../../test/*.c) \ + $(wildcard ./interface/src/*.c) \ + $(wildcard ./driver/src/*.c) \ + $(wildcard ./src/main.c) + +# set flags of the compiler CFLAGS := -O3 \ - -I ./interface/inc/ \ - -I ../../interface/ \ - -I ../../src/ \ - -I ../../test/ \ - -I ../../example/ -mpu6050 : $(SRC) - "$(CC)" $(CFLAGS) $^ $(LIBS) -o $@ \ No newline at end of file + -DNDEBUG + +# 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) $^ $(INC_DIRS) $(LIBS) -o $@ + +# set the shared lib +$(SHARED_LIB_NAME).$(VERSION) : $(SRCS) + $(CC) $(CFLAGS) -shared -fPIC $^ $(INC_DIRS) -lm -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 $^ $(INC_DIRS) -o $@ + +# 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) diff --git a/project/raspberrypi4b/README.md b/project/raspberrypi4b/README.md index 1db3fc2..138b7e6 100644 --- a/project/raspberrypi4b/README.md +++ b/project/raspberrypi4b/README.md @@ -1,26 +1,81 @@ -### 1. chip +### 1. Chip -#### 1.1 chip info +#### 1.1 Chip Info -chip name : Raspberry Pi 4B +chip name : Raspberry Pi 4B. -iic pin: SCL/SDA GPIO3/GPIO2 +iic pin: SCL/SDA GPIO3/GPIO2. -gpio pin: INT GPIO17 +gpio pin: INT GPIO17. -### 2. install +### 2. Install -#### 2.1 install info +#### 2.1 Dependencies + +Install the necessary dependencies. ```shell -sudo apt-get install libgpiod-dev +sudo apt-get install libgpiod-dev pkg-config cmake -y +``` + +#### 2.2 Makefile +Build the project. + +```shell make ``` -### 3. mpu6050 +Install the project and this is optional. + +```shell +sudo make install +``` + +Uninstall the project and this is optional. + +```shell +sudo make uninstall +``` + +#### 2.3 CMake + +Build the project. + +```shell +mkdir build && cd build +cmake .. +make +``` + +Install the project and this is optional. + +```shell +sudo make install +``` + +Uninstall the project and this is optional. + +```shell +sudo make uninstall +``` + +Test the project and this is optional. + +```shell +make test +``` + +Find the compiled library in CMake. + +```cmake +find_package(mpu6050 REQUIRED) +``` + + +### 3. MPU6050 -#### 3.1 command Instruction +#### 3.1 Command Instruction ​ mpu6050 is a basic command which can test all mpu6050 driver function: @@ -56,7 +111,7 @@ make ​ -c pedometer -a (0 | 1) run mpu6050 pedometer function. times means the read times. -#### 3.2 command example +#### 3.2 Command Example ```shell ./mpu6050 -i diff --git a/project/raspberrypi4b/cmake/VERSION b/project/raspberrypi4b/cmake/VERSION new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/project/raspberrypi4b/cmake/VERSION @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/project/raspberrypi4b/cmake/config.cmake.in b/project/raspberrypi4b/cmake/config.cmake.in new file mode 100644 index 0000000..a982dfe --- /dev/null +++ b/project/raspberrypi4b/cmake/config.cmake.in @@ -0,0 +1,44 @@ +# +# 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. +# + +# 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 libgpiod) + +# 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) diff --git a/project/raspberrypi4b/cmake/uninstall.cmake b/project/raspberrypi4b/cmake/uninstall.cmake new file mode 100644 index 0000000..409e6a8 --- /dev/null +++ b/project/raspberrypi4b/cmake/uninstall.cmake @@ -0,0 +1,58 @@ +# +# 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() diff --git a/project/stm32f407/README.md b/project/stm32f407/README.md index 6a9d794..6194f4a 100644 --- a/project/stm32f407/README.md +++ b/project/stm32f407/README.md @@ -1,6 +1,6 @@ -### 1. chip +### 1. Chip -#### 1.1 chip info +#### 1.1 Chip Info chip name : STM32F407ZGT6. @@ -12,9 +12,9 @@ iic pin: SCL/SDA PB8/PB9. gpio pin: INT PB0. -### 2. shell +### 2. Shell -#### 2.1 shell parameter +#### 2.1 Shell Parameter baud rate: 115200. @@ -26,9 +26,9 @@ parity: none. flow control: none. -### 3. mpu6050 +### 3. MPU6050 -#### 3.1 command Instruction +#### 3.1 Command Instruction ​ mpu6050 is a basic command which can test all mpu6050 driver function: @@ -64,7 +64,7 @@ flow control: none. ​ -c pedometer -a (0 | 1) run mpu6050 pedometer function. times means the read times. -#### 3.2 command example +#### 3.2 Command Example ```shell mpu6050 -i