commit ef0b9a8602a1125d3519b8cc471c08f00aabdfc5 Author: Ulysse Cura Date: Mon Sep 21 19:08:44 2026 +0200 Initial commit. 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..9bea999 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "lib/PicoW_UDP"] + path = lib/PicoW_UDP + url = https://gitea.skadubpc.net/ulysse/PicoW_UDP_Lib.git +[submodule "lib/PicoW_WiFi_Operator"] + path = lib/PicoW_WiFi_Operator + url = https://gitea.skadubpc.net/ulysse/PicoW_WiFi_Operator_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..77a0edc --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,90 @@ +{ + "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", + "detail": "Build and flash executable", + "type": "shell", + "dependsOn": [ + "Configure" + ], + "command": "make", + "args": [ + "-C", + "build", + "-j$(nproc)", + "Flash" + ], + "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..d397c47 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.13) + +# Explicitely define board +set(PICO_BOARD pico_w) +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(PicoW_UDP_Tests C CXX ASM) +set(CMAKE_C_STANDARD 17) +set(CMAKE_CXX_STANDARD 17) + +pico_sdk_init() + +# Sources +add_executable(PicoW_UDP_Tests + src/main.c +) + +# Libs +add_subdirectory(lib/PicoW_WiFi_Operator) +add_subdirectory(lib/PicoW_UDP) +target_link_libraries(PicoW_UDP_Tests + pico_stdlib + PicoW_WiFi_Operator + PicoW_UDP +) + +# Stdio configuration +pico_enable_stdio_usb(PicoW_UDP_Tests 1) +pico_enable_stdio_uart(PicoW_UDP_Tests 1) + +# Output +pico_add_extra_outputs(PicoW_UDP_Tests) + +# Flash target +add_custom_target(Flash + DEPENDS PicoW_UDP_Tests + COMMAND picotool load -f ${PROJECT_BINARY_DIR}/PicoW_UDP_Tests.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/PicoW_UDP b/lib/PicoW_UDP new file mode 160000 --- /dev/null +++ b/lib/PicoW_UDP @@ -0,0 +1 @@ +Subproject commit 0000000000000000000000000000000000000000 diff --git a/lib/PicoW_WiFi_Operator b/lib/PicoW_WiFi_Operator new file mode 160000 --- /dev/null +++ b/lib/PicoW_WiFi_Operator @@ -0,0 +1 @@ +Subproject commit 0000000000000000000000000000000000000000 diff --git a/python_test_codes/test_udp_send.py b/python_test_codes/test_udp_send.py new file mode 100755 index 0000000..fe2f02c --- /dev/null +++ b/python_test_codes/test_udp_send.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import socket +import time +import struct + +sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +pico_address = ('255.255.255.255', 4243) + +packet_number = 0 +instruction = 0 + +while True: + # Créer le message binaire + message = struct.pack('BB', packet_number, instruction) + sock.sendto(message, pico_address) + + packet_number = (packet_number + 1) % 256 + instruction = (instruction + 1) % 256 + print("Sended") + time.sleep(3.5) diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..3241e90 --- /dev/null +++ b/src/main.c @@ -0,0 +1,13 @@ +#include +#include +#include "PicoW_WiFi_Operator.h" +#include "PicoW_UDP.h" + +int main(void) +{ + stdio_init_all(); + + puts("Hello, World !"); + + return 0; +} \ No newline at end of file