apps/auracast: Make the code compile on native target

This fixes auracast native build by disabling GPIO button functionality.
This commit is contained in:
Mariusz Skamra
2024-09-02 13:58:22 +02:00
committed by Szymon Janc
parent d007e11cbd
commit 05cef9b1fa
2 changed files with 14 additions and 6 deletions
+9 -6
View File
@@ -60,12 +60,12 @@ static uint16_t bis_handles[MYNEWT_VAL(BROADCASTER_CHAN_NUM)];
static struct os_callout audio_broadcast_callout; static struct os_callout audio_broadcast_callout;
static int audio_data_offset; static int audio_data_offset;
static uint8_t auracast_adv_instance;
#if MYNEWT_VAL(BROADCASTER_STOP_BUTTON) >= 0
static struct os_task auracast_interrupt_task_str; static struct os_task auracast_interrupt_task_str;
static struct os_eventq auracast_interrupt_eventq; static struct os_eventq auracast_interrupt_eventq;
static os_stack_t auracast_interrupt_task_stack[BROADCASTER_INTERRUPT_TASK_STACK_SZ]; static os_stack_t auracast_interrupt_task_stack[BROADCASTER_INTERRUPT_TASK_STACK_SZ];
static uint8_t auracast_adv_instance;
static void static void
auracast_interrupt_task(void *arg) auracast_interrupt_task(void *arg)
{ {
@@ -90,6 +90,7 @@ auracast_gpio_irq(void *arg)
{ {
os_eventq_put(&auracast_interrupt_eventq, &broadcast_stop_ev); os_eventq_put(&auracast_interrupt_eventq, &broadcast_stop_ev);
} }
#endif /* MYNEWT_VAL(BROADCASTER_STOP_BUTTON) >= 0 */
static void static void
audio_broadcast_event_cb(struct os_event *ev) audio_broadcast_event_cb(struct os_event *ev)
@@ -373,6 +374,7 @@ mynewt_main(int argc, char **argv)
/* Set sync callback */ /* Set sync callback */
ble_hs_cfg.sync_cb = on_sync; ble_hs_cfg.sync_cb = on_sync;
#if MYNEWT_VAL(BROADCASTER_STOP_BUTTON) >= 0
os_eventq_init(&auracast_interrupt_eventq); os_eventq_init(&auracast_interrupt_eventq);
os_task_init(&auracast_interrupt_task_str, "auracast_interrupt_task", os_task_init(&auracast_interrupt_task_str, "auracast_interrupt_task",
auracast_interrupt_task, NULL, auracast_interrupt_task, NULL,
@@ -380,9 +382,10 @@ mynewt_main(int argc, char **argv)
auracast_interrupt_task_stack, auracast_interrupt_task_stack,
BROADCASTER_INTERRUPT_TASK_STACK_SZ); BROADCASTER_INTERRUPT_TASK_STACK_SZ);
hal_gpio_irq_init(BUTTON_3, auracast_gpio_irq, NULL, hal_gpio_irq_init(MYNEWT_VAL(BROADCASTER_STOP_BUTTON), auracast_gpio_irq,
HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_UP); NULL, HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_UP);
hal_gpio_irq_enable(BUTTON_3); hal_gpio_irq_enable(MYNEWT_VAL(BROADCASTER_STOP_BUTTON));
#endif /* MYNEWT_VAL(BROADCASTER_STOP_BUTTON) >= 0 */
/* As the last thing, process events from default event queue */ /* As the last thing, process events from default event queue */
while (1) { while (1) {
+5
View File
@@ -18,6 +18,11 @@
syscfg.defs: syscfg.defs:
BROADCASTER_CHAN_NUM: 2 BROADCASTER_CHAN_NUM: 2
BROADCASTER_BROADCAST_NAME: '"NimBLE Auracast"' BROADCASTER_BROADCAST_NAME: '"NimBLE Auracast"'
BROADCASTER_STOP_BUTTON:
description: >
Button number for Broadcast Stop action.
Negative value if disabled.
value: BUTTON_3
syscfg.vals: syscfg.vals:
CONSOLE_IMPLEMENTATION: full CONSOLE_IMPLEMENTATION: full