aboutsummaryrefslogtreecommitdiff
path: root/src/events.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/events.rs')
-rw-r--r--src/events.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/events.rs b/src/events.rs
index a828eec98..9e6bb9625 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -3,6 +3,9 @@
3 3
4use core::num; 4use core::num;
5 5
6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
7use embassy_sync::pubsub::{PubSubChannel, Publisher, Subscriber};
8
6#[derive(Clone, Copy, PartialEq, Eq, num_enum::FromPrimitive)] 9#[derive(Clone, Copy, PartialEq, Eq, num_enum::FromPrimitive)]
7#[cfg_attr(feature = "defmt", derive(defmt::Format))] 10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
8#[repr(u8)] 11#[repr(u8)]
@@ -280,3 +283,14 @@ pub enum Event {
280 /// highest val + 1 for range checking 283 /// highest val + 1 for range checking
281 LAST = 190, 284 LAST = 190,
282} 285}
286
287pub type EventQueue = PubSubChannel<CriticalSectionRawMutex, EventStatus, 2, 1, 1>;
288pub type EventPublisher<'a> = Publisher<'a, CriticalSectionRawMutex, EventStatus, 2, 1, 1>;
289pub type EventSubscriber<'a> = Subscriber<'a, CriticalSectionRawMutex, EventStatus, 2, 1, 1>;
290
291#[derive(Clone, Copy)]
292#[cfg_attr(feature = "defmt", derive(defmt::Format))]
293pub struct EventStatus {
294 pub event_type: Event,
295 pub status: u32,
296}