From f731366248a6800c7bcf7c5abadced857aa37722 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 19 Jun 2016 11:41:38 -0700 Subject: [PATCH] Hide some M0 EventDispatcher event masks. --- firmware/application/event_m0.hpp | 15 ++++++++++++--- firmware/application/irq_lcd_frame.cpp | 2 +- firmware/application/irq_rtc.cpp | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/firmware/application/event_m0.hpp b/firmware/application/event_m0.hpp index 0344905d..5b3b2fd2 100644 --- a/firmware/application/event_m0.hpp +++ b/firmware/application/event_m0.hpp @@ -38,12 +38,9 @@ #include -constexpr auto EVT_MASK_RTC_TICK = EVENT_MASK(0); -constexpr auto EVT_MASK_LCD_FRAME_SYNC = EVENT_MASK(1); constexpr auto EVT_MASK_SWITCHES = EVENT_MASK(3); constexpr auto EVT_MASK_ENCODER = EVENT_MASK(4); constexpr auto EVT_MASK_TOUCH = EVENT_MASK(5); -constexpr auto EVT_MASK_APPLICATION = EVENT_MASK(6); class EventDispatcher { public: @@ -63,6 +60,14 @@ public: } } + static inline void event_isr_rtc_tick() { + events_flag_isr(EVT_MASK_RTC_TICK); + } + + static inline void event_isr_lcd_frame_sync() { + events_flag_isr(EVT_MASK_LCD_FRAME_SYNC); + } + static inline void events_flag(const eventmask_t events) { if( thread_event_loop ) { chEvtSignal(thread_event_loop, events); @@ -80,6 +85,10 @@ public: } private: + static constexpr auto EVT_MASK_RTC_TICK = EVENT_MASK(0); + static constexpr auto EVT_MASK_LCD_FRAME_SYNC = EVENT_MASK(1); + static constexpr auto EVT_MASK_APPLICATION = EVENT_MASK(6); + static MessageHandlerMap message_map_; static Thread* thread_event_loop; diff --git a/firmware/application/irq_lcd_frame.cpp b/firmware/application/irq_lcd_frame.cpp index 585feb1f..d6a1c1bd 100644 --- a/firmware/application/irq_lcd_frame.cpp +++ b/firmware/application/irq_lcd_frame.cpp @@ -54,7 +54,7 @@ CH_IRQ_HANDLER(PIN_INT4_IRQHandler) { CH_IRQ_PROLOGUE(); chSysLockFromIsr(); - EventDispatcher::events_flag_isr(EVT_MASK_LCD_FRAME_SYNC); + EventDispatcher::event_isr_lcd_frame_sync(); chSysUnlockFromIsr(); LPC_GPIO_INT->IST = (1U << 4); diff --git a/firmware/application/irq_rtc.cpp b/firmware/application/irq_rtc.cpp index 332f1b3e..f9c047bf 100644 --- a/firmware/application/irq_rtc.cpp +++ b/firmware/application/irq_rtc.cpp @@ -39,7 +39,7 @@ CH_IRQ_HANDLER(RTC_IRQHandler) { CH_IRQ_PROLOGUE(); chSysLockFromIsr(); - EventDispatcher::events_flag_isr(EVT_MASK_RTC_TICK); + EventDispatcher::event_isr_rtc_tick(); chSysUnlockFromIsr(); rtc::interrupt::clear_all();