Skip to content

Commit

Permalink
Merge pull request #349 from aabadie/dotbot-swarmit
Browse files Browse the repository at this point in the history
swarmit: add dotbot sample application
aabadie authored Jan 9, 2025
2 parents 1cfacba + a584698 commit 7702f02
Showing 11 changed files with 410 additions and 15 deletions.
12 changes: 10 additions & 2 deletions bsp/device.h
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@
#include <stdint.h>
#include <nrf.h>

#if defined(USE_SWARMIT)
uint64_t swarmit_read_device_id(void);
#endif

#if defined(NRF5340_XXAA) && defined(NRF_NETWORK)
#define NRF_FICR NRF_FICR_NS
#endif
@@ -39,10 +43,14 @@ static inline uint64_t db_device_addr(void) {
* @return device identifier in 64bit format
*/
static inline uint64_t db_device_id(void) {
#if defined(NRF5340_XXAA) && defined(NRF_NETWORK)
#if defined(NRF5340_XXAA)
#if defined(NRF_NETWORK)
return ((uint64_t)NRF_FICR_NS->INFO.DEVICEID[1]) << 32 | (uint64_t)NRF_FICR_NS->INFO.DEVICEID[0];
#elif defined(NRF5340_XXAA) && defined(NRF_APPLICATION)
#elif defined(USE_SWARMIT)
return swarmit_read_device_id();
#elif defined(NRF_APPLICATION)
return ((uint64_t)NRF_FICR_S->INFO.DEVICEID[1]) << 32 | (uint64_t)NRF_FICR_S->INFO.DEVICEID[0];
#endif
#else
return ((uint64_t)NRF_FICR->DEVICEID[1]) << 32 | (uint64_t)NRF_FICR->DEVICEID[0];
#endif
5 changes: 2 additions & 3 deletions bsp/nrf/lh2_default.c
Original file line number Diff line number Diff line change
@@ -54,9 +54,8 @@

#if defined(NRF5340_XXAA) && defined(NRF_APPLICATION)
#if defined(NRF_TRUSTZONE_NONSECURE)
#define NRF_SPIM NRF_SPIM4_NS
#define NRF_GPIOTE NRF_GPIOTE0_NS
#define NRF_PPI NRF_DPPIC_NS
#define NRF_SPIM NRF_SPIM4_NS
#define NRF_PPI NRF_DPPIC_NS
#else
#define NRF_SPIM NRF_SPIM4_S
#define NRF_GPIOTE NRF_GPIOTE0_S
14 changes: 13 additions & 1 deletion bsp/nrf/rng_nrf5340_app.c
Original file line number Diff line number Diff line change
@@ -17,12 +17,19 @@

//========================== variables =========================================

#if defined(USE_SWARMIT)
void swarmit_init_rng(void);
void swarmit_read_rng(uint8_t *value);
#else
extern volatile __attribute__((section(".shared_data"))) ipc_shared_data_t ipc_shared_data;
#endif

//=========================== public ===========================================

void db_rng_init(void) {

#if defined(USE_SWARMIT)
swarmit_init_rng();
#else
// Define RAMREGION 2 (0x20004000 to 0x20005FFF, e.g 8KiB) as non secure. It's used to share data between cores
db_configure_ram_non_secure(2, 1);

@@ -36,9 +43,14 @@ void db_rng_init(void) {
release_network_core();

db_ipc_network_call(DB_IPC_RNG_INIT_REQ);
#endif
}

void db_rng_read(uint8_t *value) {
#if defined(USE_SWARMIT)
swarmit_read_rng(value);
#else
db_ipc_network_call(DB_IPC_RNG_READ_REQ);
*value = ipc_shared_data.rng.value;
#endif
}
Binary file modified swarmit/cmse_implib.a
Binary file not shown.
15 changes: 15 additions & 0 deletions swarmit/dotbot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# DotBot control application

This application allows the DotBot to be controlled remotely either from
- a joystick or nrf52 compatible board running a firmware that sends compatible
commands _move_ or _rgbled_
- a computer running [the dotbot-controller tool](https://github.com/DotBots/PyDotBot)
and with a nRF52840-DK connected to it and used as gateway. The nRF52840-DK must run the
`03app_dotbot_gateway` firmware
- the buttons on the nRF52840-DK gatewaty itself

<div align="center">

![DotBot demo](../../doc/sphinx/_static/images/03app_dotbot.gif)

</div>
Loading

0 comments on commit 7702f02

Please sign in to comment.