commit 156db4ba59ba49a595b327c58ba2804ef0007e7d Author: Ulysse Cura Date: Wed Oct 7 10:00:15 2026 +0200 Ready to develop. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c264f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode/ccls-cache +build \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a01766f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/Pico_USB_Host"] + path = lib/Pico_USB_Host + url = https://gitea.skadubpc.net/ulysse/Pico_USB_Host_Lib.git diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..5d9ccf7 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "Linux", + "intelliSenseMode": "linux-gcc-arm", + "includePath": [ + "${env:PICO_SDK_PATH}/src/**/include/", + "${env:PICO_SDK_PATH}/lib/**/include/", + "${env:PICO_SDK_PATH}/lib/**/src/", + "${workspaceFolder}/build/generated/pico_base/", + "${workspaceFolder}/src/", + "${workspaceFolder}/lib/**/" + ], + "compilerPath": "/usr/bin/arm-none-eabi-gcc", + "cStandard": "c17", + "browse": { + "path": [ + "${workspaceFolder}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..c5fe75c --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,114 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Configure", + "detail": "configure project", + "type": "shell", + "command": "cmake", + "args": [ + "-H.", + "-Bbuild" + ], + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": true, + "panel": "shared", + "showReuseMessage": true, + "clear": true + } + }, + { + "label": "Build", + "detail": "Build project", + "dependsOn": [ + "Configure" + ], + "type": "shell", + "command": "make", + "args": [ + "-C", + "build", + "-j$(nproc)" + ], + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": true, + "panel": "shared", + "showReuseMessage": true, + "clear": true + } + }, + { + "label": "Flash Access Point", + "detail": "Build and flash access point", + "type": "shell", + "dependsOn": [ + "Configure" + ], + "command": "make", + "args": [ + "-C", + "build", + "-j$(nproc)", + "Flash_Access_Point" + ], + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": true, + "panel": "shared", + "showReuseMessage": true, + "clear": true + } + }, + { + "label": "Flash Station", + "detail": "Build and flash station", + "type": "shell", + "dependsOn": [ + "Configure" + ], + "command": "make", + "args": [ + "-C", + "build", + "-j$(nproc)", + "Flash_Station" + ], + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": true, + "panel": "shared", + "showReuseMessage": true, + "clear": true + } + }, + { + "label": "Clean", + "detail": "Clean build directory and executable", + "type": "shell", + "command": "rm", + "args": [ + "-rf", + "build" + ], + "group": "build", + "presentation": { + "echo": false, + "reveal": "never", + "focus": false, + "panel": "shared", + "showReuseMessage": false, + "clear": true + } + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..57605c2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.13) + +# Explicitely define board +set(PICO_BOARD pico) +if(NOT DEFINED PICO_BOARD) + add_definitions(-DPICO_BOARD=${PICO_BOARD}) +endif() + +# Include pico-sdk cmake support +include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) + +project(Pico_USB_Tests C CXX ASM) +set(CMAKE_C_STANDARD 17) +set(CMAKE_CXX_STANDARD 17) + +pico_sdk_init() + +# Executables and sources +add_executable(Pico_Host + src/main_host.c +) + +add_executable(Pico_Device + src/main_device.c +) + +# Libs +add_subdirectory(lib/Pico_USB_Host) + +target_link_libraries(Pico_Host + pico_stdlib + Pico_USB_Host +) + +target_link_libraries(Pico_Device + pico_stdlib +) + +# Stdio configuration +pico_enable_stdio_usb(Pico_Host 1) +pico_enable_stdio_uart(Pico_Host 1) + +pico_enable_stdio_usb(Pico_Device 1) +pico_enable_stdio_uart(Pico_Device 1) + +# Output +pico_add_extra_outputs(Pico_Host) +pico_add_extra_outputs(Pico_Device) + +# Flash target +add_custom_target(Flash_host + DEPENDS Pico_Host + COMMAND picotool load -f ${PROJECT_BINARY_DIR}/Pico_Host.uf2 +) + +add_custom_target(Flash_Device + DEPENDS Pico_Device + COMMAND picotool load -f ${PROJECT_BINARY_DIR}/Pico_Device.uf2 +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..95cc531 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# PicoW_UDP_Tests + +Test of the library PicoW_UDP_Lib. \ No newline at end of file diff --git a/lib/Pico_USB_Host b/lib/Pico_USB_Host new file mode 160000 index 0000000..adffbe8 --- /dev/null +++ b/lib/Pico_USB_Host @@ -0,0 +1 @@ +Subproject commit adffbe805b938541659b6fa4688a5665ddbc5b9e diff --git a/src/main_device.c b/src/main_device.c new file mode 100644 index 0000000..349df8b --- /dev/null +++ b/src/main_device.c @@ -0,0 +1,28 @@ +#include + +int main(void) +{ + stdio_init_all(); + + gpio_init(PICO_DEFAULT_LED_PIN); + gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT); + + while(true) + { + static uint64_t last_time = 0; + uint64_t time = time_us_64(); + if(time - last_time > 1000 * 1000) + { + last_time = time; + + static bool led_state = true; + led_state = !led_state; + + gpio_put(PICO_DEFAULT_LED_PIN, led_state); + } + + tight_loop_contents(); + } + + return PICO_OK; +} \ No newline at end of file diff --git a/src/main_host.c b/src/main_host.c new file mode 100644 index 0000000..a4cc87e --- /dev/null +++ b/src/main_host.c @@ -0,0 +1,24 @@ +#include + +int main(void) +{ + stdio_init_all(); + + gpio_init(PICO_DEFAULT_LED_PIN); + gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT); + + for(int i = 0; i < 3; i++) + { + gpio_put(PICO_DEFAULT_LED_PIN, false); + sleep_ms(100); + gpio_put(PICO_DEFAULT_LED_PIN, true); + sleep_ms(100); + } + + while(true) + { + tight_loop_contents(); + } + + return PICO_OK; +} \ No newline at end of file