Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: semtech sleep at application init #644

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions samples/sid_end_device/src/sidewalk_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <sid_hal_memory_ifc.h>
#ifdef CONFIG_SIDEWALK_SUBGHZ_SUPPORT
#include <app_subGHz_config.h>
#include <sid_pal_radio_ifc.h>
#endif /* CONFIG_SIDEWALK_SUBGHZ_SUPPORT */

#include <zephyr/logging/log.h>
Expand All @@ -30,6 +31,20 @@

LOG_MODULE_REGISTER(sidewalk_events, CONFIG_SIDEWALK_LOG_LEVEL);

#ifdef CONFIG_SIDEWALK_SUBGHZ_SUPPORT
static sid_pal_radio_rx_packet_t radio_rx_packet;

static void radio_event_notifier(sid_pal_radio_events_t event)
{
LOG_DBG("Radio event %d", event);
}

static void radio_irq_handler(void)
{
LOG_DBG("Radio IRQ");
}
#endif /* CONFIG_SIDEWALK_SUBGHZ_SUPPORT */

// private
void sidewalk_event_process(sidewalk_ctx_t *sid, void *ctx)
{
Expand Down Expand Up @@ -66,6 +81,18 @@ void sidewalk_event_platform_init(sidewalk_ctx_t *sid, void *ctx)
LOG_ERR("SIZE: 0x%08x", APP_MFG_CFG_FLASH_SIZE);
return;
}

#ifdef CONFIG_SIDEWALK_SUBGHZ_SUPPORT
int32_t err = 0;
err = sid_pal_radio_init(radio_event_notifier, radio_irq_handler, &radio_rx_packet);
if (err) {
LOG_ERR("radio init err %d", err);
}
err = sid_pal_radio_sleep(0);
if (err) {
LOG_ERR("radio sleep err %d", err);
}
#endif /* CONFIG_SIDEWALK_SUBGHZ_SUPPORT */
}

void sidewalk_event_autostart(sidewalk_ctx_t *sid, void *ctx)
Expand Down