diff options
Diffstat (limited to 'src/events.rs')
| -rw-r--r-- | src/events.rs | 14 |
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 | ||
| 4 | use core::num; | 4 | use core::num; |
| 5 | 5 | ||
| 6 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | ||
| 7 | use 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 | |||
| 287 | pub type EventQueue = PubSubChannel<CriticalSectionRawMutex, EventStatus, 2, 1, 1>; | ||
| 288 | pub type EventPublisher<'a> = Publisher<'a, CriticalSectionRawMutex, EventStatus, 2, 1, 1>; | ||
| 289 | pub type EventSubscriber<'a> = Subscriber<'a, CriticalSectionRawMutex, EventStatus, 2, 1, 1>; | ||
| 290 | |||
| 291 | #[derive(Clone, Copy)] | ||
| 292 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 293 | pub struct EventStatus { | ||
| 294 | pub event_type: Event, | ||
| 295 | pub status: u32, | ||
| 296 | } | ||
