Making vscode config files compatible for compiling UDP

This commit is contained in:
Ulysse Cura 2025-05-23 21:22:55 +02:00
parent 88c2b6e388
commit 7e3b0e7a9d
4 changed files with 35 additions and 14 deletions

View File

@ -2,7 +2,9 @@
"env": { "env": {
"myDefaultIncludePath": [ "myDefaultIncludePath": [
"${env:PICO_SDK_PATH}/src/**/include/", "${env:PICO_SDK_PATH}/src/**/include/",
"${workspaceFolder}/build/generated/pico_base/" "${env:PICO_SDK_PATH}/lib/**/include/",
"${workspaceFolder}/build/generated/pico_base/",
"${workspaceFolder}/src/include/"
], ],
"myCompilerPath": "/usr/bin/arm-none-eabi-gcc" "myCompilerPath": "/usr/bin/arm-none-eabi-gcc"
}, },

View File

@ -7,6 +7,11 @@
"stdint.h": "c", "stdint.h": "c",
"gyro.h": "c", "gyro.h": "c",
"motors.h": "c", "motors.h": "c",
"motion_control.h": "c" "motion_control.h": "c",
"i2c_master.h": "c",
"udp_client.h": "c",
"udp_payload.h": "c",
"udp.h": "c",
"opt.h": "c"
} }
} }

View File

@ -2,7 +2,7 @@
"tasks": [ "tasks": [
{ {
"type": "shell", "type": "shell",
"command": "cd build; cmake ../; make", "command": "cd build; cmake -DPICO_BOARD=pico_w ..; make",
"label": "CMake in build/", "label": "CMake in build/",
"problemMatcher": [], "problemMatcher": [],
"group": { "group": {
@ -12,7 +12,7 @@
}, },
{ {
"type": "shell", "type": "shell",
"command": "cd build; cmake ../; make Flash", "command": "cd build; cmake -DPICO_BOARD=pico_w ..; make Flash",
"label": "CMake & Make & Flash", "label": "CMake & Make & Flash",
"problemMatcher": [], "problemMatcher": [],
"group": { "group": {

View File

@ -2,38 +2,52 @@ cmake_minimum_required(VERSION 3.13)
include(pico_sdk_import.cmake) include(pico_sdk_import.cmake)
project(motion_controller C CXX ASM) project(main_controller C CXX ASM)
set(CMAKE_C_STNDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR}) set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR})
# Définir explicitement la carte comme Pico W
set(PICO_BOARD pico_w)
if(NOT DEFINED PICO_BOARD)
add_definitions(-DPICO_BOARD=${PICO_BOARD})
endif()
pico_sdk_init() pico_sdk_init()
add_executable(motion_controller add_executable(main_controller
src/main.c src/main.c
src/robot.c src/robot.c
src/motors.c src/motors.c
src/gyro.c src/gyro.c
src/motion_control.c src/motion_control.c
src/i2c_master.c src/i2c_master.c
# src/udp_fake_client.c
src/udp_client.c src/udp_client.c
src/udp_buffer.c src/udp_payload.c
src/wifi_operator.c
) )
target_link_libraries(motion_controller target_include_directories(main_controller PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/src/include
)
target_link_libraries(main_controller
hardware_i2c hardware_i2c
hardware_pwm hardware_pwm
hardware_uart hardware_uart
pico_stdlib pico_stdlib
pico_cyw43_arch_lwip_poll
) )
pico_enable_stdio_usb(motion_controller 1) pico_enable_stdio_usb(main_controller 1)
pico_enable_stdio_uart(motion_controller 1) pico_enable_stdio_uart(main_controller 1)
pico_add_extra_outputs(motion_controller) pico_add_extra_outputs(main_controller)
add_custom_target(Flash add_custom_target(Flash
DEPENDS motion_controller DEPENDS main_controller
COMMAND sudo picotool load -f ${PROJECT_BINARY_DIR}/motion_controller.uf2 COMMAND sudo picotool load -f ${PROJECT_BINARY_DIR}/main_controller.uf2
) )