From 1b410d6f3f08f12f2bd250a8b76f217291f4df26 Mon Sep 17 00:00:00 2001 From: kbleeke Date: Wed, 1 Mar 2023 19:03:46 +0100 Subject: add event handling to join --- src/events.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/events.rs') 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 @@ use core::num; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embassy_sync::pubsub::{PubSubChannel, Publisher, Subscriber}; + #[derive(Clone, Copy, PartialEq, Eq, num_enum::FromPrimitive)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] #[repr(u8)] @@ -280,3 +283,14 @@ pub enum Event { /// highest val + 1 for range checking LAST = 190, } + +pub type EventQueue = PubSubChannel; +pub type EventPublisher<'a> = Publisher<'a, CriticalSectionRawMutex, EventStatus, 2, 1, 1>; +pub type EventSubscriber<'a> = Subscriber<'a, CriticalSectionRawMutex, EventStatus, 2, 1, 1>; + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +pub struct EventStatus { + pub event_type: Event, + pub status: u32, +} -- cgit