Initial commit.
This commit is contained in:
commit
ca79a9201e
|
|
@ -0,0 +1 @@
|
|||
build
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build",
|
||||
"detail": "Build project",
|
||||
"type": "shell",
|
||||
"command": "cmake -H. -Bbuild && make -j$(nproc) -C build",
|
||||
"args": [
|
||||
],
|
||||
"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 -rf build",
|
||||
"args": [
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": false,
|
||||
"reveal": "never",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": false,
|
||||
"clear": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"detail": "Flash executable",
|
||||
"type": "shell",
|
||||
"dependsOn": "Build",
|
||||
"command": "make Flash -C build",
|
||||
"args": [
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
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()
|
||||
|
||||
# Need to include pico-sdk cmake support. Must happen before project.
|
||||
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
|
||||
|
||||
project(Controller C CXX ASM)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
pico_sdk_init()
|
||||
|
||||
add_executable(Controller
|
||||
src/main.c
|
||||
)
|
||||
|
||||
add_subdirectory(lib/PicoW_WiFi_Operator)
|
||||
add_subdirectory(lib/PicoW_UDP)
|
||||
|
||||
target_link_libraries(Controller
|
||||
pico_stdlib
|
||||
PicoW_WiFi_Operator
|
||||
PicoW_UDP
|
||||
)
|
||||
|
||||
# Stdio configuration
|
||||
pico_enable_stdio_usb(Controller 1)
|
||||
pico_enable_stdio_uart(Controller 1)
|
||||
|
||||
pico_add_extra_outputs(Controller)
|
||||
|
||||
add_custom_target(Flash
|
||||
DEPENDS Controller
|
||||
COMMAND picotool load -f ${PROJECT_BINARY_DIR}/Controller.uf2
|
||||
)
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 66f06c7ef5301235230d57fe066ddfb1d0fdc692
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9dc7a912ec94f2bcf2819adf4306c1c34151204c
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#include <pico/stdlib.h>
|
||||
#include <pico/cyw43_arch.h>
|
||||
#include "PicoW_WiFi_Operator.h"
|
||||
#include "PicoW_UDP.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialisation
|
||||
stdio_init_all();
|
||||
|
||||
if(cyw43_arch_init_with_country(CYW43_COUNTRY_FRANCE))
|
||||
{
|
||||
printf("Failed initialising cyw43 arch.");
|
||||
return PICO_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, true);
|
||||
|
||||
if(wifi_operator_init(WIFI_OPERATOR_MODE_ACCESS_POINT)) return PICO_ERROR_GENERIC;
|
||||
|
||||
struct udp_server_t udp_server;
|
||||
|
||||
if(udp_server_init(&udp_server)) return PICO_ERROR_GENERIC;
|
||||
|
||||
// Initialisation done
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, false);
|
||||
sleep_ms(100);
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, true);
|
||||
sleep_ms(100);
|
||||
}
|
||||
|
||||
while(true)
|
||||
{
|
||||
cyw43_arch_poll();
|
||||
|
||||
tight_loop_contents();
|
||||
}
|
||||
|
||||
if(wifi_operator_exit()) return PICO_ERROR_GENERIC;
|
||||
|
||||
cyw43_arch_deinit();
|
||||
|
||||
return PICO_OK;
|
||||
}
|
||||
Loading…
Reference in New Issue