aboutsummaryrefslogtreecommitdiff
path: root/src/events.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-03-19 23:20:33 +0100
committerGitHub <[email protected]>2023-03-19 23:20:33 +0100
commit0e946dfb203dcf1ca3f165ffb06f3f58d4eaa119 (patch)
tree2c6f50f14ff762cbf47e8d2d5071662d49eb1f58 /src/events.rs
parentb411b7ce637e3e561f43b0c4f020f02b5607467b (diff)
parent1b410d6f3f08f12f2bd250a8b76f217291f4df26 (diff)
Merge pull request #42 from kbleeke/events-join
add event handling to join
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}