summaryrefslogtreecommitdiff
path: root/src/tangara/events/event_queue.cpp
blob: e4751398a1563cba738267aa2974ad71172d0d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#include "events/event_queue.hpp"

#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/queue.h"

#include "audio/audio_fsm.hpp"
#include "system_fsm/system_fsm.hpp"
#include "ui/ui_fsm.hpp"

namespace events {

namespace queues {
static Queue sSystemAndAudio;
static Queue sUi;

auto SystemAndAudio() -> Queue* {
  return &sSystemAndAudio;
}

auto Ui() -> Queue* {
  return &sUi;
}
}  // namespace queues

static Dispatcher<system_fsm::SystemState> sSystem{queues::SystemAndAudio()};
static Dispatcher<audio::AudioState> sAudio{queues::SystemAndAudio()};
static Dispatcher<ui::UiState> sUi{queues::Ui()};

auto System() -> Dispatcher<system_fsm::SystemState>& {
  return sSystem;
}

auto Audio() -> Dispatcher<audio::AudioState>& {
  return sAudio;
}

auto Ui() -> Dispatcher<ui::UiState>& {
  return sUi;
}

}  // namespace events