Skip to content

nRF52

Review MiraMesh hardware requirements here and here.

Defines

MIRAMESH_SYS_NUM_PPIS_USED

#define MIRAMESH_SYS_NUM_PPIS_USED

How many PPIs are used by MiraMesh.

MIRAMESH_SYS_NUM_PPI_GROUPS_USED

#define MIRAMESH_SYS_NUM_PPI_GROUPS_USED

How many PPI groups are used by MiraMesh.

Types

miramesh_hardware_cfg_t

typedef struct miramesh_hardware_cfg_nrf52 miramesh_hardware_cfg_t;

Hardware configuration for miramesh_sys_init argument.

miramesh_platform_specific_callback_cfg_t

typedef struct miramesh_platform_specific_callback_cfg_nrf52 miramesh_platform_specific_callback_cfg_t;

Structs

miramesh_hardware_cfg_nrf52

Hardware configuration for miramesh_sys_init argument.

Name Type Description
ppi_idx uint8_t[MIRAMESH_SYS_NUM_PPIS_USED] The PPIs to use
ppi_group_idx uint8_t[MIRAMESH_SYS_NUM_PPI_GROUPS_USED] The PPI groups to use
rtc uint8_t The RTC to use, 2 for RTC2
rtc_irq_prio uint8_t The prio of the RTC IRQ to use
swi uint8_t The SWI/EGU to use beside SWI1
swi_irq_prio uint8_t The SWI prio. Should be of higher priority than rtc_irq_prio

miramesh_platform_specific_callback_cfg_nrf52

Name Type Description
miramesh_mpsl_timeslot_request_callback void(*)(void) Only used for nrf54l-net and nrf528**sdc-net builds.

This callback is called from IRQ context. The callback should notify a cooperatively scheduled thread that will call the miramesh_request_timeslot() function everytime the callback is called.

!!! note

It is important that the thread gets to run as quick as possible.

Functions

miramesh_handle_sd_event

void miramesh_handle_sd_event(uint32_t evt_id);

Routes events from SoftDevice to MiraMesh.

Note

This is only used when building against libmira platform ending with ble-net.

This function is used by nRF52 targets to process recieved events.

Normally used like this:

#include "miramesh.h"
#include "miramesh_sys.h"
#include "nrf_sdh_soc.h"

static void sd_evt_observer(uint32_t evt_id, void *ctx) {
    miramesh_handle_sd_event(evt_id);
}

NRF_SDH_SOC_OBSERVER(m_sd_evt_miramesh, 0, sd_evt_observer, 0);
For that to work the nRF5 SDK's nrf_sdh_soc.c file needs to be part of the build.

miramesh_rtc_irq_handler

void miramesh_rtc_irq_handler(void);

The IRQ handler for the RTC events.

This function should be called from the RTCx_IRQHandler

miramesh_swi_irq_handler

void miramesh_swi_irq_handler(void);

The IRQ handler for the configurable SWI events.

This function should be called from the SWIx_EGUx_IRQHandler or put in the isr_vector directly.

miramesh_swi1_irq_handler

void miramesh_swi1_irq_handler(void);

The IRQ handler for the SWI1 events.

This function should be called from the SWI1_EGU1_IRQHandler or put in the isr_vector directly.

miramesh_handle_mpsl_timeslot_request

void miramesh_handle_mpsl_timeslot_request(void);

Request a timeslot.

This function should be called everytime the time call_for_timeslot_callback is called. !!! note This function has to be called from a cooperatively scheduled thread. Zephyr example:

void miramesh_timeslot_thread(
    void)
{
    do {
        k_thread_suspend(timeslot_thread_id);
        miramesh_handle_mpsl_timeslot_request();
    } while(true)
}
// The callback function
void timeslot_callback(
void)
{
    k_thread_resume(timeslot_thread_id);
}

Back to top