blob: b96846e0b3335aa3ded891f22eac76d1df8fe5dd (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
#include <memory>
#include "battery/battery.hpp"
#include "database/database.hpp"
#include "drivers/bluetooth_types.hpp"
#include "drivers/haptics.hpp"
#include "drivers/samd.hpp"
#include "drivers/storage.hpp"
#include "ff.h"
#include "system_fsm/service_locator.hpp"
#include "tinyfsm.hpp"
namespace system_fsm {
struct DisplayReady : tinyfsm::Event {};
/*
* Sent by SysState when the system has finished with its boot and self-test,
* and is now ready to run normally.
*/
struct BootComplete : tinyfsm::Event {
std::shared_ptr<ServiceLocator> services;
};
/*
* May be sent by any component to indicate that the system has experienced an
* unrecoverable error. This should be used sparingly, as it essentially brings
* down the device.
*/
struct FatalError : tinyfsm::Event {};
struct OnIdle : tinyfsm::Event {};
struct SdStateChanged : tinyfsm::Event {};
struct UnmountRequest : tinyfsm::Event {
bool idle;
};
struct StorageError : tinyfsm::Event {
FRESULT error;
};
struct KeyLockChanged : tinyfsm::Event {
bool locking;
};
struct HasPhonesChanged : tinyfsm::Event {
bool has_headphones;
};
struct SdDetectChanged : tinyfsm::Event {
bool has_sd_card;
};
struct SamdUsbMscChanged : tinyfsm::Event {
bool en;
};
struct SamdUsbStatusChanged : tinyfsm::Event {
drivers::Samd::UsbStatus new_status;
};
struct BatteryStateChanged : tinyfsm::Event {
battery::Battery::BatteryState new_state;
};
struct BluetoothEvent : tinyfsm::Event {
drivers::bluetooth::Event event;
};
struct HapticTrigger : tinyfsm::Event {
drivers::Haptics::Effect effect;
};
namespace internal {
struct GpioInterrupt : tinyfsm::Event {};
struct SamdInterrupt : tinyfsm::Event {};
struct IdleTimeout : tinyfsm::Event {};
struct UnmountTimeout : tinyfsm::Event {};
struct Mount : tinyfsm::Event {
int attempt;
};
} // namespace internal
} // namespace system_fsm
|