-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
26 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
// | ||
// Copyright (c) 2024 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "FreeRTOS.h" | ||
#include "pico/cyw43_arch.h" | ||
#include "pico/stdlib.h" | ||
#include "task.h" | ||
|
||
#define TEST_TASK_PRIORITY (tskIDLE_PRIORITY + 2UL) | ||
#define TASK_PRIORITY (tskIDLE_PRIORITY + 2UL) | ||
#define WIFI_TIMEOUT 30000 | ||
|
||
int app_main(); | ||
|
||
|
@@ -18,15 +33,16 @@ void print_ip_address() { | |
} | ||
} | ||
|
||
void main_task(__unused void *params) { | ||
void main_task(void *params) { | ||
(void)params; | ||
if (cyw43_arch_init()) { | ||
printf("Failed to initialise\n"); | ||
return; | ||
} | ||
|
||
cyw43_arch_enable_sta_mode(); | ||
printf("Connecting to Wi-Fi...\n"); | ||
if (cyw43_arch_wifi_connect_timeout_ms(WIFI_SSID, WIFI_PASSWORD, CYW43_AUTH_WPA2_AES_PSK, 30000) == 0) { | ||
if (cyw43_arch_wifi_connect_timeout_ms(WIFI_SSID, WIFI_PASSWORD, CYW43_AUTH_WPA2_AES_PSK, WIFI_TIMEOUT) == 0) { | ||
printf("Wi-Fi connected.\n"); | ||
print_ip_address(); | ||
app_main(); | ||
|
@@ -44,7 +60,7 @@ void main_task(__unused void *params) { | |
int main(void) { | ||
stdio_init_all(); | ||
|
||
xTaskCreate(main_task, "TestMainThread", configMINIMAL_STACK_SIZE * 16, NULL, TEST_TASK_PRIORITY, NULL); | ||
xTaskCreate(main_task, "MainThread", configMINIMAL_STACK_SIZE * 16, NULL, TASK_PRIORITY, NULL); | ||
|
||
vTaskStartScheduler(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#ifndef ZENOH_PICO_SYSTEM_RPI_PICO_W_TYPES_H | ||
#define ZENOH_PICO_SYSTEM_RPI_PICO_W_TYPES_H | ||
|
@@ -28,11 +29,6 @@ typedef struct { | |
const char *name; | ||
UBaseType_t priority; | ||
size_t stack_depth; | ||
#if (configSUPPORT_STATIC_ALLOCATION == 1) | ||
bool static_allocation; | ||
StackType_t *stack_buffer; | ||
StaticTask_t *task_buffer; | ||
#endif /* SUPPORT_STATIC_ALLOCATION */ | ||
} z_task_attr_t; | ||
|
||
typedef struct { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include <stdlib.h> | ||
|
||
|
@@ -33,7 +34,7 @@ z_result_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_addre | |
|
||
struct addrinfo hints; | ||
(void)memset(&hints, 0, sizeof(hints)); | ||
hints.ai_family = PF_UNSPEC; // Allow IPv4 or IPv6 | ||
hints.ai_family = PF_UNSPEC; | ||
hints.ai_socktype = SOCK_STREAM; | ||
hints.ai_flags = 0; | ||
hints.ai_protocol = IPPROTO_TCP; | ||
|
@@ -42,7 +43,6 @@ z_result_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_addre | |
ret = _Z_ERR_GENERIC; | ||
} | ||
|
||
_Z_DEBUG("_z_create_endpoint_tcp: %s:%s -> %li", s_address, s_port, ep->_iptcp->ai_addrlen); | ||
return ret; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters