From a9c39df4d6aff2102962536ddb5d25c19a9b8e94 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sun, 22 Oct 2023 18:48:14 +0200 Subject: [PATCH] =?UTF-8?q?Projet=20mod=C3=A8le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .vscode/c_cpp_properties.json | 37 ++++++++++++++++++++ .vscode/settings.json | 5 +++ .vscode/tasks.json | 25 ++++++++++++++ CMakeLists.txt | 34 +++++++++++++++++++ Readme.md | 4 +++ changelog.txt | 63 +++++++++++++++++++++++++++++++++++ main.c | 16 +++++++++ pico_sdk_import.cmake | 62 ++++++++++++++++++++++++++++++++++ 9 files changed, 247 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 CMakeLists.txt create mode 100644 Readme.md create mode 100644 changelog.txt create mode 100644 main.c create mode 100644 pico_sdk_import.cmake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..2996c7e --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,37 @@ +{ + "env": { + "myDefaultIncludePath": [ + "${workspaceFolder}", + "${workspaceFolder}/VL53L8CX_ULD_API/inc", + "${workspaceFolder}/build", + "${env:PICO_SDK_PATH}/src/**/include", + "${env:PICO_SDK_PATH}/src/common/pico_base/include", + "${env:PICO_SDK_PATH}/build/generated/pico_base", + "${env:PICO_SDK_PATH}/src/common/pico_base/include/pico", + "${env:PICO_SDK_PATH}/src/common/pico_stdlib/include" + ], + "myCompilerPath": "/usr/bin/arm-none-eabi-gcc" + }, + "configurations": [ + { + "name": "Linux", + "intelliSenseMode": "linux-gcc-arm", + "includePath": [ + "${myDefaultIncludePath}", + "${workspaceFolder}/build/" + ], + "compilerPath": "/usr/bin/arm-none-eabi-gcc", + "cStandard": "c11", + "cppStandard": "c++17", + "browse": { + "path": [ + "${workspaceFolder}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + }, + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c988ddf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..c98bf9b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + "tasks": [ + { + "type": "shell", + "command": "cd build; cmake ../; make", + "label": "CMake in build/", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": false + } + }, + { + "type": "shell", + "command": "cd build; cmake ../; make Flash", + "label": "CMake & Make & Flash", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7171dd2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.13) + +include(pico_sdk_import.cmake) + +project(Mon_Projet C CXX ASM) +set(CMAKE_C_STNDARD 11) +set(CMAKE_CXX_STANDARD 17) + +set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR}) + +pico_sdk_init() + +add_executable(Mon_Projet + main.c +) + +target_include_directories(Mon_Projet PRIVATE Mon_Projet_ULD_API/inc/) + +target_link_libraries(Mon_Projet + hardware_i2c + hardware_uart + pico_stdlib + pico_multicore +) + +pico_enable_stdio_usb(Mon_Projet 1) +pico_enable_stdio_uart(Mon_Projet 1) + +pico_add_extra_outputs(Mon_Projet) + +add_custom_target(Flash + DEPENDS Mon_Projet + COMMAND sudo picotool load -f ${PROJECT_BINARY_DIR}/Mon_Projet.uf2 +) diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..cbe3ef5 --- /dev/null +++ b/Readme.md @@ -0,0 +1,4 @@ +Projet modèle pour le Rpi Pico (RP2040) +======================================= + +Ce projet est un example pour le RPI Pico, tentant d'être le plus prêt à l'emploi possible. diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..e846b66 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,63 @@ +******************************************************************************** +* +* STMicroelectronics - VL53L8CX - Ultra Lite Driver +* +******************************************************************************** + +# Driver version history + +--------------------------------------------------------------------------------------------------------------- + +Version : 1.0.0 +Date : 11/09/2022 +Comments : Initial driver release. + +--------------------------------------------------------------------------------------------------------------- + +Version : 1.0.1 +Date : 11/14/2022 +Comments : Changed module id in function vl53l8cx_is_alive(). + +--------------------------------------------------------------------------------------------------------------- + +Version : 1.0.2 +Date : 01/19/2023 +Comments : + - Changed licences for full BSD3 + - Fixed distance computing that might be wrong in some cases (random apparition) + +--------------------------------------------------------------------------------------------------------------- + + +Version : 1.0.3 +Date : 04/17/2023 +- Fixed bug in motion indicator: configuration was not correctly sent when resolution was changed +- Fixed SPI limitation in initialization sequence + + +--------------------------------------------------------------------------------------------------------------- + + +Version : 1.0.4 +Date : 04/24/2023 +- Fixed stop function that may fail when multi-sensors where used + + +--------------------------------------------------------------------------------------------------------------- + + +Version : 1.0.5 +Date : 06/09/2023 +- Added an error code VL53L8CX_STATUS_XTALK_FAILED when Xtalk calibration fails due to too good coverglass +- Updated stop() function as it has been wrongly implemented in v1.0.4. Fixed issues relative to sensor stopping. + + +--------------------------------------------------------------------------------------------------------------- + +Version : 1.1.0 +Date : 11/09/2023 +Comments : +- Added a firmware checksum. If a bit is missing during firmware download, the error status VL53L8CX_STATUS_FW_CHECKSUM_FAIL +is raised. + +--------------------------------------------------------------------------------------------------------------- diff --git a/main.c b/main.c new file mode 100644 index 0000000..f79df64 --- /dev/null +++ b/main.c @@ -0,0 +1,16 @@ +/***** + * Copyright (c) 2023 - Poivron Robotique + * + * SPDX-License-Identifier: BSD-3-Clause +*/ +#include "pico/stdlib.h" +#include + +void main(void) +{ + stdio_init_all(); + while(1){ + printf("Exemple\n"); + sleep_ms(1000); + } +} diff --git a/pico_sdk_import.cmake b/pico_sdk_import.cmake new file mode 100644 index 0000000..28efe9e --- /dev/null +++ b/pico_sdk_import.cmake @@ -0,0 +1,62 @@ +# This is a copy of /external/pico_sdk_import.cmake + +# This can be dropped into an external project to help locate this SDK +# It should be include()ed prior to project() + +if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) + set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) + message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") +endif () + +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) + set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) + message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") +endif () + +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) + set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) + message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") +endif () + +set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") +set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") +set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") + +if (NOT PICO_SDK_PATH) + if (PICO_SDK_FETCH_FROM_GIT) + include(FetchContent) + set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) + if (PICO_SDK_FETCH_FROM_GIT_PATH) + get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") + endif () + FetchContent_Declare( + pico_sdk + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG master + ) + if (NOT pico_sdk) + message("Downloading Raspberry Pi Pico SDK") + FetchContent_Populate(pico_sdk) + set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) + endif () + set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) + else () + message(FATAL_ERROR + "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." + ) + endif () +endif () + +get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") +if (NOT EXISTS ${PICO_SDK_PATH}) + message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") +endif () + +set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) +if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) + message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") +endif () + +set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) + +include(${PICO_SDK_INIT_CMAKE_FILE})