Skip to content

Commit

Permalink
apps/auracast: Make the code compile on native target
Browse files Browse the repository at this point in the history
This fixes auracast native build by disabling GPIO button functionality.
  • Loading branch information
MariuszSkamra committed May 21, 2024
1 parent 7ec17b6 commit 7817bab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/auracast/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ static uint16_t bis_handles[MYNEWT_VAL(BROADCASTER_CHAN_NUM)];
static struct os_callout audio_broadcast_callout;

static int audio_data_offset;
static uint8_t auracast_adv_instance;

#if MYNEWT_VAL(BROADCASTER_STOP_ON_BUTTON_PRESS)
static struct os_task auracast_interrupt_task_str;
static struct os_eventq auracast_interrupt_eventq;
static os_stack_t auracast_interrupt_task_stack[BROADCASTER_INTERRUPT_TASK_STACK_SZ];

static uint8_t auracast_adv_instance;

static void
auracast_interrupt_task(void *arg)
{
Expand All @@ -90,6 +90,7 @@ auracast_gpio_irq(void *arg)
{
os_eventq_put(&auracast_interrupt_eventq, &broadcast_stop_ev);
}
#endif /* BROADCASTER_STOP_ON_BUTTON_PRESS */

static void
audio_broadcast_event_cb(struct os_event *ev)
Expand Down Expand Up @@ -373,6 +374,7 @@ mynewt_main(int argc, char **argv)
/* Set sync callback */
ble_hs_cfg.sync_cb = on_sync;

#if MYNEWT_VAL(BROADCASTER_STOP_ON_BUTTON_PRESS)
os_eventq_init(&auracast_interrupt_eventq);
os_task_init(&auracast_interrupt_task_str, "auracast_interrupt_task",
auracast_interrupt_task, NULL,
Expand All @@ -383,6 +385,7 @@ mynewt_main(int argc, char **argv)
hal_gpio_irq_init(BUTTON_3, auracast_gpio_irq, NULL,
HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_UP);
hal_gpio_irq_enable(BUTTON_3);
#endif /* BROADCASTER_STOP_ON_BUTTON_PRESS */

/* As the last thing, process events from default event queue */
while (1) {
Expand Down
4 changes: 4 additions & 0 deletions apps/auracast/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
syscfg.defs:
BROADCASTER_CHAN_NUM: 2
BROADCASTER_BROADCAST_NAME: '"NimBLE Auracast"'
BROADCASTER_STOP_ON_BUTTON_PRESS:
description: >
Stop the broadcast stream on button press.
value: 1

syscfg.vals:
CONSOLE_IMPLEMENTATION: full
Expand Down

0 comments on commit 7817bab

Please sign in to comment.