summaryrefslogtreecommitdiff
path: root/src/events/event_queue.cpp
blob: d3a62ef6c6493d2b9dc10f89168ceee8d5f6835d (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
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#include "event_queue.hpp"

#include "audio_fsm.hpp"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/queue.h"
#include "system_fsm.hpp"
#include "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