diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8f1b006 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +project(RP2040_Servomoteurs C) + +include(../pico_sdk_import.cmake) + +add_library(RP2040_Servomoteurs + Servomoteur.c +) + +target_link_libraries(RP2040_Servomoteurs + pico_stdlib + hardware_pwm +) diff --git a/Readme.md b/Readme.md index 8dcf141..0b561a8 100644 --- a/Readme.md +++ b/Readme.md @@ -21,18 +21,15 @@ Ajouter le fichier nouvellement créé .gitmodules à votre projet. Configuration de la compilation ------------------------------- -Dans le fichier CMakeLists.txt, ajouter le fichier Servomoteur.c +Dans le fichier CMakeLists.txt, ajouter le dossier du sub module: - add_executable( - ... - RP2040_Servomoteurs/Servomoteur.c - ) + add_subdirectory(RP2040_Servomoteurs) -Dans le fichier CMakeLists.txt, ajouter la bibliothèque PWM : +Dans le fichier CMakeLists.txt, ajouter la bibliothèque RP2040_Servomoteur : target_link_libraries(Modele_RPiPico ... - hardware_pwm + RP2040_Servomoteur ) Intégration au code source diff --git a/Servomoteur.h b/Servomoteur.h index 046e74f..6cc81e1 100644 --- a/Servomoteur.h +++ b/Servomoteur.h @@ -8,9 +8,12 @@ #define SERVO_VALEUR_0_5MS 261 -// Servomoteurs +// Nom des GPIOs des servomoteurs. +// Ici, SERVO0 utilisera la GPIO 0 du RP2040 #define SERVO0 0 #define SERVO1 1 + +// Position prédéfinies #define DOIGT_AVANCE 0, SERVO_VALEUR_1_5MS #define DOIGT_RETRAIT 0, SERVO_VALEUR_0_5MS