Sync while working on OT
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s
All checks were successful
Deploy Docs / build-and-deploy (push) Successful in 12s
This commit is contained in:
44
firmware/apps/_samples/thread/nrf52840dk_nrf52840.overlay
Normal file
44
firmware/apps/_samples/thread/nrf52840dk_nrf52840.overlay
Normal file
@@ -0,0 +1,44 @@
|
||||
// To get started, press Ctrl+Space (or Option+Esc) to bring up the completion menu and view the available nodes.
|
||||
|
||||
// You can also use the buttons in the sidebar to perform actions on nodes.
|
||||
// Actions currently available include:
|
||||
|
||||
// * Enabling / disabling the node
|
||||
// * Adding the bus to a bus
|
||||
// * Removing the node
|
||||
// * Connecting ADC channels
|
||||
|
||||
// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
|
||||
// You can also visit the nRF DeviceTree extension documentation at https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/ncs_configure_app.html#devicetree-support-in-the-extension
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
nordic,pm-ext-flash = &mx25r64;
|
||||
};
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
i2s0_default: i2s0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(I2S_SCK_M, 0, 31)>, /* SCK Pin */
|
||||
<NRF_PSEL(I2S_LRCK_M, 0, 30)>, /* WS/LRCK Pin */
|
||||
<NRF_PSEL(I2S_SDOUT, 0, 29)>; /* SD Pin (DIN am MAX) */
|
||||
};
|
||||
};
|
||||
|
||||
i2s0_sleep: i2s0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(I2S_SCK_M, 0, 31)>,
|
||||
<NRF_PSEL(I2S_LRCK_M, 0, 30)>,
|
||||
<NRF_PSEL(I2S_SDOUT, 0, 29)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2s0 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&i2s0_default>;
|
||||
pinctrl-1 = <&i2s0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
};
|
||||
@@ -6,12 +6,17 @@ CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
# Shell configuration
|
||||
CONFIG_SHELL_BACKEND_SERIAL=y
|
||||
CONFIG_FILE_SYSTEM_SHELL=y
|
||||
|
||||
# Lasertag-specific configuration
|
||||
CONFIG_BLE_MGMT=y
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_GAME_MGMT_SHELL=y
|
||||
CONFIG_GAME_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_LASERTAG_ROLE_LEADER=y
|
||||
CONFIG_THREAD_MGMT=y
|
||||
CONFIG_THREAD_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_THREAD_MGMT_SHELL=y
|
||||
CONFIG_FS_MGMT=y
|
||||
CONFIG_FS_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_AUDIO_LOG_LEVEL_DBG=y
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <thread_mgmt.h>
|
||||
#include <game_mgmt.h>
|
||||
#include <lasertag_utils.h>
|
||||
#include <fs_mgmt.h>
|
||||
#include <audio.h>
|
||||
|
||||
LOG_MODULE_REGISTER(OT_SAMPLE, LOG_LEVEL_INF);
|
||||
|
||||
@@ -17,6 +19,20 @@ int main(void)
|
||||
}
|
||||
LOG_INF("Thread management initialized successfully.");
|
||||
|
||||
rc = fs_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("File system management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("File system management initialized successfully.");
|
||||
|
||||
rc = audio_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Audio initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("Audio initialized successfully.");
|
||||
|
||||
rc = game_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Game management initialization failed: %d", rc);
|
||||
|
||||
@@ -1,43 +1,29 @@
|
||||
# Console and Logging
|
||||
CONFIG_LOG=y
|
||||
|
||||
# UART basics
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
# Shell and Built-in Commands
|
||||
CONFIG_SHELL=y
|
||||
CONFIG_DEVICE_SHELL=n
|
||||
CONFIG_DEVMEM_SHELL=n
|
||||
# Shell configuration
|
||||
CONFIG_SHELL_BACKEND_SERIAL=y
|
||||
CONFIG_FILE_SYSTEM_SHELL=y
|
||||
|
||||
# Stack protection
|
||||
CONFIG_HW_STACK_PROTECTION=y
|
||||
CONFIG_STACK_SENTINEL=y
|
||||
|
||||
# --- STACK SIZE UPDATES (Fixes the MPU/Stack Fault) ---
|
||||
CONFIG_MAIN_STACK_SIZE=4096
|
||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
|
||||
CONFIG_BT_RX_STACK_SIZE=4096
|
||||
|
||||
# Storage and Settings (NVS)
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_FLASH_MAP=y
|
||||
CONFIG_NVS=y
|
||||
CONFIG_SETTINGS=y
|
||||
|
||||
# --- CoAP & UDP Features ---
|
||||
CONFIG_OPENTHREAD_COAP=y
|
||||
CONFIG_OPENTHREAD_MANUAL_START=y
|
||||
|
||||
# Bluetooth
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT_DEVICE_NAME="Lasertag-Device"
|
||||
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
|
||||
CONFIG_BT_L2CAP_TX_MTU=252
|
||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||
CONFIG_BT_BUF_ACL_RX_SIZE=251
|
||||
CONFIG_BT_ATT_PREPARE_COUNT=5
|
||||
CONFIG_BT_LOG_LEVEL_WRN=y
|
||||
|
||||
# Enable Lasertag Shared Modules
|
||||
CONFIG_LASERTAG_UTILS=y
|
||||
# Lasertag-specific configuration
|
||||
CONFIG_BLE_MGMT=y
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_GAME_MGMT_SHELL=y
|
||||
CONFIG_GAME_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_THREAD_MGMT=y
|
||||
CONFIG_THREAD_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_BLE_MGMT=y
|
||||
CONFIG_BLE_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_THREAD_MGMT_SHELL=y
|
||||
CONFIG_FS_MGMT=y
|
||||
CONFIG_FS_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_AUDIO_LOG_LEVEL_DBG=y
|
||||
|
||||
CONFIG_LASERTAG_ROLE_LEADER=y
|
||||
|
||||
CONFIG_ENTROPY_GENERATOR=y
|
||||
@@ -1,52 +1,56 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <lasertag_utils.h>
|
||||
#include <thread_mgmt.h>
|
||||
#include <ble_mgmt.h>
|
||||
#include <game_mgmt.h>
|
||||
#include <lasertag_utils.h>
|
||||
#include <fs_mgmt.h>
|
||||
#include <audio.h>
|
||||
#include <zephyr/random/random.h>
|
||||
|
||||
LOG_MODULE_REGISTER(leader_app, CONFIG_LOG_DEFAULT_LEVEL);
|
||||
LOG_MODULE_REGISTER(OT_SAMPLE, LOG_LEVEL_INF);
|
||||
|
||||
uint64_t generate_64bit_random(void) {
|
||||
uint64_t rnd_val;
|
||||
|
||||
/* Füllt den Speicherbereich der Variable mit Zufallsbytes */
|
||||
sys_csrand_get(&rnd_val, sizeof(rnd_val));
|
||||
|
||||
return rnd_val;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Initialize shared project logic and NVS */
|
||||
LOG_INF("Starting Thread Management test application...");
|
||||
lasertag_utils_init();
|
||||
|
||||
/* Initialize and start BLE management for provisioning */
|
||||
int err = ble_mgmt_init(LT_TYPE_LEADER);
|
||||
if (err) {
|
||||
LOG_ERR("BLE initialization failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("BLE Management initialized successfully.");
|
||||
int rc = thread_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Thread management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("Thread management initialized successfully.");
|
||||
|
||||
/* Initialize and start OpenThread stack */
|
||||
err = thread_mgmt_init();
|
||||
if (err) {
|
||||
LOG_ERR("Thread initialization failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("Leader Application successfully started with Thread Mesh.");
|
||||
rc = fs_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("File system management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("File system management initialized successfully.");
|
||||
|
||||
/* Start BLE advertising */
|
||||
err = ble_mgmt_adv_start();
|
||||
if (err) {
|
||||
LOG_ERR("BLE advertising start failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("BLE advertising started.");
|
||||
rc = audio_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Audio initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("Audio initialized successfully.");
|
||||
|
||||
/* Initialize game management module */
|
||||
err = game_mgmt_init();
|
||||
if (err) {
|
||||
LOG_ERR("Game Management initialization failed (err %d)", err);
|
||||
return err;
|
||||
} else {
|
||||
LOG_INF("Game Management initialized successfully.");
|
||||
rc = game_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Game management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF(FORMAT_BRIGHT("Game management initialized successfully. Switching to LOBBY state..."));
|
||||
game_mgmt_set_game_id(generate_64bit_random()); /* Set a dummy game ID for testing */
|
||||
game_mgmt_set_state(SYS_STATE_LOBBY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/ {
|
||||
chosen {
|
||||
nordic,pm-ext-flash = &mx25r64;
|
||||
};
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
littlefs_storage:
|
||||
address: 0x0
|
||||
size: 0x800000
|
||||
region: external_flash
|
||||
1
firmware/apps/vest/pm_static.yml
Symbolic link
1
firmware/apps/vest/pm_static.yml
Symbolic link
@@ -0,0 +1 @@
|
||||
../leader/pm_static.yml
|
||||
@@ -1,40 +1,28 @@
|
||||
# Console and Logging
|
||||
CONFIG_LOG=y
|
||||
|
||||
# UART basics
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
# Shell and Built-in Commands
|
||||
CONFIG_SHELL=y
|
||||
CONFIG_DEVICE_SHELL=n
|
||||
CONFIG_DEVMEM_SHELL=n
|
||||
# Shell configuration
|
||||
CONFIG_SHELL_BACKEND_SERIAL=y
|
||||
CONFIG_FILE_SYSTEM_SHELL=y
|
||||
|
||||
# Lasertag-specific configuration
|
||||
CONFIG_AUDIO=y
|
||||
CONFIG_AUDIO_LOG_LEVEL_DBG=y
|
||||
|
||||
# --- STACK SIZE UPDATES (Fixes the MPU/Stack Fault) ---
|
||||
CONFIG_MAIN_STACK_SIZE=4096
|
||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
|
||||
CONFIG_BT_RX_STACK_SIZE=4096
|
||||
CONFIG_BLE_MGMT=y
|
||||
|
||||
# Storage and Settings (NVS)
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_FLASH_MAP=y
|
||||
CONFIG_NVS=y
|
||||
CONFIG_SETTINGS=y
|
||||
|
||||
# Network and OpenThread
|
||||
# CONFIG_NETWORKING=y
|
||||
# CONFIG_NET_L2_OPENTHREAD=y
|
||||
# CONFIG_OPENTHREAD=y
|
||||
# CONFIG_OPENTHREAD_SHELL=y
|
||||
# CONFIG_OPENTHREAD_DEFAULT_TX_POWER=8
|
||||
|
||||
# CONFIG_OPENTHREAD_COAP=y
|
||||
# CONFIG_OPENTHREAD_MANUAL_START=y
|
||||
|
||||
|
||||
# Enable Lasertag Shared Modules
|
||||
CONFIG_LASERTAG_UTILS=n
|
||||
CONFIG_THREAD_MGMT=n
|
||||
CONFIG_OPENTHREAD_FTD=y
|
||||
CONFIG_BLE_MGMT=n
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_GAME_MGMT_SHELL=y
|
||||
CONFIG_GAME_MGMT_LOG_LEVEL_DBG=y
|
||||
|
||||
CONFIG_THREAD_MGMT=y
|
||||
CONFIG_THREAD_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_THREAD_MGMT_SHELL=y
|
||||
|
||||
CONFIG_FS_MGMT=y
|
||||
CONFIG_FS_MGMT_LOG_LEVEL_DBG=y
|
||||
|
||||
CONFIG_LASERTAG_ROLE_VEST=y
|
||||
@@ -1,72 +1,44 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#ifdef CONFIG_LASERTAG_UTILS
|
||||
#include <lasertag_utils.h>
|
||||
#endif
|
||||
#ifdef CONFIG_THREAD_MGMT
|
||||
#include <thread_mgmt.h>
|
||||
#endif
|
||||
#ifdef CONFIG_BLE_MGMT
|
||||
#include <ble_mgmt.h>
|
||||
#endif
|
||||
#ifdef CONFIG_FS_MGMT
|
||||
#include <game_mgmt.h>
|
||||
#include <lasertag_utils.h>
|
||||
#include <fs_mgmt.h>
|
||||
#endif
|
||||
#include <audio.h>
|
||||
|
||||
LOG_MODULE_REGISTER(vest_app, CONFIG_LOG_DEFAULT_LEVEL);
|
||||
LOG_MODULE_REGISTER(OT_SAMPLE, LOG_LEVEL_INF);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
#ifdef CONFIG_LASERTAG_UTILS
|
||||
/* Initialize shared project logic and NVS */
|
||||
LOG_INF("Starting Thread Management test application...");
|
||||
lasertag_utils_init();
|
||||
#endif
|
||||
int rc = thread_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Thread management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
LOG_INF("Thread management initialized successfully.");
|
||||
|
||||
#ifdef CONFIG_FS_MGMT
|
||||
/* Initialize filesystem management */
|
||||
rc = fs_mgmt_init();
|
||||
if (rc) {
|
||||
LOG_ERR("Filesystem management initialization failed (err %d)", rc);
|
||||
if (rc < 0) {
|
||||
LOG_ERR("File system management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
LOG_INF("File system management initialized successfully.");
|
||||
|
||||
#ifdef CONFIG_BLE_MGMT
|
||||
/* Initialize and start BLE management for provisioning */
|
||||
rc = ble_mgmt_init(LT_TYPE_VEST);
|
||||
if (rc) {
|
||||
LOG_ERR("BLE initialization failed (err %d)", rc);
|
||||
return rc;
|
||||
} else {
|
||||
LOG_INF("BLE Management initialized successfully.");
|
||||
}
|
||||
|
||||
/* Start BLE advertising */
|
||||
rc = ble_mgmt_adv_start();
|
||||
if (rc) {
|
||||
LOG_ERR("BLE advertising start failed (err %d)", rc);
|
||||
} else {
|
||||
LOG_INF("BLE advertising started.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_THREAD_MGMT
|
||||
/* Initialize and start OpenThread stack */
|
||||
rc = thread_mgmt_init();
|
||||
if (rc) {
|
||||
LOG_ERR("Thread initialization failed (err %d)", rc);
|
||||
} else {
|
||||
LOG_INF("Vest Application successfully started with Thread Mesh.");
|
||||
rc = audio_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Audio initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
LOG_INF("Audio initialized successfully.");
|
||||
|
||||
while (1) {
|
||||
/* Main loop - handle high-level game logic here */
|
||||
k_sleep(K_MSEC(1000));
|
||||
rc = game_mgmt_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Game management initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
LOG_INF(FORMAT_BRIGHT("Game management initialized successfully. Switching to LOBBY state..."));
|
||||
game_mgmt_set_state(SYS_STATE_LOBBY);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
# Logging
|
||||
CONFIG_LOG=y
|
||||
CONFIG_LASERTAG_WEAPON_LOG_LEVEL_INF=y
|
||||
|
||||
# Network / OpenThread
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NET_L2_OPENTHREAD=y
|
||||
CONFIG_OPENTHREAD_COAP=y
|
||||
# UART basics
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
# Hardware (Buttons & LEDs)
|
||||
CONFIG_DK_LIBRARY=y
|
||||
# Shell configuration
|
||||
CONFIG_SHELL_BACKEND_SERIAL=y
|
||||
CONFIG_FILE_SYSTEM_SHELL=y
|
||||
|
||||
# Lasertag Game Logic
|
||||
CONFIG_LASERTAG_GAME_LOGIC=y
|
||||
CONFIG_LASERTAG_ROLE_PLAYER=y
|
||||
CONFIG_LASERTAG_PLAYER_ID_DEFAULT=2
|
||||
# Lasertag-specific configuration
|
||||
CONFIG_BLE_MGMT=y
|
||||
CONFIG_GAME_MGMT=y
|
||||
CONFIG_GAME_MGMT_SHELL=y
|
||||
CONFIG_GAME_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_THREAD_MGMT=y
|
||||
CONFIG_THREAD_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_THREAD_MGMT_SHELL=y
|
||||
CONFIG_FS_MGMT=y
|
||||
CONFIG_FS_MGMT_LOG_LEVEL_DBG=y
|
||||
CONFIG_AUDIO_LOG_LEVEL_DBG=y
|
||||
|
||||
# Optional: Shell for debugging
|
||||
CONFIG_SHELL=y
|
||||
CONFIG_OPENTHREAD_SHELL=y
|
||||
CONFIG_LASERTAG_ROLE_VEST=y
|
||||
Reference in New Issue
Block a user